Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-13397

lfs migrate/mirror extend/resync does not preserve sparse file

Details

    • Bug
    • Resolution: Fixed
    • Major
    • Lustre 2.15.0
    • None

    Description

      While testing "lfs migrate", "lfs mirror extend", and "lfs mirror resync", I was doing high-offset writes to initialize later PFL components of the file layout (e.g. at 1GB offset and 32GB offset). When trying to mirror/resync those files to another mirror copy, it resulted in the commands failing due to ENOSPC because there was not enough free space in the test filesystem to write out the data.

      These commands should be updated to share a common "data copy" routine (if they don't already) to reduce code duplication when fixing these issues. Then, the code needs to handle sparse input files properly, first by checking for sparse files (e.g. blocks << size) to enable checking the source file, and not copying holes in the file. There should probably be options added for each command like "--sparse=<auto,no,yes>" (default = auto) to force a specific behavior.

      Unfortunately, there is no optimal way to handle reading of sparse files in Lustre today. In all cases, it makes little sense to be doing these operations on in-use files, so there are already checks if the file is modified during migrate/mirror/resync.

      • For 1-stripe files, the ioctl(FIEMAP) will return a current map of data for the file (it flushes data if FIEMAP_FLAG_SYNC is used, but doesn't prevent further modification). Multi-stripe and PFL files return multiple maps in per-object offset order, and that is not useful if the files are using different layouts (likely a common case). Also, ZFS does not yet support FIEMAP despite some efforts in that direction.
      • Using SEEK_HOLE and SEEK_DATA would be the preferred solution, but this needs a Lustre-level update to pass these through from the client to the OST (and MDT for DoM). This is described in LU-10801, and may be able to leverage some infrastructure from the patch https://review.whamcloud.com/9275 "LU-3606 fallocate: Implement fallocate preallocate operation". While SEEK_HOLE and SEEK_DATA "work" for Lustre by kernel emulation, they just assume that every block is "data" and the first hole is the end of the file.
      • The simplest (though least efficient) option would be to do zero-block detection during the copy phase. This has quite high CPU and IO overhead, because it requires reading the whole file and checking every byte. It would only be done if the file appears to be very sparse, and the layout is complex (i.e. not single stripe where FIEMAP is useful).

      Attachments

        Issue Links

          Activity

            [LU-13397] lfs migrate/mirror extend/resync does not preserve sparse file

            "Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/50329
            Subject: LU-13397 lfs: mirror extend/copy keeps sparseness
            Project: fs/lustre-release
            Branch: b2_12
            Current Patch Set: 1
            Commit: d36e3f1a5599eb557e07550651d855c19d18ca36

            gerrit Gerrit Updater added a comment - "Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/50329 Subject: LU-13397 lfs: mirror extend/copy keeps sparseness Project: fs/lustre-release Branch: b2_12 Current Patch Set: 1 Commit: d36e3f1a5599eb557e07550651d855c19d18ca36
            cfaber Colin Faber made changes -
            Labels Original: HPv3 New: HPv3 HPv4p1
            cfaber Colin Faber made changes -
            Epic Link Original: EX-1915 [ 61156 ] New: EX-6005 [ 72505 ]
            pjones Peter Jones made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Open [ 1 ] New: Resolved [ 5 ]
            adilger Andreas Dilger made changes -
            Link New: This issue is related to LU-3833 [ LU-3833 ]
            tappro Mikhail Pershin made changes -
            Status Original: In Progress [ 3 ] New: Open [ 1 ]

            "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/44721/
            Subject: LU-13397 llite: support fallocate() on selected mirror
            Project: fs/lustre-release
            Branch: master
            Current Patch Set:
            Commit: 89736d502cc99f095237dde7520fc4ca86191882

            gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/44721/ Subject: LU-13397 llite: support fallocate() on selected mirror Project: fs/lustre-release Branch: master Current Patch Set: Commit: 89736d502cc99f095237dde7520fc4ca86191882

            "Mike Pershin <mpershin@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/44721
            Subject: LU-13397 llite: support fallocate() on selected mirror
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 84ab0da804fda75262dd0022528d0043cb3e4558

            gerrit Gerrit Updater added a comment - "Mike Pershin <mpershin@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/44721 Subject: LU-13397 llite: support fallocate() on selected mirror Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 84ab0da804fda75262dd0022528d0043cb3e4558

            I've found the problem with mirror resync and sparse file, it is not working as intended, so I am keeping ticket opened.

            The problem is in fallocate punch operation during resync. If it is done prior write operation then write itself fails due to changed layout version.

            tappro Mikhail Pershin added a comment - I've found the problem with mirror resync and sparse file, it is not working as intended, so I am keeping ticket opened. The problem is in fallocate punch operation during resync. If it is done prior write operation then write itself fails due to changed layout version.
            tappro Mikhail Pershin made changes -
            Fix Version/s New: Lustre 2.15.0 [ 14791 ]

            People

              tappro Mikhail Pershin
              adilger Andreas Dilger
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: