diff options
author | Jeff Layton <jlayton@poochiereds.net> | 2015-09-17 14:58:24 +0300 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2015-10-23 22:57:32 +0300 |
commit | cc8a55320b5f1196bee5bd14e4bb2ebd3b983317 (patch) | |
tree | d5b6e13f764cc2c0a37d8676662302e09e1ec020 /fs/nfsd/state.h | |
parent | 4eaea13425078272895ec37814c6878d78b8db9f (diff) | |
download | linux-cc8a55320b5f1196bee5bd14e4bb2ebd3b983317.tar.xz |
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>
Diffstat (limited to 'fs/nfsd/state.h')
-rw-r--r-- | fs/nfsd/state.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 31bde12feefe..1fa0f3848d4e 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h @@ -562,6 +562,7 @@ struct nfs4_layout_stateid { struct nfsd4_callback ls_recall; stateid_t ls_recall_sid; bool ls_recalled; + struct mutex ls_mutex; }; static inline struct nfs4_layout_stateid *layoutstateid(struct nfs4_stid *s) |