diff options
-rw-r--r-- | fs/nfs/nfs4proc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 62fa4001e47a..92584c1ea725 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4813,8 +4813,10 @@ static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *reques | |||
4813 | 4813 | ||
4814 | static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) | 4814 | static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) |
4815 | { | 4815 | { |
4816 | struct nfs4_state_owner *sp = state->owner; | ||
4816 | struct nfs_inode *nfsi = NFS_I(state->inode); | 4817 | struct nfs_inode *nfsi = NFS_I(state->inode); |
4817 | unsigned char fl_flags = request->fl_flags; | 4818 | unsigned char fl_flags = request->fl_flags; |
4819 | unsigned int seq; | ||
4818 | int status = -ENOLCK; | 4820 | int status = -ENOLCK; |
4819 | 4821 | ||
4820 | if ((fl_flags & FL_POSIX) && | 4822 | if ((fl_flags & FL_POSIX) && |
@@ -4836,9 +4838,16 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
4836 | status = do_vfs_lock(request->fl_file, request); | 4838 | status = do_vfs_lock(request->fl_file, request); |
4837 | goto out_unlock; | 4839 | goto out_unlock; |
4838 | } | 4840 | } |
4841 | seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); | ||
4842 | up_read(&nfsi->rwsem); | ||
4839 | status = _nfs4_do_setlk(state, cmd, request, NFS_LOCK_NEW); | 4843 | status = _nfs4_do_setlk(state, cmd, request, NFS_LOCK_NEW); |
4840 | if (status != 0) | 4844 | if (status != 0) |
4845 | goto out; | ||
4846 | down_read(&nfsi->rwsem); | ||
4847 | if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq)) { | ||
4848 | status = -NFS4ERR_DELAY; | ||
4841 | goto out_unlock; | 4849 | goto out_unlock; |
4850 | } | ||
4842 | /* Note: we always want to sleep here! */ | 4851 | /* Note: we always want to sleep here! */ |
4843 | request->fl_flags = fl_flags | FL_SLEEP; | 4852 | request->fl_flags = fl_flags | FL_SLEEP; |
4844 | if (do_vfs_lock(request->fl_file, request) < 0) | 4853 | if (do_vfs_lock(request->fl_file, request) < 0) |