Skip to content

Commit 3b6efee

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
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: Trond Myklebust <[email protected]>
1 parent 5ba7cc4 commit 3b6efee

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

fs/nfs/nfs4proc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,10 +1506,15 @@ static int _nfs4_proc_write(struct nfs_write_data *wdata)
15061506
dprintk("NFS call write %d @ %Ld\n", wdata->args.count,
15071507
(long long) wdata->args.offset);
15081508

1509+
wdata->args.bitmask = server->attr_bitmask;
1510+
wdata->res.server = server;
15091511
nfs_fattr_init(fattr);
15101512
status = rpc_call_sync(server->client, &msg, rpcflags);
15111513
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;
15131518
}
15141519

15151520
static int nfs4_proc_write(struct nfs_write_data *wdata)
@@ -1540,9 +1545,13 @@ static int _nfs4_proc_commit(struct nfs_write_data *cdata)
15401545
dprintk("NFS call commit %d @ %Ld\n", cdata->args.count,
15411546
(long long) cdata->args.offset);
15421547

1548+
cdata->args.bitmask = server->attr_bitmask;
1549+
cdata->res.server = server;
15431550
nfs_fattr_init(fattr);
15441551
status = rpc_call_sync(server->client, &msg, 0);
15451552
dprintk("NFS reply commit: %d\n", status);
1553+
if (status >= 0)
1554+
nfs_post_op_update_inode(inode, fattr);
15461555
return status;
15471556
}
15481557

0 commit comments

Comments
 (0)