Merge branch 'bugfixes' into linux-next
* bugfixes: NFSv4.1: Fix an NFSv4.1 state renewal regression NFSv4: fix open/lock state recovery error handling NFSv4: Fix lock recovery when CREATE_SESSION/SETCLIENTID_CONFIRM fails NFS: Fabricate fscache server index key correctly SUNRPC: Add missing support for RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT nfs: fix duplicate proc entries
This commit is contained in:
@@ -1320,7 +1320,7 @@ static int nfs_server_list_show(struct seq_file *m, void *v)
|
|||||||
*/
|
*/
|
||||||
static int nfs_volume_list_open(struct inode *inode, struct file *file)
|
static int nfs_volume_list_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return seq_open_net(inode, file, &nfs_server_list_ops,
|
return seq_open_net(inode, file, &nfs_volume_list_ops,
|
||||||
sizeof(struct seq_net_private));
|
sizeof(struct seq_net_private));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,11 +74,10 @@ static uint16_t nfs_server_get_key(const void *cookie_netfs_data,
|
|||||||
struct nfs_server_key *key = buffer;
|
struct nfs_server_key *key = buffer;
|
||||||
uint16_t len = sizeof(struct nfs_server_key);
|
uint16_t len = sizeof(struct nfs_server_key);
|
||||||
|
|
||||||
|
memset(key, 0, len);
|
||||||
key->nfsversion = clp->rpc_ops->version;
|
key->nfsversion = clp->rpc_ops->version;
|
||||||
key->family = clp->cl_addr.ss_family;
|
key->family = clp->cl_addr.ss_family;
|
||||||
|
|
||||||
memset(key, 0, len);
|
|
||||||
|
|
||||||
switch (clp->cl_addr.ss_family) {
|
switch (clp->cl_addr.ss_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
key->port = sin->sin_port;
|
key->port = sin->sin_port;
|
||||||
|
@@ -482,6 +482,16 @@ int nfs40_walk_client_list(struct nfs_client *new,
|
|||||||
|
|
||||||
spin_lock(&nn->nfs_client_lock);
|
spin_lock(&nn->nfs_client_lock);
|
||||||
list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
|
list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
|
||||||
|
|
||||||
|
if (pos->rpc_ops != new->rpc_ops)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pos->cl_proto != new->cl_proto)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pos->cl_minorversion != new->cl_minorversion)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* If "pos" isn't marked ready, we can't trust the
|
/* If "pos" isn't marked ready, we can't trust the
|
||||||
* remaining fields in "pos" */
|
* remaining fields in "pos" */
|
||||||
if (pos->cl_cons_state > NFS_CS_READY) {
|
if (pos->cl_cons_state > NFS_CS_READY) {
|
||||||
@@ -501,15 +511,6 @@ int nfs40_walk_client_list(struct nfs_client *new,
|
|||||||
if (pos->cl_cons_state != NFS_CS_READY)
|
if (pos->cl_cons_state != NFS_CS_READY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pos->rpc_ops != new->rpc_ops)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pos->cl_proto != new->cl_proto)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pos->cl_minorversion != new->cl_minorversion)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pos->cl_clientid != new->cl_clientid)
|
if (pos->cl_clientid != new->cl_clientid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -622,6 +623,16 @@ int nfs41_walk_client_list(struct nfs_client *new,
|
|||||||
|
|
||||||
spin_lock(&nn->nfs_client_lock);
|
spin_lock(&nn->nfs_client_lock);
|
||||||
list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
|
list_for_each_entry(pos, &nn->nfs_client_list, cl_share_link) {
|
||||||
|
|
||||||
|
if (pos->rpc_ops != new->rpc_ops)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pos->cl_proto != new->cl_proto)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pos->cl_minorversion != new->cl_minorversion)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* If "pos" isn't marked ready, we can't trust the
|
/* If "pos" isn't marked ready, we can't trust the
|
||||||
* remaining fields in "pos", especially the client
|
* remaining fields in "pos", especially the client
|
||||||
* ID and serverowner fields. Wait for CREATE_SESSION
|
* ID and serverowner fields. Wait for CREATE_SESSION
|
||||||
@@ -647,15 +658,6 @@ int nfs41_walk_client_list(struct nfs_client *new,
|
|||||||
if (pos->cl_cons_state != NFS_CS_READY)
|
if (pos->cl_cons_state != NFS_CS_READY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pos->rpc_ops != new->rpc_ops)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pos->cl_proto != new->cl_proto)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pos->cl_minorversion != new->cl_minorversion)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!nfs4_match_clientids(pos, new))
|
if (!nfs4_match_clientids(pos, new))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -2234,9 +2234,13 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
|
|||||||
ret = _nfs4_proc_open(opendata);
|
ret = _nfs4_proc_open(opendata);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (ret == -ENOENT) {
|
if (ret == -ENOENT) {
|
||||||
d_drop(opendata->dentry);
|
dentry = opendata->dentry;
|
||||||
d_add(opendata->dentry, NULL);
|
if (dentry->d_inode)
|
||||||
nfs_set_verifier(opendata->dentry,
|
d_delete(dentry);
|
||||||
|
else if (d_unhashed(dentry))
|
||||||
|
d_add(dentry, NULL);
|
||||||
|
|
||||||
|
nfs_set_verifier(dentry,
|
||||||
nfs_save_change_attribute(opendata->dir->d_inode));
|
nfs_save_change_attribute(opendata->dir->d_inode));
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
@@ -2622,23 +2626,23 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
|
|||||||
is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags);
|
is_rdwr = test_bit(NFS_O_RDWR_STATE, &state->flags);
|
||||||
is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags);
|
is_rdonly = test_bit(NFS_O_RDONLY_STATE, &state->flags);
|
||||||
is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags);
|
is_wronly = test_bit(NFS_O_WRONLY_STATE, &state->flags);
|
||||||
/* Calculate the current open share mode */
|
|
||||||
calldata->arg.fmode = 0;
|
|
||||||
if (is_rdonly || is_rdwr)
|
|
||||||
calldata->arg.fmode |= FMODE_READ;
|
|
||||||
if (is_wronly || is_rdwr)
|
|
||||||
calldata->arg.fmode |= FMODE_WRITE;
|
|
||||||
/* Calculate the change in open mode */
|
/* Calculate the change in open mode */
|
||||||
|
calldata->arg.fmode = 0;
|
||||||
if (state->n_rdwr == 0) {
|
if (state->n_rdwr == 0) {
|
||||||
if (state->n_rdonly == 0) {
|
if (state->n_rdonly == 0)
|
||||||
call_close |= is_rdonly || is_rdwr;
|
call_close |= is_rdonly;
|
||||||
calldata->arg.fmode &= ~FMODE_READ;
|
else if (is_rdonly)
|
||||||
}
|
calldata->arg.fmode |= FMODE_READ;
|
||||||
if (state->n_wronly == 0) {
|
if (state->n_wronly == 0)
|
||||||
call_close |= is_wronly || is_rdwr;
|
call_close |= is_wronly;
|
||||||
calldata->arg.fmode &= ~FMODE_WRITE;
|
else if (is_wronly)
|
||||||
}
|
calldata->arg.fmode |= FMODE_WRITE;
|
||||||
}
|
} else if (is_rdwr)
|
||||||
|
calldata->arg.fmode |= FMODE_READ|FMODE_WRITE;
|
||||||
|
|
||||||
|
if (calldata->arg.fmode == 0)
|
||||||
|
call_close |= is_rdwr;
|
||||||
|
|
||||||
if (!nfs4_valid_open_stateid(state))
|
if (!nfs4_valid_open_stateid(state))
|
||||||
call_close = 0;
|
call_close = 0;
|
||||||
spin_unlock(&state->owner->so_lock);
|
spin_unlock(&state->owner->so_lock);
|
||||||
@@ -7368,7 +7372,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cr
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0)
|
if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0)
|
||||||
return 0;
|
return -EAGAIN;
|
||||||
task = _nfs41_proc_sequence(clp, cred, false);
|
task = _nfs41_proc_sequence(clp, cred, false);
|
||||||
if (IS_ERR(task))
|
if (IS_ERR(task))
|
||||||
ret = PTR_ERR(task);
|
ret = PTR_ERR(task);
|
||||||
|
@@ -88,10 +88,18 @@ nfs4_renew_state(struct work_struct *work)
|
|||||||
}
|
}
|
||||||
nfs_expire_all_delegations(clp);
|
nfs_expire_all_delegations(clp);
|
||||||
} else {
|
} else {
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* Queue an asynchronous RENEW. */
|
/* Queue an asynchronous RENEW. */
|
||||||
ops->sched_state_renewal(clp, cred, renew_flags);
|
ret = ops->sched_state_renewal(clp, cred, renew_flags);
|
||||||
put_rpccred(cred);
|
put_rpccred(cred);
|
||||||
goto out_exp;
|
switch (ret) {
|
||||||
|
default:
|
||||||
|
goto out_exp;
|
||||||
|
case -EAGAIN:
|
||||||
|
case -ENOMEM:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dprintk("%s: failed to call renewd. Reason: lease not expired \n",
|
dprintk("%s: failed to call renewd. Reason: lease not expired \n",
|
||||||
|
@@ -1705,7 +1705,8 @@ restart:
|
|||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
set_bit(ops->owner_flag_bit, &sp->so_flags);
|
set_bit(ops->owner_flag_bit, &sp->so_flags);
|
||||||
nfs4_put_state_owner(sp);
|
nfs4_put_state_owner(sp);
|
||||||
return nfs4_recovery_handle_error(clp, status);
|
status = nfs4_recovery_handle_error(clp, status);
|
||||||
|
return (status != 0) ? status : -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
nfs4_put_state_owner(sp);
|
nfs4_put_state_owner(sp);
|
||||||
@@ -1714,7 +1715,7 @@ restart:
|
|||||||
spin_unlock(&clp->cl_lock);
|
spin_unlock(&clp->cl_lock);
|
||||||
}
|
}
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
return status;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfs4_check_lease(struct nfs_client *clp)
|
static int nfs4_check_lease(struct nfs_client *clp)
|
||||||
@@ -1761,7 +1762,6 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
|
|||||||
break;
|
break;
|
||||||
case -NFS4ERR_STALE_CLIENTID:
|
case -NFS4ERR_STALE_CLIENTID:
|
||||||
clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
|
clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state);
|
||||||
nfs4_state_clear_reclaim_reboot(clp);
|
|
||||||
nfs4_state_start_reclaim_reboot(clp);
|
nfs4_state_start_reclaim_reboot(clp);
|
||||||
break;
|
break;
|
||||||
case -NFS4ERR_CLID_INUSE:
|
case -NFS4ERR_CLID_INUSE:
|
||||||
@@ -2367,14 +2367,11 @@ static void nfs4_state_manager(struct nfs_client *clp)
|
|||||||
section = "reclaim reboot";
|
section = "reclaim reboot";
|
||||||
status = nfs4_do_reclaim(clp,
|
status = nfs4_do_reclaim(clp,
|
||||||
clp->cl_mvops->reboot_recovery_ops);
|
clp->cl_mvops->reboot_recovery_ops);
|
||||||
if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
|
if (status == -EAGAIN)
|
||||||
test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
|
|
||||||
continue;
|
|
||||||
nfs4_state_end_reclaim_reboot(clp);
|
|
||||||
if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state))
|
|
||||||
continue;
|
continue;
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
goto out_error;
|
goto out_error;
|
||||||
|
nfs4_state_end_reclaim_reboot(clp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now recover expired state... */
|
/* Now recover expired state... */
|
||||||
@@ -2382,9 +2379,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
|
|||||||
section = "reclaim nograce";
|
section = "reclaim nograce";
|
||||||
status = nfs4_do_reclaim(clp,
|
status = nfs4_do_reclaim(clp,
|
||||||
clp->cl_mvops->nograce_recovery_ops);
|
clp->cl_mvops->nograce_recovery_ops);
|
||||||
if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
|
if (status == -EAGAIN)
|
||||||
test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) ||
|
|
||||||
test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
|
|
||||||
continue;
|
continue;
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
goto out_error;
|
goto out_error;
|
||||||
|
@@ -461,6 +461,8 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
|
|||||||
|
|
||||||
if (args->flags & RPC_CLNT_CREATE_AUTOBIND)
|
if (args->flags & RPC_CLNT_CREATE_AUTOBIND)
|
||||||
clnt->cl_autobind = 1;
|
clnt->cl_autobind = 1;
|
||||||
|
if (args->flags & RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT)
|
||||||
|
clnt->cl_noretranstimeo = 1;
|
||||||
if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
|
if (args->flags & RPC_CLNT_CREATE_DISCRTRY)
|
||||||
clnt->cl_discrtry = 1;
|
clnt->cl_discrtry = 1;
|
||||||
if (!(args->flags & RPC_CLNT_CREATE_QUIET))
|
if (!(args->flags & RPC_CLNT_CREATE_QUIET))
|
||||||
@@ -579,6 +581,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_create_args *args,
|
|||||||
/* Turn off autobind on clones */
|
/* Turn off autobind on clones */
|
||||||
new->cl_autobind = 0;
|
new->cl_autobind = 0;
|
||||||
new->cl_softrtry = clnt->cl_softrtry;
|
new->cl_softrtry = clnt->cl_softrtry;
|
||||||
|
new->cl_noretranstimeo = clnt->cl_noretranstimeo;
|
||||||
new->cl_discrtry = clnt->cl_discrtry;
|
new->cl_discrtry = clnt->cl_discrtry;
|
||||||
new->cl_chatty = clnt->cl_chatty;
|
new->cl_chatty = clnt->cl_chatty;
|
||||||
return new;
|
return new;
|
||||||
|
Reference in New Issue
Block a user