NFS: Remove racy size manipulations in O_DIRECT
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 22 Jun 2016 18:38:06 +0000 (14:38 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 5 Jul 2016 23:11:02 +0000 (19:11 -0400)
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>
fs/nfs/direct.c

index fb659bb506780d7eb3a554c484d7d4ec43e2dd40..826d4dace0e50cf684c266f30903d53d14ab4bce 100644 (file)
@@ -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);
 
@@ -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);
                }