• Amir Goldstein's avatar
    ovl: properly implement sync_filesystem() · e593b2bf
    Amir Goldstein authored
    overlayfs syncs all inode pages on sync_filesystem(), but it also
    needs to call s_op->sync_fs() of upper fs for metadata sync.
    
    This fixes correctness of syncfs(2) as demonstrated by following
    xfs specific test:
    
    xfs_sync_stats()
    {
    	echo $1
    	echo -n "xfs_log_force = "
    	grep log /proc/fs/xfs/stat  | awk '{ print $5 }'
    }
    
    xfs_sync_stats "before touch"
    touch x
    xfs_sync_stats "after touch"
    xfs_io -c syncfs .
    xfs_sync_stats "after syncfs"
    xfs_io -c fsync x
    xfs_sync_stats "after fsync"
    xfs_io -c fsync x
    xfs_sync_stats "after fsync #2"
    
    When this test is run in overlay mount over xfs, log force
    count does not increase with syncfs command.
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    e593b2bf
super.c 23 KB