[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1380643239-16060-1-git-send-email-miklos@szeredi.hu>
Date: Tue, 1 Oct 2013 18:00:32 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: viro@...IV.linux.org.uk, torvalds@...ux-foundation.org,
hch@...radead.org, akpm@...ux-foundation.org, dhowells@...hat.com,
zab@...hat.com, jack@...e.cz, tytso@....edu, mszeredi@...e.cz
Subject: [RFC PATCH 0/7] cross rename
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(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists