diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-10-23 18:14:36 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-10-23 18:14:36 -0400 |
commit | 787fb6bc9682ec7c05fb5d9561b57100fbc1cc41 (patch) | |
tree | fde11fbe9f87e95ef6078fcbfed5f55c9ba134f8 /fs/namei.c | |
parent | cbdf35bcb833bfd00f0925d7a9a33a21f41ea582 (diff) |
vfs: add whiteout support
Whiteout isn't actually a new file type, but is represented as a char
device (Linus's idea) with 0/0 device number.
This has several advantages compared to introducing a new whiteout file
type:
- no userspace API changes (e.g. trivial to make backups of upper layer
filesystem, without losing whiteouts)
- no fs image format changes (you can boot an old kernel/fsck without
whiteout support and things won't break)
- implementation is trivial
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index 77fd536106cb..d20191c0ebf5 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -4346,6 +4346,20 @@ SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newna | |||
4346 | return sys_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0); | 4346 | return sys_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0); |
4347 | } | 4347 | } |
4348 | 4348 | ||
4349 | int vfs_whiteout(struct inode *dir, struct dentry *dentry) | ||
4350 | { | ||
4351 | int error = may_create(dir, dentry); | ||
4352 | if (error) | ||
4353 | return error; | ||
4354 | |||
4355 | if (!dir->i_op->mknod) | ||
4356 | return -EPERM; | ||
4357 | |||
4358 | return dir->i_op->mknod(dir, dentry, | ||
4359 | S_IFCHR | WHITEOUT_MODE, WHITEOUT_DEV); | ||
4360 | } | ||
4361 | EXPORT_SYMBOL(vfs_whiteout); | ||
4362 | |||
4349 | int readlink_copy(char __user *buffer, int buflen, const char *link) | 4363 | int readlink_copy(char __user *buffer, int buflen, const char *link) |
4350 | { | 4364 | { |
4351 | int len = PTR_ERR(link); | 4365 | int len = PTR_ERR(link); |