diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 180 |
1 files changed, 78 insertions, 102 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f8c0066e02e1..47ece1dd3c67 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 "iostat.h" | ||
54 | 55 | ||
55 | #define NFSDBG_FACILITY NFSDBG_PROC | 56 | #define NFSDBG_FACILITY NFSDBG_PROC |
56 | 57 | ||
@@ -335,7 +336,7 @@ static struct nfs4_state *nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data | |||
335 | if (!(data->f_attr.valid & NFS_ATTR_FATTR)) | 336 | if (!(data->f_attr.valid & NFS_ATTR_FATTR)) |
336 | goto out; | 337 | goto out; |
337 | inode = nfs_fhget(data->dir->d_sb, &data->o_res.fh, &data->f_attr); | 338 | inode = nfs_fhget(data->dir->d_sb, &data->o_res.fh, &data->f_attr); |
338 | if (inode == NULL) | 339 | if (IS_ERR(inode)) |
339 | goto out; | 340 | goto out; |
340 | state = nfs4_get_open_state(inode, data->owner); | 341 | state = nfs4_get_open_state(inode, data->owner); |
341 | if (state == NULL) | 342 | if (state == NULL) |
@@ -604,11 +605,14 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) | |||
604 | int status; | 605 | int status; |
605 | 606 | ||
606 | atomic_inc(&data->count); | 607 | atomic_inc(&data->count); |
608 | /* | ||
609 | * If rpc_run_task() ends up calling ->rpc_release(), we | ||
610 | * want to ensure that it takes the 'error' code path. | ||
611 | */ | ||
612 | data->rpc_status = -ENOMEM; | ||
607 | task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_confirm_ops, data); | 613 | task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_confirm_ops, data); |
608 | if (IS_ERR(task)) { | 614 | if (IS_ERR(task)) |
609 | nfs4_opendata_free(data); | ||
610 | return PTR_ERR(task); | 615 | return PTR_ERR(task); |
611 | } | ||
612 | status = nfs4_wait_for_completion_rpc_task(task); | 616 | status = nfs4_wait_for_completion_rpc_task(task); |
613 | if (status != 0) { | 617 | if (status != 0) { |
614 | data->cancelled = 1; | 618 | data->cancelled = 1; |
@@ -707,11 +711,14 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) | |||
707 | int status; | 711 | int status; |
708 | 712 | ||
709 | atomic_inc(&data->count); | 713 | atomic_inc(&data->count); |
714 | /* | ||
715 | * If rpc_run_task() ends up calling ->rpc_release(), we | ||
716 | * want to ensure that it takes the 'error' code path. | ||
717 | */ | ||
718 | data->rpc_status = -ENOMEM; | ||
710 | task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_ops, data); | 719 | task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_ops, data); |
711 | if (IS_ERR(task)) { | 720 | if (IS_ERR(task)) |
712 | nfs4_opendata_free(data); | ||
713 | return PTR_ERR(task); | 721 | return PTR_ERR(task); |
714 | } | ||
715 | status = nfs4_wait_for_completion_rpc_task(task); | 722 | status = nfs4_wait_for_completion_rpc_task(task); |
716 | if (status != 0) { | 723 | if (status != 0) { |
717 | data->cancelled = 1; | 724 | data->cancelled = 1; |
@@ -908,7 +915,7 @@ out_put_state_owner: | |||
908 | static struct nfs4_state *nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred) | 915 | static struct nfs4_state *nfs4_open_delegated(struct inode *inode, int flags, struct rpc_cred *cred) |
909 | { | 916 | { |
910 | struct nfs4_exception exception = { }; | 917 | struct nfs4_exception exception = { }; |
911 | struct nfs4_state *res; | 918 | struct nfs4_state *res = ERR_PTR(-EIO); |
912 | int err; | 919 | int err; |
913 | 920 | ||
914 | do { | 921 | do { |
@@ -1017,12 +1024,12 @@ static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, | |||
1017 | return res; | 1024 | return res; |
1018 | } | 1025 | } |
1019 | 1026 | ||
1020 | static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, | 1027 | static int _nfs4_do_setattr(struct inode *inode, struct nfs_fattr *fattr, |
1021 | struct nfs_fh *fhandle, struct iattr *sattr, | 1028 | struct iattr *sattr, struct nfs4_state *state) |
1022 | struct nfs4_state *state) | ||
1023 | { | 1029 | { |
1030 | struct nfs_server *server = NFS_SERVER(inode); | ||
1024 | struct nfs_setattrargs arg = { | 1031 | struct nfs_setattrargs arg = { |
1025 | .fh = fhandle, | 1032 | .fh = NFS_FH(inode), |
1026 | .iap = sattr, | 1033 | .iap = sattr, |
1027 | .server = server, | 1034 | .server = server, |
1028 | .bitmask = server->attr_bitmask, | 1035 | .bitmask = server->attr_bitmask, |
@@ -1041,7 +1048,9 @@ static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, | |||
1041 | 1048 | ||
1042 | nfs_fattr_init(fattr); | 1049 | nfs_fattr_init(fattr); |
1043 | 1050 | ||
1044 | if (state != NULL) { | 1051 | if (nfs4_copy_delegation_stateid(&arg.stateid, inode)) { |
1052 | /* Use that stateid */ | ||
1053 | } else if (state != NULL) { | ||
1045 | msg.rpc_cred = state->owner->so_cred; | 1054 | msg.rpc_cred = state->owner->so_cred; |
1046 | nfs4_copy_stateid(&arg.stateid, state, current->files); | 1055 | nfs4_copy_stateid(&arg.stateid, state, current->files); |
1047 | } else | 1056 | } else |
@@ -1053,16 +1062,15 @@ static int _nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, | |||
1053 | return status; | 1062 | return status; |
1054 | } | 1063 | } |
1055 | 1064 | ||
1056 | static int nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, | 1065 | static int nfs4_do_setattr(struct inode *inode, struct nfs_fattr *fattr, |
1057 | struct nfs_fh *fhandle, struct iattr *sattr, | 1066 | struct iattr *sattr, struct nfs4_state *state) |
1058 | struct nfs4_state *state) | ||
1059 | { | 1067 | { |
1068 | struct nfs_server *server = NFS_SERVER(inode); | ||
1060 | struct nfs4_exception exception = { }; | 1069 | struct nfs4_exception exception = { }; |
1061 | int err; | 1070 | int err; |
1062 | do { | 1071 | do { |
1063 | err = nfs4_handle_exception(server, | 1072 | err = nfs4_handle_exception(server, |
1064 | _nfs4_do_setattr(server, fattr, fhandle, sattr, | 1073 | _nfs4_do_setattr(inode, fattr, sattr, state), |
1065 | state), | ||
1066 | &exception); | 1074 | &exception); |
1067 | } while (exception.retry); | 1075 | } while (exception.retry); |
1068 | return err; | 1076 | return err; |
@@ -1503,8 +1511,7 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, | |||
1503 | if (ctx != NULL) | 1511 | if (ctx != NULL) |
1504 | state = ctx->state; | 1512 | state = ctx->state; |
1505 | 1513 | ||
1506 | status = nfs4_do_setattr(NFS_SERVER(inode), fattr, | 1514 | status = nfs4_do_setattr(inode, fattr, sattr, state); |
1507 | NFS_FH(inode), sattr, state); | ||
1508 | if (status == 0) | 1515 | if (status == 0) |
1509 | nfs_setattr_update_inode(inode, sattr); | 1516 | nfs_setattr_update_inode(inode, sattr); |
1510 | if (ctx != NULL) | 1517 | if (ctx != NULL) |
@@ -1823,8 +1830,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr, | |||
1823 | d_instantiate(dentry, igrab(state->inode)); | 1830 | d_instantiate(dentry, igrab(state->inode)); |
1824 | if (flags & O_EXCL) { | 1831 | if (flags & O_EXCL) { |
1825 | struct nfs_fattr fattr; | 1832 | struct nfs_fattr fattr; |
1826 | status = nfs4_do_setattr(NFS_SERVER(dir), &fattr, | 1833 | status = nfs4_do_setattr(state->inode, &fattr, sattr, state); |
1827 | NFS_FH(state->inode), sattr, state); | ||
1828 | if (status == 0) | 1834 | if (status == 0) |
1829 | nfs_setattr_update_inode(state->inode, sattr); | 1835 | nfs_setattr_update_inode(state->inode, sattr); |
1830 | } | 1836 | } |
@@ -2344,75 +2350,50 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle, | |||
2344 | return err; | 2350 | return err; |
2345 | } | 2351 | } |
2346 | 2352 | ||
2347 | static void nfs4_read_done(struct rpc_task *task, void *calldata) | 2353 | static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) |
2348 | { | 2354 | { |
2349 | struct nfs_read_data *data = calldata; | 2355 | struct nfs_server *server = NFS_SERVER(data->inode); |
2350 | struct inode *inode = data->inode; | ||
2351 | 2356 | ||
2352 | if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { | 2357 | if (nfs4_async_handle_error(task, server) == -EAGAIN) { |
2353 | rpc_restart_call(task); | 2358 | rpc_restart_call(task); |
2354 | return; | 2359 | return -EAGAIN; |
2355 | } | 2360 | } |
2356 | if (task->tk_status > 0) | 2361 | if (task->tk_status > 0) |
2357 | renew_lease(NFS_SERVER(inode), data->timestamp); | 2362 | renew_lease(server, data->timestamp); |
2358 | /* Call back common NFS readpage processing */ | 2363 | return 0; |
2359 | nfs_readpage_result(task, calldata); | ||
2360 | } | 2364 | } |
2361 | 2365 | ||
2362 | static const struct rpc_call_ops nfs4_read_ops = { | 2366 | static void nfs4_proc_read_setup(struct nfs_read_data *data) |
2363 | .rpc_call_done = nfs4_read_done, | ||
2364 | .rpc_release = nfs_readdata_release, | ||
2365 | }; | ||
2366 | |||
2367 | static void | ||
2368 | nfs4_proc_read_setup(struct nfs_read_data *data) | ||
2369 | { | 2367 | { |
2370 | struct rpc_task *task = &data->task; | ||
2371 | struct rpc_message msg = { | 2368 | struct rpc_message msg = { |
2372 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ], | 2369 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ], |
2373 | .rpc_argp = &data->args, | 2370 | .rpc_argp = &data->args, |
2374 | .rpc_resp = &data->res, | 2371 | .rpc_resp = &data->res, |
2375 | .rpc_cred = data->cred, | 2372 | .rpc_cred = data->cred, |
2376 | }; | 2373 | }; |
2377 | struct inode *inode = data->inode; | ||
2378 | int flags; | ||
2379 | 2374 | ||
2380 | data->timestamp = jiffies; | 2375 | data->timestamp = jiffies; |
2381 | 2376 | ||
2382 | /* N.B. Do we need to test? Never called for swapfile inode */ | 2377 | rpc_call_setup(&data->task, &msg, 0); |
2383 | flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); | ||
2384 | |||
2385 | /* Finalize the task. */ | ||
2386 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs4_read_ops, data); | ||
2387 | rpc_call_setup(task, &msg, 0); | ||
2388 | } | 2378 | } |
2389 | 2379 | ||
2390 | static void nfs4_write_done(struct rpc_task *task, void *calldata) | 2380 | static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) |
2391 | { | 2381 | { |
2392 | struct nfs_write_data *data = calldata; | ||
2393 | struct inode *inode = data->inode; | 2382 | struct inode *inode = data->inode; |
2394 | 2383 | ||
2395 | if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { | 2384 | if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { |
2396 | rpc_restart_call(task); | 2385 | rpc_restart_call(task); |
2397 | return; | 2386 | return -EAGAIN; |
2398 | } | 2387 | } |
2399 | if (task->tk_status >= 0) { | 2388 | if (task->tk_status >= 0) { |
2400 | renew_lease(NFS_SERVER(inode), data->timestamp); | 2389 | renew_lease(NFS_SERVER(inode), data->timestamp); |
2401 | nfs_post_op_update_inode(inode, data->res.fattr); | 2390 | nfs_post_op_update_inode(inode, data->res.fattr); |
2402 | } | 2391 | } |
2403 | /* Call back common NFS writeback processing */ | 2392 | return 0; |
2404 | nfs_writeback_done(task, calldata); | ||
2405 | } | 2393 | } |
2406 | 2394 | ||
2407 | static const struct rpc_call_ops nfs4_write_ops = { | 2395 | static void nfs4_proc_write_setup(struct nfs_write_data *data, int how) |
2408 | .rpc_call_done = nfs4_write_done, | ||
2409 | .rpc_release = nfs_writedata_release, | ||
2410 | }; | ||
2411 | |||
2412 | static void | ||
2413 | nfs4_proc_write_setup(struct nfs_write_data *data, int how) | ||
2414 | { | 2396 | { |
2415 | struct rpc_task *task = &data->task; | ||
2416 | struct rpc_message msg = { | 2397 | struct rpc_message msg = { |
2417 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE], | 2398 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE], |
2418 | .rpc_argp = &data->args, | 2399 | .rpc_argp = &data->args, |
@@ -2422,7 +2403,6 @@ nfs4_proc_write_setup(struct nfs_write_data *data, int how) | |||
2422 | struct inode *inode = data->inode; | 2403 | struct inode *inode = data->inode; |
2423 | struct nfs_server *server = NFS_SERVER(inode); | 2404 | struct nfs_server *server = NFS_SERVER(inode); |
2424 | int stable; | 2405 | int stable; |
2425 | int flags; | ||
2426 | 2406 | ||
2427 | if (how & FLUSH_STABLE) { | 2407 | if (how & FLUSH_STABLE) { |
2428 | if (!NFS_I(inode)->ncommit) | 2408 | if (!NFS_I(inode)->ncommit) |
@@ -2437,57 +2417,37 @@ nfs4_proc_write_setup(struct nfs_write_data *data, int how) | |||
2437 | 2417 | ||
2438 | data->timestamp = jiffies; | 2418 | data->timestamp = jiffies; |
2439 | 2419 | ||
2440 | /* Set the initial flags for the task. */ | ||
2441 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | ||
2442 | |||
2443 | /* Finalize the task. */ | 2420 | /* Finalize the task. */ |
2444 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs4_write_ops, data); | 2421 | rpc_call_setup(&data->task, &msg, 0); |
2445 | rpc_call_setup(task, &msg, 0); | ||
2446 | } | 2422 | } |
2447 | 2423 | ||
2448 | static void nfs4_commit_done(struct rpc_task *task, void *calldata) | 2424 | static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data) |
2449 | { | 2425 | { |
2450 | struct nfs_write_data *data = calldata; | ||
2451 | struct inode *inode = data->inode; | 2426 | struct inode *inode = data->inode; |
2452 | 2427 | ||
2453 | if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { | 2428 | if (nfs4_async_handle_error(task, NFS_SERVER(inode)) == -EAGAIN) { |
2454 | rpc_restart_call(task); | 2429 | rpc_restart_call(task); |
2455 | return; | 2430 | return -EAGAIN; |
2456 | } | 2431 | } |
2457 | if (task->tk_status >= 0) | 2432 | if (task->tk_status >= 0) |
2458 | nfs_post_op_update_inode(inode, data->res.fattr); | 2433 | nfs_post_op_update_inode(inode, data->res.fattr); |
2459 | /* Call back common NFS writeback processing */ | 2434 | return 0; |
2460 | nfs_commit_done(task, calldata); | ||
2461 | } | 2435 | } |
2462 | 2436 | ||
2463 | static const struct rpc_call_ops nfs4_commit_ops = { | 2437 | static void nfs4_proc_commit_setup(struct nfs_write_data *data, int how) |
2464 | .rpc_call_done = nfs4_commit_done, | ||
2465 | .rpc_release = nfs_commit_release, | ||
2466 | }; | ||
2467 | |||
2468 | static void | ||
2469 | nfs4_proc_commit_setup(struct nfs_write_data *data, int how) | ||
2470 | { | 2438 | { |
2471 | struct rpc_task *task = &data->task; | ||
2472 | struct rpc_message msg = { | 2439 | struct rpc_message msg = { |
2473 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT], | 2440 | .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT], |
2474 | .rpc_argp = &data->args, | 2441 | .rpc_argp = &data->args, |
2475 | .rpc_resp = &data->res, | 2442 | .rpc_resp = &data->res, |
2476 | .rpc_cred = data->cred, | 2443 | .rpc_cred = data->cred, |
2477 | }; | 2444 | }; |
2478 | struct inode *inode = data->inode; | 2445 | struct nfs_server *server = NFS_SERVER(data->inode); |
2479 | struct nfs_server *server = NFS_SERVER(inode); | ||
2480 | int flags; | ||
2481 | 2446 | ||
2482 | data->args.bitmask = server->attr_bitmask; | 2447 | data->args.bitmask = server->attr_bitmask; |
2483 | data->res.server = server; | 2448 | data->res.server = server; |
2484 | 2449 | ||
2485 | /* Set the initial flags for the task. */ | 2450 | rpc_call_setup(&data->task, &msg, 0); |
2486 | flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; | ||
2487 | |||
2488 | /* Finalize the task. */ | ||
2489 | rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs4_commit_ops, data); | ||
2490 | rpc_call_setup(task, &msg, 0); | ||
2491 | } | 2451 | } |
2492 | 2452 | ||
2493 | /* | 2453 | /* |
@@ -2755,8 +2715,10 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server) | |||
2755 | rpc_wake_up_task(task); | 2715 | rpc_wake_up_task(task); |
2756 | task->tk_status = 0; | 2716 | task->tk_status = 0; |
2757 | return -EAGAIN; | 2717 | return -EAGAIN; |
2758 | case -NFS4ERR_GRACE: | ||
2759 | case -NFS4ERR_DELAY: | 2718 | case -NFS4ERR_DELAY: |
2719 | nfs_inc_server_stats((struct nfs_server *) server, | ||
2720 | NFSIOS_DELAY); | ||
2721 | case -NFS4ERR_GRACE: | ||
2760 | rpc_delay(task, NFS4_POLL_RETRY_MAX); | 2722 | rpc_delay(task, NFS4_POLL_RETRY_MAX); |
2761 | task->tk_status = 0; | 2723 | task->tk_status = 0; |
2762 | return -EAGAIN; | 2724 | return -EAGAIN; |
@@ -2893,8 +2855,7 @@ int nfs4_proc_setclientid(struct nfs4_client *clp, u32 program, unsigned short p | |||
2893 | return status; | 2855 | return status; |
2894 | } | 2856 | } |
2895 | 2857 | ||
2896 | int | 2858 | static int _nfs4_proc_setclientid_confirm(struct nfs4_client *clp, struct rpc_cred *cred) |
2897 | nfs4_proc_setclientid_confirm(struct nfs4_client *clp, struct rpc_cred *cred) | ||
2898 | { | 2859 | { |
2899 | struct nfs_fsinfo fsinfo; | 2860 | struct nfs_fsinfo fsinfo; |
2900 | struct rpc_message msg = { | 2861 | struct rpc_message msg = { |
@@ -2918,6 +2879,24 @@ nfs4_proc_setclientid_confirm(struct nfs4_client *clp, struct rpc_cred *cred) | |||
2918 | return status; | 2879 | return status; |
2919 | } | 2880 | } |
2920 | 2881 | ||
2882 | int nfs4_proc_setclientid_confirm(struct nfs4_client *clp, struct rpc_cred *cred) | ||
2883 | { | ||
2884 | long timeout; | ||
2885 | int err; | ||
2886 | do { | ||
2887 | err = _nfs4_proc_setclientid_confirm(clp, cred); | ||
2888 | switch (err) { | ||
2889 | case 0: | ||
2890 | return err; | ||
2891 | case -NFS4ERR_RESOURCE: | ||
2892 | /* The IBM lawyers misread another document! */ | ||
2893 | case -NFS4ERR_DELAY: | ||
2894 | err = nfs4_delay(clp->cl_rpcclient, &timeout); | ||
2895 | } | ||
2896 | } while (err == 0); | ||
2897 | return err; | ||
2898 | } | ||
2899 | |||
2921 | struct nfs4_delegreturndata { | 2900 | struct nfs4_delegreturndata { |
2922 | struct nfs4_delegreturnargs args; | 2901 | struct nfs4_delegreturnargs args; |
2923 | struct nfs4_delegreturnres res; | 2902 | struct nfs4_delegreturnres res; |
@@ -2958,7 +2937,7 @@ static void nfs4_delegreturn_release(void *calldata) | |||
2958 | kfree(calldata); | 2937 | kfree(calldata); |
2959 | } | 2938 | } |
2960 | 2939 | ||
2961 | const static struct rpc_call_ops nfs4_delegreturn_ops = { | 2940 | static const struct rpc_call_ops nfs4_delegreturn_ops = { |
2962 | .rpc_call_prepare = nfs4_delegreturn_prepare, | 2941 | .rpc_call_prepare = nfs4_delegreturn_prepare, |
2963 | .rpc_call_done = nfs4_delegreturn_done, | 2942 | .rpc_call_done = nfs4_delegreturn_done, |
2964 | .rpc_release = nfs4_delegreturn_release, | 2943 | .rpc_release = nfs4_delegreturn_release, |
@@ -2986,10 +2965,8 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co | |||
2986 | data->rpc_status = 0; | 2965 | data->rpc_status = 0; |
2987 | 2966 | ||
2988 | task = rpc_run_task(NFS_CLIENT(inode), RPC_TASK_ASYNC, &nfs4_delegreturn_ops, data); | 2967 | task = rpc_run_task(NFS_CLIENT(inode), RPC_TASK_ASYNC, &nfs4_delegreturn_ops, data); |
2989 | if (IS_ERR(task)) { | 2968 | if (IS_ERR(task)) |
2990 | nfs4_delegreturn_release(data); | ||
2991 | return PTR_ERR(task); | 2969 | return PTR_ERR(task); |
2992 | } | ||
2993 | status = nfs4_wait_for_completion_rpc_task(task); | 2970 | status = nfs4_wait_for_completion_rpc_task(task); |
2994 | if (status == 0) { | 2971 | if (status == 0) { |
2995 | status = data->rpc_status; | 2972 | status = data->rpc_status; |
@@ -3209,7 +3186,6 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, | |||
3209 | struct nfs_seqid *seqid) | 3186 | struct nfs_seqid *seqid) |
3210 | { | 3187 | { |
3211 | struct nfs4_unlockdata *data; | 3188 | struct nfs4_unlockdata *data; |
3212 | struct rpc_task *task; | ||
3213 | 3189 | ||
3214 | data = nfs4_alloc_unlockdata(fl, ctx, lsp, seqid); | 3190 | data = nfs4_alloc_unlockdata(fl, ctx, lsp, seqid); |
3215 | if (data == NULL) { | 3191 | if (data == NULL) { |
@@ -3219,10 +3195,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl, | |||
3219 | 3195 | ||
3220 | /* Unlock _before_ we do the RPC call */ | 3196 | /* Unlock _before_ we do the RPC call */ |
3221 | do_vfs_lock(fl->fl_file, fl); | 3197 | do_vfs_lock(fl->fl_file, fl); |
3222 | task = rpc_run_task(NFS_CLIENT(lsp->ls_state->inode), RPC_TASK_ASYNC, &nfs4_locku_ops, data); | 3198 | return rpc_run_task(NFS_CLIENT(lsp->ls_state->inode), RPC_TASK_ASYNC, &nfs4_locku_ops, data); |
3223 | if (IS_ERR(task)) | ||
3224 | nfs4_locku_release_calldata(data); | ||
3225 | return task; | ||
3226 | } | 3199 | } |
3227 | 3200 | ||
3228 | static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request) | 3201 | static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request) |
@@ -3403,10 +3376,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f | |||
3403 | data->arg.reclaim = 1; | 3376 | data->arg.reclaim = 1; |
3404 | task = rpc_run_task(NFS_CLIENT(state->inode), RPC_TASK_ASYNC, | 3377 | task = rpc_run_task(NFS_CLIENT(state->inode), RPC_TASK_ASYNC, |
3405 | &nfs4_lock_ops, data); | 3378 | &nfs4_lock_ops, data); |
3406 | if (IS_ERR(task)) { | 3379 | if (IS_ERR(task)) |
3407 | nfs4_lock_release(data); | ||
3408 | return PTR_ERR(task); | 3380 | return PTR_ERR(task); |
3409 | } | ||
3410 | ret = nfs4_wait_for_completion_rpc_task(task); | 3381 | ret = nfs4_wait_for_completion_rpc_task(task); |
3411 | if (ret == 0) { | 3382 | if (ret == 0) { |
3412 | ret = data->rpc_status; | 3383 | ret = data->rpc_status; |
@@ -3588,6 +3559,8 @@ ssize_t nfs4_listxattr(struct dentry *dentry, char *buf, size_t buflen) | |||
3588 | { | 3559 | { |
3589 | size_t len = strlen(XATTR_NAME_NFSV4_ACL) + 1; | 3560 | size_t len = strlen(XATTR_NAME_NFSV4_ACL) + 1; |
3590 | 3561 | ||
3562 | if (!nfs4_server_supports_acls(NFS_SERVER(dentry->d_inode))) | ||
3563 | return 0; | ||
3591 | if (buf && buflen < len) | 3564 | if (buf && buflen < len) |
3592 | return -ERANGE; | 3565 | return -ERANGE; |
3593 | if (buf) | 3566 | if (buf) |
@@ -3644,8 +3617,11 @@ struct nfs_rpc_ops nfs_v4_clientops = { | |||
3644 | .pathconf = nfs4_proc_pathconf, | 3617 | .pathconf = nfs4_proc_pathconf, |
3645 | .decode_dirent = nfs4_decode_dirent, | 3618 | .decode_dirent = nfs4_decode_dirent, |
3646 | .read_setup = nfs4_proc_read_setup, | 3619 | .read_setup = nfs4_proc_read_setup, |
3620 | .read_done = nfs4_read_done, | ||
3647 | .write_setup = nfs4_proc_write_setup, | 3621 | .write_setup = nfs4_proc_write_setup, |
3622 | .write_done = nfs4_write_done, | ||
3648 | .commit_setup = nfs4_proc_commit_setup, | 3623 | .commit_setup = nfs4_proc_commit_setup, |
3624 | .commit_done = nfs4_commit_done, | ||
3649 | .file_open = nfs_open, | 3625 | .file_open = nfs_open, |
3650 | .file_release = nfs_release, | 3626 | .file_release = nfs_release, |
3651 | .lock = nfs4_proc_lock, | 3627 | .lock = nfs4_proc_lock, |