linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/7] cross rename
@ 2013-10-01 16:00 Miklos Szeredi
  2013-10-01 16:00 ` [PATCH 1/7] vfs: rename: move d_move() up Miklos Szeredi
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: Miklos Szeredi @ 2013-10-01 16:00 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel
  Cc: viro, torvalds, hch, akpm, dhowells, zab, jack, tytso, mszeredi

This series adds a new syscall, renameat2(), which is the same as renameat() but
with a flags argument.  Internally i_op->reaname2() is also added, which can
later be merged with ->rename() but is kept separately for now, since this would
just blow up this patch without helping review.

The purpose of extending rename is to add cross-rename, a symmetric variant of
rename, which exchanges the two files.  This allows interesting things, which
were not possible before, for example atomically replacing a directory tree with
a symlink, etc...

The other reason to introduce this is for whiteout handling in union/overlay
solutions in an atomic manner without having to add complex code to each
filesystem's rmdir, mkdir and rename just for handling whiteouts.  With
cross-rename it becomes possible to handle whiteouts in a generic manner in most
of the cases:

rmdir(P) where P needs to be whiteout:
  - create-whiteout(orphan/X)
  - exchange(orphan/X, P)
  - rmdir(orphan/X)

mkdir(P) where P is currently a whiteout:
  - mkdir(orphan/X)
  - exchange(orphan/X, P)
  - unlink(orphan/X)

rename(P, Q) where P needs to be whiteout and Q is negative:
  - create-whiteout(Q)
  - exchange(P, Q)

rename(P, Q) where Q is a directory containing only whiteouts:
  - mkdir(orphan/X) (marked as opaque)
  - exchange(orphan/X, Q)
  - recursive-remove(orphan/X)
  - rename(P, Q)

The case that cannot be handled with cross rename is:

rename(P, Q) where P needs to be whiteout and Q exists

For this case a new rename flag will be propsed that atomically creates the
whiteout.

Thanks,
Miklos

---
Miklos Szeredi (7):
      vfs: rename: move d_move() up
      vfs: rename: use common code for dir and non-dir
      vfs: add renameat2 syscall and cross-rename
      ext4: rename: create ext4_renament structure for local vars
      ext4: rename: move EMLINK check up
      ext4: rename: split out helper functions
      ext4: add cross rename support

---
 arch/x86/syscalls/syscall_64.tbl |   1 +
 fs/dcache.c                      |  46 ++++-
 fs/ext4/namei.c                  | 379 +++++++++++++++++++++++++--------------
 fs/namei.c                       | 218 ++++++++++++----------
 include/linux/dcache.h           |   1 +
 include/linux/fs.h               |   2 +
 include/uapi/linux/fs.h          |   2 +
 7 files changed, 415 insertions(+), 234 deletions(-)



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-10-05  0:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01 16:00 [RFC PATCH 0/7] cross rename Miklos Szeredi
2013-10-01 16:00 ` [PATCH 1/7] vfs: rename: move d_move() up Miklos Szeredi
2013-10-01 16:00 ` [PATCH 2/7] vfs: rename: use common code for dir and non-dir Miklos Szeredi
2013-10-01 16:00 ` [PATCH 3/7] vfs: add renameat2 syscall and cross-rename Miklos Szeredi
2013-10-02 12:26   ` Jan Kara
2013-10-02 14:59     ` Miklos Szeredi
2013-10-01 16:00 ` [PATCH 4/7] ext4: rename: create ext4_renament structure for local vars Miklos Szeredi
2013-10-02 12:01   ` Jan Kara
2013-10-01 16:00 ` [PATCH 5/7] ext4: rename: move EMLINK check up Miklos Szeredi
2013-10-02 12:05   ` Jan Kara
2013-10-01 16:00 ` [PATCH 6/7] ext4: rename: split out helper functions Miklos Szeredi
2013-10-02 12:19   ` Jan Kara
2013-10-01 16:00 ` [PATCH 7/7] ext4: add cross rename support Miklos Szeredi
2013-10-03  1:58 ` [RFC PATCH 0/7] cross rename H. Peter Anvin
2013-10-03  5:34   ` Linus Torvalds
2013-10-03  5:36     ` H. Peter Anvin
2013-10-04 23:58 ` Andy Lutomirski
2013-10-05  0:11   ` Linus Torvalds

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).