Commit 3b6efee9 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Fix an Oops in the synchronous write path

 - Missing initialisation of attribute bitmask in _nfs4_proc_write()
 - On success, _nfs4_proc_write() must return number of bytes written.
 - Missing post_op_update_inode() in _nfs4_proc_write()
 - Missing initialisation of attribute bitmask in _nfs4_proc_commit()
 - Missing post_op_update_inode() in _nfs4_proc_commit()
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 5ba7cc48
...@@ -1506,10 +1506,15 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata) ...@@ -1506,10 +1506,15 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata)
dprintk("NFS call write %d @ %Ld\n", wdata->args.count, dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
(long long) wdata->args.offset); (long long) wdata->args.offset);
wdata->args.bitmask = server->attr_bitmask;
wdata->res.server = server;
nfs_fattr_init(fattr); nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, rpcflags); status = rpc_call_sync(server->client, &msg, rpcflags);
dprintk("NFS reply write: %d\n", status); dprintk("NFS reply write: %d\n", status);
if (status < 0)
return status; return status;
nfs_post_op_update_inode(inode, fattr);
return wdata->res.count;
} }
static int nfs4_proc_write(struct nfs_write_data *wdata) 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,9 +1545,13 @@ static int _nfs4_proc_commit(struct nfs_write_data *cdata)
dprintk("NFS call commit %d @ %Ld\n", cdata->args.count, dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
(long long) cdata->args.offset); (long long) cdata->args.offset);
cdata->args.bitmask = server->attr_bitmask;
cdata->res.server = server;
nfs_fattr_init(fattr); nfs_fattr_init(fattr);
status = rpc_call_sync(server->client, &msg, 0); status = rpc_call_sync(server->client, &msg, 0);
dprintk("NFS reply commit: %d\n", status); dprintk("NFS reply commit: %d\n", status);
if (status >= 0)
nfs_post_op_update_inode(inode, fattr);
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment