summaryrefslogtreecommitdiff
path: root/fs/omfs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@poochiereds.net>2015-09-17 14:47:08 +0300
committerJ. Bruce Fields <bfields@redhat.com>2015-10-13 00:31:03 +0300
commit35a92fe8770ce54c5eb275cd76128645bea2d200 (patch)
tree3c844e8991d12036688ece6073cd6f2d4cd17b13 /fs/omfs
parent3be7f32878e742cf3c17b435c90e198862457706 (diff)
downloadlinux-35a92fe8770ce54c5eb275cd76128645bea2d200.tar.xz
nfsd: serialize state seqid morphing operations
Andrew was seeing a race occur when an OPEN and OPEN_DOWNGRADE were running in parallel. The server would receive the OPEN_DOWNGRADE first and check its seqid, but then an OPEN would race in and bump it. The OPEN_DOWNGRADE would then complete and bump the seqid again. The result was that the OPEN_DOWNGRADE would be applied after the OPEN, even though it should have been rejected since the seqid changed. The only recourse we have here I think is to serialize operations that bump the seqid in a stateid, particularly when we're given a seqid in the call. To address this, we add a new rw_semaphore to the nfs4_ol_stateid struct. We do a down_write prior to checking the seqid after looking up the stateid to ensure that nothing else is going to bump it while we're operating on it. In the case of OPEN, we do a down_read, as the call doesn't contain a seqid. Those can run in parallel -- we just need to serialize them when there is a concurrent OPEN_DOWNGRADE or CLOSE. LOCK and LOCKU however always take the write lock as there is no opportunity for parallelizing those. Reported-and-Tested-by: Andrew W Elble <aweits@rit.edu> Signed-off-by: Jeff Layton <jeff.layton@primarydata.com> Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/omfs')
0 files changed, 0 insertions, 0 deletions