[Devel] [PATCH RHEL7 COMMIT] ms/tmpfs: fix SEEK_DATA/SEEK_HOLE regression

Konstantin Khorenko khorenko at virtuozzo.com
Wed Nov 9 05:54:46 PST 2016


The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.19.6
------>
commit 57c05b17081e03cdad7b8199273b80d34fc55c1d
Author: Hugh Dickins <hughd at google.com>
Date:   Wed Nov 9 17:54:46 2016 +0400

    ms/tmpfs: fix SEEK_DATA/SEEK_HOLE regression
    
    Fixes a problem in shmem criu test and friends on VZ7 after criu
    commit 51554fa59eed ("shmem: use lseek(SEEK_DATA) instead of mincore"):
    
    https://ci.openvz.org/job/CRIU/job/CRIU-virtuozzo/branch/criu-dev/861/
    ============ Run zdtm/transition/shmem in h ===============
    Start test
    ./shmem --pidfile=shmem.pid --outfile=shmem.out
    Run criu dump
    =[log]=> dump/zdtm/transition/shmem/24/1/dump.log
      Commit 46a1c2c7ae53 ("vfs: export lseek_execute() to modules") broke the
      tmpfs SEEK_DATA/SEEK_HOLE implementation, because vfs_setpos() converts
      the carefully prepared -ENXIO to -EINVAL.  Other filesystems avoid it in
      error cases: do the same in tmpfs.
    
      Signed-off-by: Hugh Dickins <hughd at google.com>
      Cc: Jie Liu <jeff.liu at oracle.com>
      Cc: Al Viro <viro at zeniv.linux.org.uk>
      Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    
    https://jira.sw.ru/browse/PSBM-54804
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    Acked-by: Andrew Vagin <avagin at virtuozzo.com>
---
 mm/shmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 827347d..00d7273 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1897,7 +1897,8 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)
 		}
 	}
 
-	offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE);
+	if (offset >= 0)
+		offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE);
 	mutex_unlock(&inode->i_mutex);
 	return offset;
 }


More information about the Devel mailing list