aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7ce07862c2fb..dbc09271af02 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -51,6 +51,7 @@
51 51
52#include "nfs4_fs.h" 52#include "nfs4_fs.h"
53#include "delegation.h" 53#include "delegation.h"
54#include "internal.h"
54#include "iostat.h" 55#include "iostat.h"
55 56
56#define NFSDBG_FACILITY NFSDBG_PROC 57#define NFSDBG_FACILITY NFSDBG_PROC
@@ -239,6 +240,8 @@ static void nfs4_init_opendata_res(struct nfs4_opendata *p)
239{ 240{
240 p->o_res.f_attr = &p->f_attr; 241 p->o_res.f_attr = &p->f_attr;
241 p->o_res.dir_attr = &p->dir_attr; 242 p->o_res.dir_attr = &p->dir_attr;
243 p->o_res.seqid = p->o_arg.seqid;
244 p->c_res.seqid = p->c_arg.seqid;
242 p->o_res.server = p->o_arg.server; 245 p->o_res.server = p->o_arg.server;
243 nfs_fattr_init(&p->f_attr); 246 nfs_fattr_init(&p->f_attr);
244 nfs_fattr_init(&p->dir_attr); 247 nfs_fattr_init(&p->dir_attr);
@@ -729,7 +732,6 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
729 renew_lease(data->o_res.server, data->timestamp); 732 renew_lease(data->o_res.server, data->timestamp);
730 data->rpc_done = 1; 733 data->rpc_done = 1;
731 } 734 }
732 nfs_increment_open_seqid(data->rpc_status, data->c_arg.seqid);
733} 735}
734 736
735static void nfs4_open_confirm_release(void *calldata) 737static void nfs4_open_confirm_release(void *calldata)
@@ -773,6 +775,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
773 .rpc_message = &msg, 775 .rpc_message = &msg,
774 .callback_ops = &nfs4_open_confirm_ops, 776 .callback_ops = &nfs4_open_confirm_ops,
775 .callback_data = data, 777 .callback_data = data,
778 .workqueue = nfsiod_workqueue,
776 .flags = RPC_TASK_ASYNC, 779 .flags = RPC_TASK_ASYNC,
777 }; 780 };
778 int status; 781 int status;
@@ -858,7 +861,6 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata)
858 if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)) 861 if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM))
859 nfs_confirm_seqid(&data->owner->so_seqid, 0); 862 nfs_confirm_seqid(&data->owner->so_seqid, 0);
860 } 863 }
861 nfs_increment_open_seqid(data->rpc_status, data->o_arg.seqid);
862 data->rpc_done = 1; 864 data->rpc_done = 1;
863} 865}
864 866
@@ -910,6 +912,7 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
910 .rpc_message = &msg, 912 .rpc_message = &msg,
911 .callback_ops = &nfs4_open_ops, 913 .callback_ops = &nfs4_open_ops,
912 .callback_data = data, 914 .callback_data = data,
915 .workqueue = nfsiod_workqueue,
913 .flags = RPC_TASK_ASYNC, 916 .flags = RPC_TASK_ASYNC,
914 }; 917 };
915 int status; 918 int status;
@@ -979,11 +982,8 @@ static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *s
979 if (IS_ERR(opendata)) 982 if (IS_ERR(opendata))
980 return PTR_ERR(opendata); 983 return PTR_ERR(opendata);
981 ret = nfs4_open_recover(opendata, state); 984 ret = nfs4_open_recover(opendata, state);
982 if (ret == -ESTALE) { 985 if (ret == -ESTALE)
983 /* Invalidate the state owner so we don't ever use it again */
984 nfs4_drop_state_owner(state->owner);
985 d_drop(ctx->path.dentry); 986 d_drop(ctx->path.dentry);
986 }
987 nfs4_opendata_put(opendata); 987 nfs4_opendata_put(opendata);
988 return ret; 988 return ret;
989} 989}
@@ -1226,7 +1226,6 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
1226 /* hmm. we are done with the inode, and in the process of freeing 1226 /* hmm. we are done with the inode, and in the process of freeing
1227 * the state_owner. we keep this around to process errors 1227 * the state_owner. we keep this around to process errors
1228 */ 1228 */
1229 nfs_increment_open_seqid(task->tk_status, calldata->arg.seqid);
1230 switch (task->tk_status) { 1229 switch (task->tk_status) {
1231 case 0: 1230 case 0:
1232 nfs_set_open_stateid(state, &calldata->res.stateid, 0); 1231 nfs_set_open_stateid(state, &calldata->res.stateid, 0);
@@ -1315,6 +1314,7 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
1315 .rpc_client = server->client, 1314 .rpc_client = server->client,
1316 .rpc_message = &msg, 1315 .rpc_message = &msg,
1317 .callback_ops = &nfs4_close_ops, 1316 .callback_ops = &nfs4_close_ops,
1317 .workqueue = nfsiod_workqueue,
1318 .flags = RPC_TASK_ASYNC, 1318 .flags = RPC_TASK_ASYNC,
1319 }; 1319 };
1320 int status = -ENOMEM; 1320 int status = -ENOMEM;
@@ -1332,6 +1332,7 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
1332 goto out_free_calldata; 1332 goto out_free_calldata;
1333 calldata->arg.bitmask = server->attr_bitmask; 1333 calldata->arg.bitmask = server->attr_bitmask;
1334 calldata->res.fattr = &calldata->fattr; 1334 calldata->res.fattr = &calldata->fattr;
1335 calldata->res.seqid = calldata->arg.seqid;
1335 calldata->res.server = server; 1336 calldata->res.server = server;
1336 calldata->path.mnt = mntget(path->mnt); 1337 calldata->path.mnt = mntget(path->mnt);
1337 calldata->path.dentry = dget(path->dentry); 1338 calldata->path.dentry = dget(path->dentry);
@@ -1404,7 +1405,7 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1404 BUG_ON(nd->intent.open.flags & O_CREAT); 1405 BUG_ON(nd->intent.open.flags & O_CREAT);
1405 } 1406 }
1406 1407
1407 cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); 1408 cred = rpc_lookup_cred();
1408 if (IS_ERR(cred)) 1409 if (IS_ERR(cred))
1409 return (struct dentry *)cred; 1410 return (struct dentry *)cred;
1410 parent = dentry->d_parent; 1411 parent = dentry->d_parent;
@@ -1439,7 +1440,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
1439 struct rpc_cred *cred; 1440 struct rpc_cred *cred;
1440 struct nfs4_state *state; 1441 struct nfs4_state *state;
1441 1442
1442 cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); 1443 cred = rpc_lookup_cred();
1443 if (IS_ERR(cred)) 1444 if (IS_ERR(cred))
1444 return PTR_ERR(cred); 1445 return PTR_ERR(cred);
1445 state = nfs4_do_open(dir, &path, openflags, NULL, cred); 1446 state = nfs4_do_open(dir, &path, openflags, NULL, cred);
@@ -1656,7 +1657,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
1656 1657
1657 nfs_fattr_init(fattr); 1658 nfs_fattr_init(fattr);
1658 1659
1659 cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0); 1660 cred = rpc_lookup_cred();
1660 if (IS_ERR(cred)) 1661 if (IS_ERR(cred))
1661 return PTR_ERR(cred); 1662 return PTR_ERR(cred);
1662 1663
@@ -1892,7 +1893,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
1892 struct rpc_cred *cred; 1893 struct rpc_cred *cred;
1893 int status = 0; 1894 int status = 0;
1894 1895
1895 cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); 1896 cred = rpc_lookup_cred();
1896 if (IS_ERR(cred)) { 1897 if (IS_ERR(cred)) {
1897 status = PTR_ERR(cred); 1898 status = PTR_ERR(cred);
1898 goto out; 1899 goto out;
@@ -2761,10 +2762,10 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server)
2761 case -NFS4ERR_STALE_CLIENTID: 2762 case -NFS4ERR_STALE_CLIENTID:
2762 case -NFS4ERR_STALE_STATEID: 2763 case -NFS4ERR_STALE_STATEID:
2763 case -NFS4ERR_EXPIRED: 2764 case -NFS4ERR_EXPIRED:
2764 rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL, NULL); 2765 rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL);
2765 nfs4_schedule_state_recovery(clp); 2766 nfs4_schedule_state_recovery(clp);
2766 if (test_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state) == 0) 2767 if (test_bit(NFS4CLNT_STATE_RECOVER, &clp->cl_state) == 0)
2767 rpc_wake_up_task(task); 2768 rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task);
2768 task->tk_status = 0; 2769 task->tk_status = 0;
2769 return -EAGAIN; 2770 return -EAGAIN;
2770 case -NFS4ERR_DELAY: 2771 case -NFS4ERR_DELAY:
@@ -2884,7 +2885,7 @@ int nfs4_proc_setclientid(struct nfs_client *clp, u32 program, unsigned short po
2884 RPC_DISPLAY_ADDR), 2885 RPC_DISPLAY_ADDR),
2885 rpc_peeraddr2str(clp->cl_rpcclient, 2886 rpc_peeraddr2str(clp->cl_rpcclient,
2886 RPC_DISPLAY_PROTO), 2887 RPC_DISPLAY_PROTO),
2887 cred->cr_ops->cr_name, 2888 clp->cl_rpcclient->cl_auth->au_ops->au_name,
2888 clp->cl_id_uniquifier); 2889 clp->cl_id_uniquifier);
2889 setclientid.sc_netid_len = scnprintf(setclientid.sc_netid, 2890 setclientid.sc_netid_len = scnprintf(setclientid.sc_netid,
2890 sizeof(setclientid.sc_netid), 2891 sizeof(setclientid.sc_netid),
@@ -3158,6 +3159,7 @@ static struct nfs4_unlockdata *nfs4_alloc_unlockdata(struct file_lock *fl,
3158 p->arg.fh = NFS_FH(inode); 3159 p->arg.fh = NFS_FH(inode);
3159 p->arg.fl = &p->fl; 3160 p->arg.fl = &p->fl;
3160 p->arg.seqid = seqid; 3161 p->arg.seqid = seqid;
3162 p->res.seqid = seqid;
3161 p->arg.stateid = &lsp->ls_stateid; 3163 p->arg.stateid = &lsp->ls_stateid;
3162 p->lsp = lsp; 3164 p->lsp = lsp;
3163 atomic_inc(&lsp->ls_count); 3165 atomic_inc(&lsp->ls_count);
@@ -3183,7 +3185,6 @@ static void nfs4_locku_done(struct rpc_task *task, void *data)
3183 3185
3184 if (RPC_ASSASSINATED(task)) 3186 if (RPC_ASSASSINATED(task))
3185 return; 3187 return;
3186 nfs_increment_lock_seqid(task->tk_status, calldata->arg.seqid);
3187 switch (task->tk_status) { 3188 switch (task->tk_status) {
3188 case 0: 3189 case 0:
3189 memcpy(calldata->lsp->ls_stateid.data, 3190 memcpy(calldata->lsp->ls_stateid.data,
@@ -3235,6 +3236,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
3235 .rpc_client = NFS_CLIENT(lsp->ls_state->inode), 3236 .rpc_client = NFS_CLIENT(lsp->ls_state->inode),
3236 .rpc_message = &msg, 3237 .rpc_message = &msg,
3237 .callback_ops = &nfs4_locku_ops, 3238 .callback_ops = &nfs4_locku_ops,
3239 .workqueue = nfsiod_workqueue,
3238 .flags = RPC_TASK_ASYNC, 3240 .flags = RPC_TASK_ASYNC,
3239 }; 3241 };
3240 3242
@@ -3261,6 +3263,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
3261 struct nfs4_lock_state *lsp; 3263 struct nfs4_lock_state *lsp;
3262 struct rpc_task *task; 3264 struct rpc_task *task;
3263 int status = 0; 3265 int status = 0;
3266 unsigned char fl_flags = request->fl_flags;
3264 3267
3265 status = nfs4_set_lock_state(state, request); 3268 status = nfs4_set_lock_state(state, request);
3266 /* Unlock _before_ we do the RPC call */ 3269 /* Unlock _before_ we do the RPC call */
@@ -3284,6 +3287,7 @@ static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *
3284 status = nfs4_wait_for_completion_rpc_task(task); 3287 status = nfs4_wait_for_completion_rpc_task(task);
3285 rpc_put_task(task); 3288 rpc_put_task(task);
3286out: 3289out:
3290 request->fl_flags = fl_flags;
3287 return status; 3291 return status;
3288} 3292}
3289 3293
@@ -3320,6 +3324,7 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl,
3320 p->arg.lock_stateid = &lsp->ls_stateid; 3324 p->arg.lock_stateid = &lsp->ls_stateid;
3321 p->arg.lock_owner.clientid = server->nfs_client->cl_clientid; 3325 p->arg.lock_owner.clientid = server->nfs_client->cl_clientid;
3322 p->arg.lock_owner.id = lsp->ls_id.id; 3326 p->arg.lock_owner.id = lsp->ls_id.id;
3327 p->res.lock_seqid = p->arg.lock_seqid;
3323 p->lsp = lsp; 3328 p->lsp = lsp;
3324 atomic_inc(&lsp->ls_count); 3329 atomic_inc(&lsp->ls_count);
3325 p->ctx = get_nfs_open_context(ctx); 3330 p->ctx = get_nfs_open_context(ctx);
@@ -3346,6 +3351,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
3346 return; 3351 return;
3347 data->arg.open_stateid = &state->stateid; 3352 data->arg.open_stateid = &state->stateid;
3348 data->arg.new_lock_owner = 1; 3353 data->arg.new_lock_owner = 1;
3354 data->res.open_seqid = data->arg.open_seqid;
3349 } else 3355 } else
3350 data->arg.new_lock_owner = 0; 3356 data->arg.new_lock_owner = 0;
3351 data->timestamp = jiffies; 3357 data->timestamp = jiffies;
@@ -3363,7 +3369,6 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
3363 if (RPC_ASSASSINATED(task)) 3369 if (RPC_ASSASSINATED(task))
3364 goto out; 3370 goto out;
3365 if (data->arg.new_lock_owner != 0) { 3371 if (data->arg.new_lock_owner != 0) {
3366 nfs_increment_open_seqid(data->rpc_status, data->arg.open_seqid);
3367 if (data->rpc_status == 0) 3372 if (data->rpc_status == 0)
3368 nfs_confirm_seqid(&data->lsp->ls_seqid, 0); 3373 nfs_confirm_seqid(&data->lsp->ls_seqid, 0);
3369 else 3374 else
@@ -3375,7 +3380,6 @@ static void nfs4_lock_done(struct rpc_task *task, void *calldata)
3375 data->lsp->ls_flags |= NFS_LOCK_INITIALIZED; 3380 data->lsp->ls_flags |= NFS_LOCK_INITIALIZED;
3376 renew_lease(NFS_SERVER(data->ctx->path.dentry->d_inode), data->timestamp); 3381 renew_lease(NFS_SERVER(data->ctx->path.dentry->d_inode), data->timestamp);
3377 } 3382 }
3378 nfs_increment_lock_seqid(data->rpc_status, data->arg.lock_seqid);
3379out: 3383out:
3380 dprintk("%s: done, ret = %d!\n", __FUNCTION__, data->rpc_status); 3384 dprintk("%s: done, ret = %d!\n", __FUNCTION__, data->rpc_status);
3381} 3385}
@@ -3419,6 +3423,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3419 .rpc_client = NFS_CLIENT(state->inode), 3423 .rpc_client = NFS_CLIENT(state->inode),
3420 .rpc_message = &msg, 3424 .rpc_message = &msg,
3421 .callback_ops = &nfs4_lock_ops, 3425 .callback_ops = &nfs4_lock_ops,
3426 .workqueue = nfsiod_workqueue,
3422 .flags = RPC_TASK_ASYNC, 3427 .flags = RPC_TASK_ASYNC,
3423 }; 3428 };
3424 int ret; 3429 int ret;