ibm-s390-linux / s390-tools

Tools for use with the s390 Linux kernel and device drivers
MIT License
63 stars 60 forks source link

zipl cannot map reflinked files on XFS #34

Closed sandeen closed 5 years ago

sandeen commented 6 years ago

It was recently recognized that zipl fails on reflinked boot files on XFS (that is, with files which share blocks with another file, i.e. copy on write file snapshots as supported by xfs, btrfs, ocfs2 etc).

This is because the FIBMAP ioctl interface zipl uses to map blocks has been specifically disabled for reflinked files on XFS, to prevent swap from writing to these blocks and bypassing the COW mechanism:

commit db1327b16c2b24e28d1e5899bced89db9ae6538e
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Mon Oct 3 09:11:36 2016 -0700

    xfs: report shared extent mappings to userspace correctly

    Report shared extents through the iomap interface so that FIEMAP flags
    shared blocks accurately.  Have xfs_vm_bmap return zero for reflinked
    files because the bmap-based swap code requires static block mappings,
    which is incompatible with copy on write.

    NOTE: Existing userspace bmap users such as lilo will have the same
    problem with reflink files.

    Signed-off-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

The FIEMAP interface can still be used to map reflinked file blocks, so it would be useful to try the FIEMAP interface first and fall back to FIBMAP only if FIEMAP is not supported.

sandeen commented 6 years ago

PR #36 should resolve this.