linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-api@vger.kernel.org, kernel-team@fb.com,
	Xi Wang <xi@cs.washington.edu>
Subject: [RFC PATCH 0/3] fs: add AT_REPLACE flag for linkat()
Date: Tue, 22 Nov 2016 00:25:00 -0800	[thread overview]
Message-ID: <cover.1479802448.git.osandov@fb.com> (raw)

From: Omar Sandoval <osandov@fb.com>

This is a proof-of-concept patch series implementing an AT_REPLACE flag
for linkat(2) which allows us to replace the target. This is a nice
primitive on its own, but it's most interesting when combined with
O_TMPFILE, as it allows you to do an atomic update of a file with an
O_TMPFILE.

Patch 1 implements the VFS support for this flag. The implementation
resembles sys_renameat2(), and I took care to preserve all of the
original error cases and make the new error cases consistent with
rename.

Patch 2 adds a dcache helper for filesystem implementations of
AT_REPLACE. I'm not entirely convinced that it's 100% correct.

Patch 3 adds support for AT_REPLACE to Btrfs. That's the codebase I'm
most familiar with so that's where I started, but it should be
straightforward to implement for other filesystems.

Any comments are welcome.

Cc: Xi Wang <xi@cs.washington.edu>

Omar Sandoval (3):
  fs: add AT_REPLACE flag for linkat() which replaces the target
  vfs: add d_replace()
  Btrfs: add support for linkat() AT_REPLACE

 fs/btrfs/inode.c           |  59 ++++++++++++++-
 fs/dcache.c                |  68 +++++++++++++++--
 fs/ecryptfs/inode.c        |   2 +-
 fs/namei.c                 | 180 +++++++++++++++++++++++++++++++++++----------
 fs/nfsd/vfs.c              |   2 +-
 fs/overlayfs/overlayfs.h   |   2 +-
 include/linux/dcache.h     |   1 +
 include/linux/fs.h         |   3 +-
 include/uapi/linux/fcntl.h |   1 +
 9 files changed, 267 insertions(+), 51 deletions(-)

-- 
2.10.2


             reply	other threads:[~2016-11-22  8:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-22  8:25 Omar Sandoval [this message]
     [not found] ` <cover.1479802448.git.osandov-b10kYP2dOMg@public.gmane.org>
2016-11-22  8:25   ` [RFC PATCH 1/3] fs: add AT_REPLACE flag for linkat() which replaces the target Omar Sandoval
     [not found]     ` <6b3b7387538efd1a582fc34da2a15ae37cf59429.1479802448.git.osandov-b10kYP2dOMg@public.gmane.org>
2016-11-22 19:05       ` Colin Walters
2016-11-22  8:25   ` [RFC PATCH 2/3] vfs: add d_replace() Omar Sandoval
     [not found]     ` <527297d2dae27845b3b7ba8ad6e81ef477fddee2.1479802448.git.osandov-b10kYP2dOMg@public.gmane.org>
2016-11-23  3:40       ` Al Viro
     [not found]         ` <20161123034004.GK1555-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2016-11-23  3:57           ` Omar Sandoval
2016-11-23 16:29             ` Linus Torvalds
     [not found]               ` <CA+55aFxTQb5dFwziQ7uaHgew4xq6xKhYHpD1tGrZi9QvM6+SLw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-02  1:10                 ` Omar Sandoval
2016-11-22  8:25   ` [RFC PATCH 3/3] Btrfs: add support for linkat() AT_REPLACE 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.1479802448.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=kernel-team@fb.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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).