Orangefs: set pos after generic_write_checks
authorMike Marshall <hubcap@omnibond.com>
Fri, 13 Nov 2015 18:05:11 +0000 (13:05 -0500)
committerMike Marshall <hubcap@omnibond.com>
Fri, 13 Nov 2015 18:05:11 +0000 (13:05 -0500)
if we are appending, generic_write_checks would have updated
pos to the end of the file...

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/file.c

index 78d296bb870e732b26c8cff69a2da8ec843d4709..78a46968a9946b61cb752a3a8859fb9ee1587c23 100644 (file)
@@ -430,7 +430,7 @@ static ssize_t pvfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
 static ssize_t pvfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
 {
        struct file *file = iocb->ki_filp;
-       loff_t pos = *(&iocb->ki_pos);
+       loff_t pos;
        ssize_t rc;
 
        BUG_ON(iocb->private);
@@ -461,6 +461,13 @@ static ssize_t pvfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
                goto out;
        }
 
+       /*
+        * if we are appending, generic_write_checks would have updated
+        * pos to the end of the file, so we will wait till now to set
+        * pos...
+        */
+       pos = *(&iocb->ki_pos);
+
        rc = do_readv_writev(PVFS_IO_WRITE,
                             file,
                             &pos,