diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 05:03:57 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 05:03:57 -0400 |
commit | f03b8ad8d38634d13e802165cc15917481b47835 (patch) | |
tree | 4dc9c060684f242d1e6c07d28d1ff625db63fd6c /fs/ubifs | |
parent | 9a232de4999666b2e8ea6775b2b0e3e4feb09b7a (diff) |
fs: support RENAME_NOREPLACE for local filesystems
This is trivial to do:
- add flags argument to foo_rename()
- check if flags doesn't have any other than RENAME_NOREPLACE
- assign foo_rename() to .rename2 instead of .rename
Filesystems converted:
affs, bfs, exofs, ext2, hfs, hfsplus, jffs2, jfs, logfs, minix, msdos,
nilfs2, omfs, reiserfs, sysvfs, ubifs, udf, ufs, vfat.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Acked-by: Boaz Harrosh <ooo@electrozaur.com>
Acked-by: Richard Weinberger <richard@nod.at>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/dir.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 4b86d3a738e1..23d1ebabc688 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -966,7 +966,8 @@ static void unlock_3_inodes(struct inode *inode1, struct inode *inode2, | |||
966 | } | 966 | } |
967 | 967 | ||
968 | static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | 968 | static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, |
969 | struct inode *new_dir, struct dentry *new_dentry) | 969 | struct inode *new_dir, struct dentry *new_dentry, |
970 | unsigned int flags) | ||
970 | { | 971 | { |
971 | struct ubifs_info *c = old_dir->i_sb->s_fs_info; | 972 | struct ubifs_info *c = old_dir->i_sb->s_fs_info; |
972 | struct inode *old_inode = d_inode(old_dentry); | 973 | struct inode *old_inode = d_inode(old_dentry); |
@@ -984,6 +985,9 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
984 | struct timespec time; | 985 | struct timespec time; |
985 | unsigned int uninitialized_var(saved_nlink); | 986 | unsigned int uninitialized_var(saved_nlink); |
986 | 987 | ||
988 | if (flags & ~RENAME_NOREPLACE) | ||
989 | return -EINVAL; | ||
990 | |||
987 | /* | 991 | /* |
988 | * Budget request settings: deletion direntry, new direntry, removing | 992 | * Budget request settings: deletion direntry, new direntry, removing |
989 | * the old inode, and changing old and new parent directory inodes. | 993 | * the old inode, and changing old and new parent directory inodes. |
@@ -1179,7 +1183,7 @@ const struct inode_operations ubifs_dir_inode_operations = { | |||
1179 | .mkdir = ubifs_mkdir, | 1183 | .mkdir = ubifs_mkdir, |
1180 | .rmdir = ubifs_rmdir, | 1184 | .rmdir = ubifs_rmdir, |
1181 | .mknod = ubifs_mknod, | 1185 | .mknod = ubifs_mknod, |
1182 | .rename = ubifs_rename, | 1186 | .rename2 = ubifs_rename, |
1183 | .setattr = ubifs_setattr, | 1187 | .setattr = ubifs_setattr, |
1184 | .getattr = ubifs_getattr, | 1188 | .getattr = ubifs_getattr, |
1185 | .setxattr = generic_setxattr, | 1189 | .setxattr = generic_setxattr, |