Skip to content

Commit 2f3c7d8

Browse files
committed
NFS: Remove racy size manipulations in O_DIRECT
On success, the RPC callbacks will ensure that we make the appropriate calls to nfs_writeback_update_inode() Signed-off-by: Trond Myklebust <[email protected]>
1 parent a5314a7 commit 2f3c7d8

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

fs/nfs/direct.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -376,15 +376,6 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
376376
{
377377
struct inode *inode = dreq->inode;
378378

379-
if (dreq->iocb && write) {
380-
loff_t pos = dreq->iocb->ki_pos + dreq->count;
381-
382-
spin_lock(&inode->i_lock);
383-
if (i_size_read(inode) < pos)
384-
i_size_write(inode, pos);
385-
spin_unlock(&inode->i_lock);
386-
}
387-
388379
if (write)
389380
nfs_zap_mapping(inode, inode->i_mapping);
390381

@@ -1058,14 +1049,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter)
10581049
if (!result) {
10591050
result = nfs_direct_wait(dreq);
10601051
if (result > 0) {
1061-
struct inode *inode = mapping->host;
1062-
10631052
iocb->ki_pos = pos + result;
1064-
spin_lock(&inode->i_lock);
1065-
if (i_size_read(inode) < iocb->ki_pos)
1066-
i_size_write(inode, iocb->ki_pos);
1067-
spin_unlock(&inode->i_lock);
1068-
10691053
/* XXX: should check the generic_write_sync retval */
10701054
generic_write_sync(iocb, result);
10711055
}

0 commit comments

Comments
 (0)