From 1cd66c93ba8cdb873258f58ae6a817b28a02bcc3 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 27 Sep 2016 11:03:58 +0200 Subject: fs: make remaining filesystems use .rename2 This is trivial to do: - add flags argument to foo_rename() - check if flags is zero - assign foo_rename() to .rename2 instead of .rename This doesn't mean it's impossible to support RENAME_NOREPLACE for these filesystems, but it is not trivial, like for local filesystems. RENAME_NOREPLACE must guarantee atomicity (i.e. it shouldn't be possible for a file to be created on one host while it is overwritten by rename on another host). Filesystems converted: 9p, afs, ceph, coda, ecryptfs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs. After this, we can get rid of the duplicate interfaces for rename. Signed-off-by: Miklos Szeredi Acked-by: Greg Kroah-Hartman Acked-by: David Howells [AFS] Acked-by: Mike Marshall Cc: Eric Van Hensbergen Cc: Ilya Dryomov Cc: Jan Harkes Cc: Tyler Hicks Cc: Oleg Drokin Cc: Trond Myklebust Cc: Mark Fasheh --- fs/ocfs2/namei.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'fs/ocfs2/namei.c') diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index a8f1225e6d9b..1040c10a9493 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c @@ -1203,7 +1203,8 @@ static void ocfs2_double_unlock(struct inode *inode1, struct inode *inode2) static int ocfs2_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, - struct dentry *new_dentry) + struct dentry *new_dentry, + unsigned int flags) { int status = 0, rename_lock = 0, parents_locked = 0, target_exists = 0; int old_child_locked = 0, new_child_locked = 0, update_dot_dot = 0; @@ -1228,6 +1229,9 @@ static int ocfs2_rename(struct inode *old_dir, struct ocfs2_dir_lookup_result target_insert = { NULL, }; bool should_add_orphan = false; + if (flags) + return -EINVAL; + /* At some point it might be nice to break this function up a * bit. */ @@ -2909,7 +2913,7 @@ const struct inode_operations ocfs2_dir_iops = { .symlink = ocfs2_symlink, .mkdir = ocfs2_mkdir, .mknod = ocfs2_mknod, - .rename = ocfs2_rename, + .rename2 = ocfs2_rename, .setattr = ocfs2_setattr, .getattr = ocfs2_getattr, .permission = ocfs2_permission, -- cgit v1.2.3