diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-15 14:47:36 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-15 14:47:36 -0500 |
commit | 72211dbe727f7c1451aa5adfcbd1197b090eb276 (patch) | |
tree | 1669a3a5e7d30e71451cd975161506b84bf6b1ad /fs/nfs | |
parent | 68bf05efb7facbcf4a7b8d6b48a0800a90895511 (diff) |
NFSv4: Release the sequence id before restarting a CLOSE rpc call
If the CLOSE or OPEN_DOWNGRADE call triggers a state recovery, and has
to be resent, then we must release the seqid. Otherwise the open
recovery will wait for the close to finish, which causes a deadlock.
This is mainly a NFSv4.1 problem, although it can theoretically happen
with NFSv4.0 too, in a OPEN_DOWNGRADE situation.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4_fs.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 7 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 9 |
3 files changed, 11 insertions, 6 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index e8791d5a2f7a..865265bdca03 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -286,6 +286,7 @@ extern struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter); | |||
286 | extern int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task); | 286 | extern int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task); |
287 | extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid); | 287 | extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid); |
288 | extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid); | 288 | extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid); |
289 | extern void nfs_release_seqid(struct nfs_seqid *seqid); | ||
289 | extern void nfs_free_seqid(struct nfs_seqid *seqid); | 290 | extern void nfs_free_seqid(struct nfs_seqid *seqid); |
290 | 291 | ||
291 | extern const nfs4_stateid zero_stateid; | 292 | extern const nfs4_stateid zero_stateid; |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 019a009e73a0..198d51d17c13 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1835,11 +1835,10 @@ static void nfs4_close_done(struct rpc_task *task, void *data) | |||
1835 | if (calldata->arg.fmode == 0) | 1835 | if (calldata->arg.fmode == 0) |
1836 | break; | 1836 | break; |
1837 | default: | 1837 | default: |
1838 | if (nfs4_async_handle_error(task, server, state) == -EAGAIN) { | 1838 | if (nfs4_async_handle_error(task, server, state) == -EAGAIN) |
1839 | nfs_restart_rpc(task, server->nfs_client); | 1839 | rpc_restart_call_prepare(task); |
1840 | return; | ||
1841 | } | ||
1842 | } | 1840 | } |
1841 | nfs_release_seqid(calldata->arg.seqid); | ||
1843 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); | 1842 | nfs_refresh_inode(calldata->inode, calldata->res.fattr); |
1844 | } | 1843 | } |
1845 | 1844 | ||
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 6674b28ddb66..18e8b26878c5 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -765,16 +765,21 @@ struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter) | |||
765 | return new; | 765 | return new; |
766 | } | 766 | } |
767 | 767 | ||
768 | void nfs_free_seqid(struct nfs_seqid *seqid) | 768 | void nfs_release_seqid(struct nfs_seqid *seqid) |
769 | { | 769 | { |
770 | if (!list_empty(&seqid->list)) { | 770 | if (!list_empty(&seqid->list)) { |
771 | struct rpc_sequence *sequence = seqid->sequence->sequence; | 771 | struct rpc_sequence *sequence = seqid->sequence->sequence; |
772 | 772 | ||
773 | spin_lock(&sequence->lock); | 773 | spin_lock(&sequence->lock); |
774 | list_del(&seqid->list); | 774 | list_del_init(&seqid->list); |
775 | spin_unlock(&sequence->lock); | 775 | spin_unlock(&sequence->lock); |
776 | rpc_wake_up(&sequence->wait); | 776 | rpc_wake_up(&sequence->wait); |
777 | } | 777 | } |
778 | } | ||
779 | |||
780 | void nfs_free_seqid(struct nfs_seqid *seqid) | ||
781 | { | ||
782 | nfs_release_seqid(seqid); | ||
778 | kfree(seqid); | 783 | kfree(seqid); |
779 | } | 784 | } |
780 | 785 | ||