HomeFreeBSD

zfs_rename: support RENAME_* flags

Description

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
create two new transaction types for the two flags which need
transactional-level support (RENAME_EXCHANGE and RENAME_WHITEOUT).
RENAME_NOREPLACE does not need any ZIL support because we know that if
the operation succeeded before creating the ZIL entry, there was no file
to be clobbered and thus it can be treated as a regular TX_RENAME.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Pavel Snajdr <snajpa@snajpa.net>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Closes #12209
Closes #14070

Details

Provenance
Aleksa Sarai <cyphar@cyphar.com>Authored on Jun 22 2019, 12:35 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Oct 28 2022, 4:49 PM
Parents
rGe015d6cc0b60: zfs_rename: restructure to have cleaner fallbacks
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGdbf6108b4df9: zfs_rename: support RENAME_* flags (authored by Aleksa Sarai <cyphar@cyphar.com>).Oct 28 2022, 4:49 PM