Skip to content

Commit

Permalink
NFS: Remove racy size manipulations in O_DIRECT
Browse files Browse the repository at this point in the history
On success, the RPC callbacks will ensure that we make the appropriate calls
to nfs_writeback_update_inode()

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Trond Myklebust committed Jul 5, 2016
1 parent a5314a7 commit 2f3c7d8
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions fs/nfs/direct.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,6 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq, bool write)
{
struct inode *inode = dreq->inode;

if (dreq->iocb && write) {
loff_t pos = dreq->iocb->ki_pos + dreq->count;

spin_lock(&inode->i_lock);
if (i_size_read(inode) < pos)
i_size_write(inode, pos);
spin_unlock(&inode->i_lock);
}

if (write)
nfs_zap_mapping(inode, inode->i_mapping);

Expand Down Expand Up @@ -1058,14 +1049,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter)
if (!result) {
result = nfs_direct_wait(dreq);
if (result > 0) {
struct inode *inode = mapping->host;

iocb->ki_pos = pos + result;
spin_lock(&inode->i_lock);
if (i_size_read(inode) < iocb->ki_pos)
i_size_write(inode, iocb->ki_pos);
spin_unlock(&inode->i_lock);

/* XXX: should check the generic_write_sync retval */
generic_write_sync(iocb, result);
}
Expand Down

0 comments on commit 2f3c7d8

Please sign in to comment.