mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 03:06:10 +00:00
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>
This commit is contained in:
parent
68bf05efb7
commit
72211dbe72
3 changed files with 11 additions and 6 deletions
|
@ -286,6 +286,7 @@ extern struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter);
|
|||
extern int nfs_wait_on_sequence(struct nfs_seqid *seqid, struct rpc_task *task);
|
||||
extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid);
|
||||
extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid);
|
||||
extern void nfs_release_seqid(struct nfs_seqid *seqid);
|
||||
extern void nfs_free_seqid(struct nfs_seqid *seqid);
|
||||
|
||||
extern const nfs4_stateid zero_stateid;
|
||||
|
|
|
@ -1835,11 +1835,10 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
|
|||
if (calldata->arg.fmode == 0)
|
||||
break;
|
||||
default:
|
||||
if (nfs4_async_handle_error(task, server, state) == -EAGAIN) {
|
||||
nfs_restart_rpc(task, server->nfs_client);
|
||||
return;
|
||||
}
|
||||
if (nfs4_async_handle_error(task, server, state) == -EAGAIN)
|
||||
rpc_restart_call_prepare(task);
|
||||
}
|
||||
nfs_release_seqid(calldata->arg.seqid);
|
||||
nfs_refresh_inode(calldata->inode, calldata->res.fattr);
|
||||
}
|
||||
|
||||
|
|
|
@ -765,16 +765,21 @@ struct nfs_seqid *nfs_alloc_seqid(struct nfs_seqid_counter *counter)
|
|||
return new;
|
||||
}
|
||||
|
||||
void nfs_free_seqid(struct nfs_seqid *seqid)
|
||||
void nfs_release_seqid(struct nfs_seqid *seqid)
|
||||
{
|
||||
if (!list_empty(&seqid->list)) {
|
||||
struct rpc_sequence *sequence = seqid->sequence->sequence;
|
||||
|
||||
spin_lock(&sequence->lock);
|
||||
list_del(&seqid->list);
|
||||
list_del_init(&seqid->list);
|
||||
spin_unlock(&sequence->lock);
|
||||
rpc_wake_up(&sequence->wait);
|
||||
}
|
||||
}
|
||||
|
||||
void nfs_free_seqid(struct nfs_seqid *seqid)
|
||||
{
|
||||
nfs_release_seqid(seqid);
|
||||
kfree(seqid);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue