diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-07-23 09:15:33 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-08-07 14:40:09 -0400 |
commit | 3b69ff51d087d265aa4af3a532fc4f20bf33e718 (patch) | |
tree | 961659a736ae216eee0684c26c0dca8f6c92323f | |
parent | 80ace85c915d0f41016f82917218997b72431258 (diff) |
shmem: support RENAME_NOREPLACE
Implement ->rename2 instead of ->rename.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | mm/shmem.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index af68b15a8fc1..fe959181f995 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2054,11 +2054,14 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) | |||
2054 | * it exists so that the VFS layer correctly free's it when it | 2054 | * it exists so that the VFS layer correctly free's it when it |
2055 | * gets overwritten. | 2055 | * gets overwritten. |
2056 | */ | 2056 | */ |
2057 | static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) | 2057 | static int shmem_rename2(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry, unsigned int flags) |
2058 | { | 2058 | { |
2059 | struct inode *inode = old_dentry->d_inode; | 2059 | struct inode *inode = old_dentry->d_inode; |
2060 | int they_are_dirs = S_ISDIR(inode->i_mode); | 2060 | int they_are_dirs = S_ISDIR(inode->i_mode); |
2061 | 2061 | ||
2062 | if (flags & ~(RENAME_NOREPLACE)) | ||
2063 | return -EINVAL; | ||
2064 | |||
2062 | if (!simple_empty(new_dentry)) | 2065 | if (!simple_empty(new_dentry)) |
2063 | return -ENOTEMPTY; | 2066 | return -ENOTEMPTY; |
2064 | 2067 | ||
@@ -2741,7 +2744,7 @@ static const struct inode_operations shmem_dir_inode_operations = { | |||
2741 | .mkdir = shmem_mkdir, | 2744 | .mkdir = shmem_mkdir, |
2742 | .rmdir = shmem_rmdir, | 2745 | .rmdir = shmem_rmdir, |
2743 | .mknod = shmem_mknod, | 2746 | .mknod = shmem_mknod, |
2744 | .rename = shmem_rename, | 2747 | .rename2 = shmem_rename2, |
2745 | .tmpfile = shmem_tmpfile, | 2748 | .tmpfile = shmem_tmpfile, |
2746 | #endif | 2749 | #endif |
2747 | #ifdef CONFIG_TMPFS_XATTR | 2750 | #ifdef CONFIG_TMPFS_XATTR |