diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 05:03:58 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 05:03:58 -0400 |
commit | 1cd66c93ba8cdb873258f58ae6a817b28a02bcc3 (patch) | |
tree | f9a1f49b000c9959c5b278eae175b996ade3a7cd /fs/ecryptfs/inode.c | |
parent | e0e0be8a835520e2f7c89f214dfda570922a1b90 (diff) |
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 <mszeredi@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: David Howells <dhowells@redhat.com> [AFS]
Acked-by: Mike Marshall <hubcap@omnibond.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ecryptfs/inode.c')
-rw-r--r-- | fs/ecryptfs/inode.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 9d153b6a1d72..f3ff7c4d384c 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -577,7 +577,8 @@ out: | |||
577 | 577 | ||
578 | static int | 578 | static int |
579 | ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | 579 | ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
580 | struct inode *new_dir, struct dentry *new_dentry) | 580 | struct inode *new_dir, struct dentry *new_dentry, |
581 | unsigned int flags) | ||
581 | { | 582 | { |
582 | int rc; | 583 | int rc; |
583 | struct dentry *lower_old_dentry; | 584 | struct dentry *lower_old_dentry; |
@@ -587,6 +588,9 @@ ecryptfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
587 | struct dentry *trap = NULL; | 588 | struct dentry *trap = NULL; |
588 | struct inode *target_inode; | 589 | struct inode *target_inode; |
589 | 590 | ||
591 | if (flags) | ||
592 | return -EINVAL; | ||
593 | |||
590 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); | 594 | lower_old_dentry = ecryptfs_dentry_to_lower(old_dentry); |
591 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); | 595 | lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry); |
592 | dget(lower_old_dentry); | 596 | dget(lower_old_dentry); |
@@ -1104,7 +1108,7 @@ const struct inode_operations ecryptfs_dir_iops = { | |||
1104 | .mkdir = ecryptfs_mkdir, | 1108 | .mkdir = ecryptfs_mkdir, |
1105 | .rmdir = ecryptfs_rmdir, | 1109 | .rmdir = ecryptfs_rmdir, |
1106 | .mknod = ecryptfs_mknod, | 1110 | .mknod = ecryptfs_mknod, |
1107 | .rename = ecryptfs_rename, | 1111 | .rename2 = ecryptfs_rename, |
1108 | .permission = ecryptfs_permission, | 1112 | .permission = ecryptfs_permission, |
1109 | .setattr = ecryptfs_setattr, | 1113 | .setattr = ecryptfs_setattr, |
1110 | .setxattr = ecryptfs_setxattr, | 1114 | .setxattr = ecryptfs_setxattr, |