mirror of
https://github.com/torvalds/linux.git
synced 2026-11-26 16:33:17 +00:00
nfsd4_lock will take the st_mutex before working with the stateid it
gets, but between the time when we drop the cl_lock and take the mutex,
the stateid could become unhashed (a'la FREE_STATEID). If that happens
the lock stateid returned to the client will be forgotten.
Fix this by first moving the st_mutex acquisition into
lookup_or_create_lock_state. Then, have it check to see if the lock
stateid is still hashed after taking the mutex. If it's not, then put
the stateid and try the find/create again.
Signed-off-by: Jeff Layton <[email protected]>
Tested-by: Alexey Kodanev <[email protected]>
Cc: [email protected] # feb9dad5 nfsd: Always lock state exclusively.
Cc: [email protected]
Signed-off-by: J. Bruce Fields <[email protected]>