diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 11:03:58 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2016-09-27 11:03:58 +0200 |
commit | 1cd66c93ba8cdb873258f58ae6a817b28a02bcc3 (patch) | |
tree | f9a1f49b000c9959c5b278eae175b996ade3a7cd /fs/coda | |
parent | e0e0be8a835520e2f7c89f214dfda570922a1b90 (diff) | |
download | linux-1cd66c93ba8cdb873258f58ae6a817b28a02bcc3.tar.bz2 |
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/coda')
-rw-r--r-- | fs/coda/dir.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 6fb8672c0892..5d79c26b0484 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c @@ -291,7 +291,8 @@ static int coda_rmdir(struct inode *dir, struct dentry *de) /* rename */ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, - struct inode *new_dir, struct dentry *new_dentry) + struct inode *new_dir, struct dentry *new_dentry, + unsigned int flags) { const char *old_name = old_dentry->d_name.name; const char *new_name = new_dentry->d_name.name; @@ -299,6 +300,9 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry, int new_length = new_dentry->d_name.len; int error; + if (flags) + return -EINVAL; + error = venus_rename(old_dir->i_sb, coda_i2f(old_dir), coda_i2f(new_dir), old_length, new_length, (const char *) old_name, (const char *)new_name); @@ -569,7 +573,7 @@ const struct inode_operations coda_dir_inode_operations = { .mkdir = coda_mkdir, .rmdir = coda_rmdir, .mknod = CODA_EIO_ERROR, - .rename = coda_rename, + .rename2 = coda_rename, .permission = coda_permission, .getattr = coda_getattr, .setattr = coda_setattr, |