Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OverlayFS support (d_revalidate out and support renameat2 flags) #9414

Closed
wants to merge 7 commits into from

Commits on Nov 22, 2019

  1. Remove zpl_revalidate: fix snapshot rollback

    Open files, which aren't present in the snapshot, which is being
    roll-backed to, need to disappear from the visible VFS image of
    the dataset.
    
    Kernel provides __d_drop function to locklessly drop invalid entry
    from the dcache, but inode can be referenced by multiple dentries.
    
    The introduced spl_d_drop_aliases function walks and invalidates
    all aliases of an inode.
    
    Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
    snajpa committed Nov 22, 2019
    Configuration menu
    Copy the full SHA
    173d878 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2019

  1. zfs_rename: restructure to have cleaner fallbacks

    This is in preparation for RENAME_EXCHANGE and RENAME_WHITEOUT support
    for ZoL, but the changes here allow for far nicer fallbacks than the
    previous implementation (the source and target are re-linked in case of
    the final link failing).
    
    In addition, a small cleanup was done for the "target exists but is a
    different type" codepath so that it's more understandable.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
    cyphar authored and snajpa committed Nov 23, 2019
    Configuration menu
    Copy the full SHA
    aebbfd2 View commit details
    Browse the repository at this point in the history
  2. zfs_rename: support RENAME_* flags

    Implement support for Linux's RENAME_* flags (for renameat2). Aside from
    being quite useful for userspace (providing race-free ways to exchange
    paths and implement mv --no-clobber), they are used by overlayfs and are
    thus required in order to use overlayfs-on-ZFS.
    
    In order for us to represent the new renameat2(2) flags in the ZIL, we
    need to create a new transaction type (to be backwards-compatible).
    Since RENAME_EXCHANGE and RENAME_WHITEOUT are mutually exclusive they
    deserve separate types. We just re-use the logic of
    zfs_{log,replay}_rename() with the only change being the transaction
    types and the associate vfsflags passed to zfs_rename().
    
    RENAME_NOREPLACE doesn't need an entry because if the renameat2(2) fails
    because of RENAME_NOREPLACE there won't be a ZIL entry for the operation
    (and if it succeeds then it should also succeed on-replay).
    
    Unfortunately, more work is required in order use overlayfs-on-ZFS
    (namely we have to remove our .d_revalidate hook, since overlayfs
    refuses to use a filesystem with d_revalidate as an upperdir).
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
    cyphar authored and snajpa committed Nov 23, 2019
    Configuration menu
    Copy the full SHA
    4201ef0 View commit details
    Browse the repository at this point in the history
  3. tests: add tests for renameat2(2) flags

    Since mv(1) doesn't expose the RENAME_* flags we need to have our own
    variation in the tests/ tree. The tests are fairly obvious functional
    tests, though in the future (once we solve the d_revalidate issue) we
    might also add a full-stack overlayfs integration test.
    
    Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
    Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
    cyphar authored and snajpa committed Nov 23, 2019
    Configuration menu
    Copy the full SHA
    df40efd View commit details
    Browse the repository at this point in the history
  4. zfs_rename: pick up and finish renameat2 flags support

    Removing new txtypes in favor of compound ZIL operations, see comment in
    module/zfs/zfs_log.c.
    
    Other notable changes:
    
    - unlock after the inodes are updated
    - pass whiteout znode pointer to zfs_log_rename_whiteout
    - don't wrap code directly in ASSERT*(), it turn to noop on non-debug
      builds
    - update configure time tests for rename2 to support kernels
      from 3.5 to 4.8
    
    Fixes openzfs#2256
    Fixes openzfs#8648
    Fixes openzfs#8774
    
    Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
    snajpa committed Nov 23, 2019
    Configuration menu
    Copy the full SHA
    b4d9caf View commit details
    Browse the repository at this point in the history
  5. tests: add basic overlayfs tests

    Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
    snajpa committed Nov 23, 2019
    Configuration menu
    Copy the full SHA
    5ce120c View commit details
    Browse the repository at this point in the history
  6. EL7 directory inode operations rename2 compat

    EL7 has .rename2 op upper in the inode_operations_wrapper,
    so let's add a wrapping ifdef to dir inode_operations
    and ifdef the ops assignment too.
    
    Configure test lives in kernel-rename.m4 for now, as rename2/EL7 case
    is the only reason why we need it - for now, until support for
    tmpfile is needed. then it would me more logical to move this check
    to a separate file.
    
    Signed-off-by: Pavel Snajdr <snajpa@snajpa.net>
    snajpa committed Nov 23, 2019
    Configuration menu
    Copy the full SHA
    e999217 View commit details
    Browse the repository at this point in the history