Merge with http://kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[powerpc.git] / fs / nfs / nfs4proc.c
index 21482b2..f988a94 100644 (file)
@@ -1506,10 +1506,15 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata)
        dprintk("NFS call  write %d @ %Ld\n", wdata->args.count,
                        (long long) wdata->args.offset);
 
+       wdata->args.bitmask = server->attr_bitmask;
+       wdata->res.server = server;
        nfs_fattr_init(fattr);
        status = rpc_call_sync(server->client, &msg, rpcflags);
        dprintk("NFS reply write: %d\n", status);
-       return status;
+       if (status < 0)
+               return status;
+       nfs_post_op_update_inode(inode, fattr);
+       return wdata->res.count;
 }
 
 static int nfs4_proc_write(struct nfs_write_data *wdata)
@@ -1540,9 +1545,13 @@ static int _nfs4_proc_commit(struct nfs_write_data *cdata)
        dprintk("NFS call  commit %d @ %Ld\n", cdata->args.count,
                        (long long) cdata->args.offset);
 
+       cdata->args.bitmask = server->attr_bitmask;
+       cdata->res.server = server;
        nfs_fattr_init(fattr);
        status = rpc_call_sync(server->client, &msg, 0);
        dprintk("NFS reply commit: %d\n", status);
+       if (status >= 0)
+               nfs_post_op_update_inode(inode, fattr);
        return status;
 }
 
@@ -3071,15 +3080,15 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock
        struct nfs4_client *clp = state->owner->so_client;
        int status;
 
-       down_read(&clp->cl_sem);
        /* Is this a delegated open? */
-       if (test_bit(NFS_DELEGATED_STATE, &state->flags)) {
+       if (NFS_I(state->inode)->delegation_state != 0) {
                /* Yes: cache locks! */
                status = do_vfs_lock(request->fl_file, request);
                /* ...but avoid races with delegation recall... */
                if (status < 0 || test_bit(NFS_DELEGATED_STATE, &state->flags))
-                       goto out;
+                       return status;
        }
+       down_read(&clp->cl_sem);
        status = nfs4_set_lock_state(state, request);
        if (status != 0)
                goto out;