From: Omar Sandoval <osandov@osandov.com>
To: linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Cc: kernel-team@fb.com, David Howells <dhowells@redhat.com>,
Amir Goldstein <amir73il@gmail.com>,
Xi Wang <xi@cs.washington.edu>
Subject: [RFC PATCH v4 0/4] fs: add flag to linkat() for replacing destination
Date: Tue, 28 Jan 2020 15:18:59 -0800 [thread overview]
Message-ID: <cover.1580251857.git.osandov@fb.com> (raw)
In-Reply-To: <cover.1580251857.git.osandov@fb.com>
From: Omar Sandoval <osandov@fb.com>
Hello,
This series adds an AT_LINK_REPLACE flag to linkat() which allows
atomically replacing the destination if it exists. This is a respin of
an old series [1] that I was convinced to resend due to some recent
interest [2][3].
Patch 1 adds a flags argument to i_ops->link() in preparation. Patch 2
adds the VFS support. Patch 3 fixes an inode leak in btrfs_link(),
included in this series because it conflicts with patch 4. Patch 4 adds
support for AT_LINK_REPLACE to Btrfs.
I've also included a man-page patch (with an example program), an xfs_io
patch, and an fstest.
Some outstanding issues:
- The Btrfs implementation does a d_drop() on the replaced dentry. We
probably want a d_replace() helper for filesystems to use.
- Should AT_LINK_REPLACE be limited to O_TMPFILE? In my opinion, the
answer is no. After all, `ln -f` is not that exotic.
- Should AT_LINK_REPLACE guarantee data integrity? Again, I think the
answer is no. That's more suited to something like Amir's AT_ATOMIC
proposal [4].
Changes since v3:
- Rebased on v5.5.
- Added patches 1 and 3.
- Incorporated Al's feedback on various error cases in patch 2.
- Renamed the flag to AT_LINK_REPLACE.
Thanks!
1: https://lore.kernel.org/linux-fsdevel/cover.1524549513.git.osandov@fb.com/
2: https://lore.kernel.org/linux-fsdevel/3326.1579019665@warthog.procyon.org.uk/
3: https://lore.kernel.org/linux-fsdevel/364531.1579265357@warthog.procyon.org.uk/
4: https://lore.kernel.org/linux-fsdevel/20190527172655.9287-1-amir73il@gmail.com/
Cc: David Howells <dhowells@redhat.com>
Cc: Amir Goldstein <amir73il@gmail.com>
Cc: Xi Wang <xi@cs.washington.edu>
Omar Sandoval (4):
fs: add flags argument to i_op->link()
fs: add AT_LINK_REPLACE flag for linkat() which replaces the target
Btrfs: fix inode reference count leak in btrfs_link() error path
Btrfs: add support for linkat() AT_REPLACE
fs/9p/vfs_inode.c | 5 +-
fs/9p/vfs_inode_dotl.c | 5 +-
fs/affs/affs.h | 2 +-
fs/affs/namei.c | 6 +-
fs/afs/dir.c | 7 +-
fs/bad_inode.c | 2 +-
fs/bfs/dir.c | 7 +-
fs/btrfs/inode.c | 70 ++++++++++++++--
fs/ceph/dir.c | 5 +-
fs/cifs/cifsfs.h | 2 +-
fs/cifs/link.c | 5 +-
fs/coda/dir.c | 5 +-
fs/ecryptfs/inode.c | 7 +-
fs/ext2/namei.c | 5 +-
fs/ext4/namei.c | 7 +-
fs/f2fs/namei.c | 5 +-
fs/fuse/dir.c | 5 +-
fs/gfs2/inode.c | 5 +-
fs/hfsplus/dir.c | 5 +-
fs/hostfs/hostfs_kern.c | 5 +-
fs/jffs2/dir.c | 8 +-
fs/jfs/namei.c | 7 +-
fs/libfs.c | 6 +-
fs/minix/namei.c | 5 +-
fs/namei.c | 166 +++++++++++++++++++++++++++++--------
fs/nfs/dir.c | 6 +-
fs/nfs/internal.h | 2 +-
fs/nfsd/vfs.c | 2 +-
fs/nilfs2/namei.c | 5 +-
fs/ocfs2/namei.c | 6 +-
fs/overlayfs/dir.c | 5 +-
fs/overlayfs/overlayfs.h | 2 +-
fs/reiserfs/namei.c | 5 +-
fs/sysv/namei.c | 7 +-
fs/ubifs/dir.c | 5 +-
fs/udf/namei.c | 5 +-
fs/ufs/namei.c | 5 +-
fs/xfs/xfs_iops.c | 6 +-
include/linux/fs.h | 6 +-
include/uapi/linux/fcntl.h | 1 +
mm/shmem.c | 6 +-
41 files changed, 341 insertions(+), 90 deletions(-)
--
2.25.0
WARNING: multiple messages have this Message-ID (diff)
From: Omar Sandoval <osandov@osandov.com>
To: linux-fsdevel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Cc: kernel-team@fb.com, linux-api@vger.kernel.org,
David Howells <dhowells@redhat.com>,
Amir Goldstein <amir73il@gmail.com>,
Xi Wang <xi@cs.washington.edu>
Subject: [RFC PATCH v4 0/4] fs: add flag to linkat() for replacing destination
Date: Wed, 29 Jan 2020 00:58:30 -0800 [thread overview]
Message-ID: <cover.1580251857.git.osandov@fb.com> (raw)
Message-ID: <20200129085830.g59bAJnkBpJ7g8I9pmgYb4U_b_BE2_vYdhRYbDxGqHc@z> (raw)
In-Reply-To: <cover.1580251857.git.osandov@fb.com>
From: Omar Sandoval <osandov@fb.com>
[Sorry if you got this twice, I botched the Cc's on the previous
submission.]
Hello,
This series adds an AT_LINK_REPLACE flag to linkat() which allows
atomically replacing the destination if it exists. This is a respin of
an old series [1] that I was convinced to resend due to some recent
interest [2][3].
Patch 1 adds a flags argument to i_ops->link() in preparation. Patch 2
adds the VFS support. Patch 3 fixes an inode leak in btrfs_link(),
included in this series because it conflicts with patch 4. Patch 4 adds
support for AT_LINK_REPLACE to Btrfs.
I've also included a man-page patch (with an example program), an xfs_io
patch, and an fstest.
Some outstanding issues:
- The Btrfs implementation does a d_drop() on the replaced dentry. We
probably want a d_replace() helper for filesystems to use.
- Should AT_LINK_REPLACE be limited to O_TMPFILE? In my opinion, the
answer is no. After all, `ln -f` is not that exotic.
- Should AT_LINK_REPLACE guarantee data integrity? Again, I think the
answer is no. That's more suited to something like Amir's AT_ATOMIC
proposal [4].
Changes since v3:
- Rebased on v5.5.
- Added patches 1 and 3.
- Incorporated Al's feedback on various error cases in patch 2.
- Renamed the flag to AT_LINK_REPLACE.
Thanks!
1: https://lore.kernel.org/linux-fsdevel/cover.1524549513.git.osandov@fb.com/
2: https://lore.kernel.org/linux-fsdevel/3326.1579019665@warthog.procyon.org.uk/
3: https://lore.kernel.org/linux-fsdevel/364531.1579265357@warthog.procyon.org.uk/
4: https://lore.kernel.org/linux-fsdevel/20190527172655.9287-1-amir73il@gmail.com/
Omar Sandoval (4):
fs: add flags argument to i_op->link()
fs: add AT_LINK_REPLACE flag for linkat() which replaces the target
Btrfs: fix inode reference count leak in btrfs_link() error path
Btrfs: add support for linkat() AT_REPLACE
fs/9p/vfs_inode.c | 5 +-
fs/9p/vfs_inode_dotl.c | 5 +-
fs/affs/affs.h | 2 +-
fs/affs/namei.c | 6 +-
fs/afs/dir.c | 7 +-
fs/bad_inode.c | 2 +-
fs/bfs/dir.c | 7 +-
fs/btrfs/inode.c | 70 ++++++++++++++--
fs/ceph/dir.c | 5 +-
fs/cifs/cifsfs.h | 2 +-
fs/cifs/link.c | 5 +-
fs/coda/dir.c | 5 +-
fs/ecryptfs/inode.c | 7 +-
fs/ext2/namei.c | 5 +-
fs/ext4/namei.c | 7 +-
fs/f2fs/namei.c | 5 +-
fs/fuse/dir.c | 5 +-
fs/gfs2/inode.c | 5 +-
fs/hfsplus/dir.c | 5 +-
fs/hostfs/hostfs_kern.c | 5 +-
fs/jffs2/dir.c | 8 +-
fs/jfs/namei.c | 7 +-
fs/libfs.c | 6 +-
fs/minix/namei.c | 5 +-
fs/namei.c | 166 +++++++++++++++++++++++++++++--------
fs/nfs/dir.c | 6 +-
fs/nfs/internal.h | 2 +-
fs/nfsd/vfs.c | 2 +-
fs/nilfs2/namei.c | 5 +-
fs/ocfs2/namei.c | 6 +-
fs/overlayfs/dir.c | 5 +-
fs/overlayfs/overlayfs.h | 2 +-
fs/reiserfs/namei.c | 5 +-
fs/sysv/namei.c | 7 +-
fs/ubifs/dir.c | 5 +-
fs/udf/namei.c | 5 +-
fs/ufs/namei.c | 5 +-
fs/xfs/xfs_iops.c | 6 +-
include/linux/fs.h | 6 +-
include/uapi/linux/fcntl.h | 1 +
mm/shmem.c | 6 +-
41 files changed, 341 insertions(+), 90 deletions(-)
--
2.25.0
next parent reply other threads:[~2020-01-28 23:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 23:18 Omar Sandoval [this message]
2020-01-28 23:18 ` [RFC PATCH xfstests] generic: add smoke test for AT_LINK_REPLACE Omar Sandoval
2020-01-29 7:02 ` Zorro Lang
2020-01-29 8:58 ` Omar Sandoval
2020-02-23 14:46 ` Eryu Guan
2020-01-28 23:18 ` [RFC PATCH man-pages] link.2: Document new AT_LINK_REPLACE flag Omar Sandoval
2020-01-29 8:58 ` Omar Sandoval
2020-01-28 23:18 ` [RFC PATCH xfsprogs] xfs_io: add support for linkat() AT_LINK_REPLACE Omar Sandoval
2020-01-29 8:58 ` Omar Sandoval
2020-01-30 4:42 ` Zorro Lang
2020-01-28 23:19 ` [RFC PATCH v4 1/4] fs: add flags argument to i_op->link() Omar Sandoval
2020-01-29 8:58 ` Omar Sandoval
2020-01-28 23:19 ` [RFC PATCH v4 2/4] fs: add AT_LINK_REPLACE flag for linkat() which replaces the target Omar Sandoval
2020-01-29 8:58 ` Omar Sandoval
2020-01-28 23:19 ` [RFC PATCH v4 3/4] Btrfs: fix inode reference count leak in btrfs_link() error path Omar Sandoval
2020-01-29 8:58 ` Omar Sandoval
2020-01-28 23:19 ` [RFC PATCH v4 4/4] Btrfs: add support for linkat() AT_REPLACE Omar Sandoval
2020-01-29 8:58 ` Omar Sandoval
2020-01-29 8:58 ` [RFC PATCH v4 0/4] fs: add flag to linkat() for replacing destination Omar Sandoval
2020-01-31 13:48 ` [RFC PATCH v4 1/4] fs: add flags argument to i_op->link() David Howells
2020-01-31 20:24 ` Omar Sandoval
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1580251857.git.osandov@fb.com \
--to=osandov@osandov.com \
--cc=amir73il@gmail.com \
--cc=dhowells@redhat.com \
--cc=kernel-team@fb.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=xi@cs.washington.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).