]> git.baikalelectronics.ru Git - kernel.git/commit
nfsd: serialize layout stateid morphing operations
authorJeff Layton <jlayton@poochiereds.net>
Thu, 17 Sep 2015 11:58:24 +0000 (07:58 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 23 Oct 2015 19:57:32 +0000 (15:57 -0400)
commit72451631588b2210062b9e1069a1fcdad30ff005
treed5b6e13f764cc2c0a37d8676662302e09e1ec020
parenteb3f338b5b3a0401d4f96c60c2620ac90ebab6cb
nfsd: serialize layout stateid morphing operations

In order to allow the client to make a sane determination of what
happened with racing LAYOUTGET/LAYOUTRETURN/CB_LAYOUTRECALL calls, we
must ensure that the seqids return accurately represent the order of
operations. The simplest way to do that is to ensure that operations on
a single stateid are serialized.

This patch adds a mutex to the layout stateid, and locks it when
checking the layout stateid's seqid. The mutex is held over the entire
operation and released after the seqid is bumped.

Note that in the case of CB_LAYOUTRECALL we must move the increment of
the seqid and setting into a new cb "prepare" operation. The lease
infrastructure will call the lm_break callback with a spinlock held, so
and we can't take the mutex in that codepath.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4layouts.c
fs/nfsd/nfs4proc.c
fs/nfsd/state.h