aboutsummaryrefslogtreecommitdiffstats
path: root/fs/afs/dir.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-09-27 05:03:58 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2016-09-27 05:03:58 -0400
commit1cd66c93ba8cdb873258f58ae6a817b28a02bcc3 (patch)
treef9a1f49b000c9959c5b278eae175b996ade3a7cd /fs/afs/dir.c
parente0e0be8a835520e2f7c89f214dfda570922a1b90 (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/afs/dir.c')
-rw-r--r--fs/afs/dir.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/afs/dir.c b/fs/afs/dir.c
index eba541004d90..381b7d0b6751 100644
--- a/fs/afs/dir.c
+++ b/fs/afs/dir.c
@@ -38,7 +38,8 @@ static int afs_link(struct dentry *from, struct inode *dir,
38static int afs_symlink(struct inode *dir, struct dentry *dentry, 38static int afs_symlink(struct inode *dir, struct dentry *dentry,
39 const char *content); 39 const char *content);
40static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, 40static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
41 struct inode *new_dir, struct dentry *new_dentry); 41 struct inode *new_dir, struct dentry *new_dentry,
42 unsigned int flags);
42 43
43const struct file_operations afs_dir_file_operations = { 44const struct file_operations afs_dir_file_operations = {
44 .open = afs_dir_open, 45 .open = afs_dir_open,
@@ -56,7 +57,7 @@ const struct inode_operations afs_dir_inode_operations = {
56 .symlink = afs_symlink, 57 .symlink = afs_symlink,
57 .mkdir = afs_mkdir, 58 .mkdir = afs_mkdir,
58 .rmdir = afs_rmdir, 59 .rmdir = afs_rmdir,
59 .rename = afs_rename, 60 .rename2 = afs_rename,
60 .permission = afs_permission, 61 .permission = afs_permission,
61 .getattr = afs_getattr, 62 .getattr = afs_getattr,
62 .setattr = afs_setattr, 63 .setattr = afs_setattr,
@@ -1083,12 +1084,16 @@ error:
1083 * rename a file in an AFS filesystem and/or move it between directories 1084 * rename a file in an AFS filesystem and/or move it between directories
1084 */ 1085 */
1085static int afs_rename(struct inode *old_dir, struct dentry *old_dentry, 1086static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
1086 struct inode *new_dir, struct dentry *new_dentry) 1087 struct inode *new_dir, struct dentry *new_dentry,
1088 unsigned int flags)
1087{ 1089{
1088 struct afs_vnode *orig_dvnode, *new_dvnode, *vnode; 1090 struct afs_vnode *orig_dvnode, *new_dvnode, *vnode;
1089 struct key *key; 1091 struct key *key;
1090 int ret; 1092 int ret;
1091 1093
1094 if (flags)
1095 return -EINVAL;
1096
1092 vnode = AFS_FS_I(d_inode(old_dentry)); 1097 vnode = AFS_FS_I(d_inode(old_dentry));
1093 orig_dvnode = AFS_FS_I(old_dir); 1098 orig_dvnode = AFS_FS_I(old_dir);
1094 new_dvnode = AFS_FS_I(new_dir); 1099 new_dvnode = AFS_FS_I(new_dir);