diff options
| author | Jeff Layton <[email protected]> | 2025-02-20 16:47:13 +0000 |
|---|---|---|
| committer | Chuck Lever <[email protected]> | 2025-03-10 13:11:09 +0000 |
| commit | 1054e8ffc5c492f341bdf1888b882f1d163dd3d8 (patch) | |
| tree | 30280695ba12656e5db7a3c90d57faf61cd086ae /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |
| parent | nfsd: disallow file locking and delegations for NFSv4 reexport (diff) | |
| download | kernel-1054e8ffc5c492f341bdf1888b882f1d163dd3d8.tar.gz kernel-1054e8ffc5c492f341bdf1888b882f1d163dd3d8.zip | |
nfsd: prevent callback tasks running concurrently
The nfsd4_callback workqueue jobs exist to queue backchannel RPCs to
rpciod. Because they run in different workqueue contexts, the rpc_task
can run concurrently with the workqueue job itself, should it become
requeued. This is problematic as there is no locking when accessing the
fields in the nfsd4_callback.
Add a new unsigned long to nfsd4_callback and declare a new
NFSD4_CALLBACK_RUNNING flag to be set in it. When attempting to run a
workqueue job, do a test_and_set_bit() on that flag first, and don't
queue the workqueue job if it returns true. Clear NFSD4_CALLBACK_RUNNING
in nfsd41_destroy_cb().
This also gives us a more reliable mechanism for handling queueing
failures in codepaths where we have to take references under spinlocks.
We can now do the test_and_set_bit on NFSD4_CALLBACK_RUNNING first, and
only take references to the objects if that returns false.
Most of the nfsd4_run_cb() callers are converted to use this new flag or
the nfsd4_try_run_cb() wrapper. The main exception is the callback
channel probe, which has its own synchronization.
Signed-off-by: Jeff Layton <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
0 files changed, 0 insertions, 0 deletions
