diff options
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 21482b2518f6..f988a9417b13 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1506,10 +1506,15 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata) | |||
1506 | dprintk("NFS call write %d @ %Ld\n", wdata->args.count, | 1506 | dprintk("NFS call write %d @ %Ld\n", wdata->args.count, |
1507 | (long long) wdata->args.offset); | 1507 | (long long) wdata->args.offset); |
1508 | 1508 | ||
1509 | wdata->args.bitmask = server->attr_bitmask; | ||
1510 | wdata->res.server = server; | ||
1509 | nfs_fattr_init(fattr); | 1511 | nfs_fattr_init(fattr); |
1510 | status = rpc_call_sync(server->client, &msg, rpcflags); | 1512 | status = rpc_call_sync(server->client, &msg, rpcflags); |
1511 | dprintk("NFS reply write: %d\n", status); | 1513 | dprintk("NFS reply write: %d\n", status); |
1512 | return status; | 1514 | if (status < 0) |
1515 | return status; | ||
1516 | nfs_post_op_update_inode(inode, fattr); | ||
1517 | return wdata->res.count; | ||
1513 | } | 1518 | } |
1514 | 1519 | ||
1515 | static int nfs4_proc_write(struct nfs_write_data *wdata) | 1520 | static int nfs4_proc_write(struct nfs_write_data *wdata) |
@@ -1540,9 +1545,13 @@ static int _nfs4_proc_commit(struct nfs_write_data *cdata) | |||
1540 | dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, | 1545 | dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, |
1541 | (long long) cdata->args.offset); | 1546 | (long long) cdata->args.offset); |
1542 | 1547 | ||
1548 | cdata->args.bitmask = server->attr_bitmask; | ||
1549 | cdata->res.server = server; | ||
1543 | nfs_fattr_init(fattr); | 1550 | nfs_fattr_init(fattr); |
1544 | status = rpc_call_sync(server->client, &msg, 0); | 1551 | status = rpc_call_sync(server->client, &msg, 0); |
1545 | dprintk("NFS reply commit: %d\n", status); | 1552 | dprintk("NFS reply commit: %d\n", status); |
1553 | if (status >= 0) | ||
1554 | nfs_post_op_update_inode(inode, fattr); | ||
1546 | return status; | 1555 | return status; |
1547 | } | 1556 | } |
1548 | 1557 | ||
@@ -3071,15 +3080,15 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
3071 | struct nfs4_client *clp = state->owner->so_client; | 3080 | struct nfs4_client *clp = state->owner->so_client; |
3072 | int status; | 3081 | int status; |
3073 | 3082 | ||
3074 | down_read(&clp->cl_sem); | ||
3075 | /* Is this a delegated open? */ | 3083 | /* Is this a delegated open? */ |
3076 | if (test_bit(NFS_DELEGATED_STATE, &state->flags)) { | 3084 | if (NFS_I(state->inode)->delegation_state != 0) { |
3077 | /* Yes: cache locks! */ | 3085 | /* Yes: cache locks! */ |
3078 | status = do_vfs_lock(request->fl_file, request); | 3086 | status = do_vfs_lock(request->fl_file, request); |
3079 | /* ...but avoid races with delegation recall... */ | 3087 | /* ...but avoid races with delegation recall... */ |
3080 | if (status < 0 || test_bit(NFS_DELEGATED_STATE, &state->flags)) | 3088 | if (status < 0 || test_bit(NFS_DELEGATED_STATE, &state->flags)) |
3081 | goto out; | 3089 | return status; |
3082 | } | 3090 | } |
3091 | down_read(&clp->cl_sem); | ||
3083 | status = nfs4_set_lock_state(state, request); | 3092 | status = nfs4_set_lock_state(state, request); |
3084 | if (status != 0) | 3093 | if (status != 0) |
3085 | goto out; | 3094 | goto out; |