s3: VFS: ceph: Replace the lseek/write ftruncate extend with pwrite.
authorJeremy Allison <jra@samba.org>
Wed, 2 May 2018 23:47:22 +0000 (16:47 -0700)
committerRalph Boehme <slow@samba.org>
Fri, 4 May 2018 20:34:25 +0000 (22:34 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_ceph.c

index 2f50aa67c57aa0ef42dc9644852c014ade988fc6..cfb887d4e3cb31ac7c127fa47a4a12b2436ffa4d 100644 (file)
@@ -1113,15 +1113,10 @@ static int cephwrap_ftruncate(struct vfs_handle_struct *handle, files_struct *fs
                goto done;
        }
 
-       if (SMB_VFS_LSEEK(fsp, len-1, SEEK_SET) != len -1)
-               goto done;
-
-       if (SMB_VFS_WRITE(fsp, &c, 1)!=1)
+       if (SMB_VFS_PWRITE(fsp, &c, 1, len-1)!=1) {
                goto done;
+       }
 
-       /* Seek to where we were */
-       if (SMB_VFS_LSEEK(fsp, currpos, SEEK_SET) != currpos)
-               goto done;
        result = 0;
 
   done: