diff options
| author | NeilBrown <[email protected]> | 2025-05-09 00:46:38 +0000 |
|---|---|---|
| committer | Anna Schumaker <[email protected]> | 2025-05-28 21:17:14 +0000 |
| commit | ed9be317330c7390df7db9e1d046698c02001bd2 (patch) | |
| tree | 547c2ed7eed5776c7f8f43ac74802a7327efc041 /drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |
| parent | SUNRPC: Remove dead code from xs_tcp_tls_setup_socket() (diff) | |
| download | kernel-ed9be317330c7390df7db9e1d046698c02001bd2.tar.gz kernel-ed9be317330c7390df7db9e1d046698c02001bd2.zip | |
nfs_localio: use cmpxchg() to install new nfs_file_localio
Rather than using nfs_uuid.lock to protect installing
a new ro_file or rw_file, change to use cmpxchg().
Removing the file already uses xchg() so this improves symmetry
and also makes the code a little simpler.
Also remove the optimisation of not taking the lock, and not removing
the nfs_file_localio from the linked list, when both ->ro_file and
->rw_file are already NULL. Given that ->nfs_uuid was not NULL, it is
extremely unlikely that neither ->ro_file or ->rw_file is NULL so
this optimisation can be of little value and it complicates
understanding of the code - why can the list_del_init() be skipped?
Finally, move the assignment of NULL to ->nfs_uuid until after
the last action on the nfs_file_localio (the list_del_init). As soon as
this is NULL a racing nfs_close_local_fh() can bypass all the locking
and go on to free the nfs_file_localio, so we must be certain to be
finished with it first.
Fixes: 86e00412254a ("nfs: cache all open LOCALIO nfsd_file(s) in client")
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c')
0 files changed, 0 insertions, 0 deletions
