diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-10-24 00:14:37 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-10-24 00:14:37 +0200 |
commit | 0d7a855526dd672e114aff2ac22b60fc6f155b08 (patch) | |
tree | 5354ed84bddf7ca55c6cdd3509a71fd8e0bcf63e /fs | |
parent | 787fb6bc9682ec7c05fb5d9561b57100fbc1cc41 (diff) | |
download | op-kernel-dev-0d7a855526dd672e114aff2ac22b60fc6f155b08.zip op-kernel-dev-0d7a855526dd672e114aff2ac22b60fc6f155b08.tar.gz |
vfs: add RENAME_WHITEOUT
This adds a new RENAME_WHITEOUT flag. This flag makes rename() create a
whiteout of source. The whiteout creation is atomic relative to the
rename.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -4209,12 +4209,16 @@ SYSCALL_DEFINE5(renameat2, int, olddfd, const char __user *, oldname, bool should_retry = false; int error; - if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE)) + if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) return -EINVAL; - if ((flags & RENAME_NOREPLACE) && (flags & RENAME_EXCHANGE)) + if ((flags & (RENAME_NOREPLACE | RENAME_WHITEOUT)) && + (flags & RENAME_EXCHANGE)) return -EINVAL; + if ((flags & RENAME_WHITEOUT) && !capable(CAP_MKNOD)) + return -EPERM; + retry: from = user_path_parent(olddfd, oldname, &oldnd, lookup_flags); if (IS_ERR(from)) { |