Jeff Layton dd257933fa nfsd: don't return an unhashed lock stateid after taking mutex
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 <jlayton@redhat.com>
Tested-by: Alexey Kodanev <alexey.kodanev@oracle.com>
Cc: stable@vger.kernel.org # feb9dad5 nfsd: Always lock state exclusively.
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2016-08-12 16:10:25 -04:00
..
2014-07-08 17:14:27 -04:00
2016-08-04 19:59:06 -04:00
2016-08-04 19:59:06 -04:00
2016-03-18 11:42:53 -04:00
2014-08-17 12:00:12 -04:00
2016-01-22 18:04:28 -05:00
2016-08-04 17:11:49 -04:00
2016-07-13 15:53:41 -04:00
2016-05-29 19:08:00 -04:00
2016-01-14 17:32:51 -05:00
2016-08-11 11:42:08 -04:00
2016-08-04 17:11:49 -04:00
2015-02-02 18:09:43 +01:00