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/ncpfs | |
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/ncpfs')
-rw-r--r-- | fs/ncpfs/dir.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index f5b594e2457c..a2d3738df4af 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -36,7 +36,7 @@ static int ncp_unlink(struct inode *, struct dentry *); | |||
36 | static int ncp_mkdir(struct inode *, struct dentry *, umode_t); | 36 | static int ncp_mkdir(struct inode *, struct dentry *, umode_t); |
37 | static int ncp_rmdir(struct inode *, struct dentry *); | 37 | static int ncp_rmdir(struct inode *, struct dentry *); |
38 | static int ncp_rename(struct inode *, struct dentry *, | 38 | static int ncp_rename(struct inode *, struct dentry *, |
39 | struct inode *, struct dentry *); | 39 | struct inode *, struct dentry *, unsigned int); |
40 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, | 40 | static int ncp_mknod(struct inode * dir, struct dentry *dentry, |
41 | umode_t mode, dev_t rdev); | 41 | umode_t mode, dev_t rdev); |
42 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) | 42 | #if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS) |
@@ -65,7 +65,7 @@ const struct inode_operations ncp_dir_inode_operations = | |||
65 | .mkdir = ncp_mkdir, | 65 | .mkdir = ncp_mkdir, |
66 | .rmdir = ncp_rmdir, | 66 | .rmdir = ncp_rmdir, |
67 | .mknod = ncp_mknod, | 67 | .mknod = ncp_mknod, |
68 | .rename = ncp_rename, | 68 | .rename2 = ncp_rename, |
69 | .setattr = ncp_notify_change, | 69 | .setattr = ncp_notify_change, |
70 | }; | 70 | }; |
71 | 71 | ||
@@ -1105,13 +1105,17 @@ static int ncp_unlink(struct inode *dir, struct dentry *dentry) | |||
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, | 1107 | static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry, |
1108 | struct inode *new_dir, struct dentry *new_dentry) | 1108 | struct inode *new_dir, struct dentry *new_dentry, |
1109 | unsigned int flags) | ||
1109 | { | 1110 | { |
1110 | struct ncp_server *server = NCP_SERVER(old_dir); | 1111 | struct ncp_server *server = NCP_SERVER(old_dir); |
1111 | int error; | 1112 | int error; |
1112 | int old_len, new_len; | 1113 | int old_len, new_len; |
1113 | __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1]; | 1114 | __u8 __old_name[NCP_MAXPATHLEN + 1], __new_name[NCP_MAXPATHLEN + 1]; |
1114 | 1115 | ||
1116 | if (flags) | ||
1117 | return -EINVAL; | ||
1118 | |||
1115 | ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry); | 1119 | ncp_dbg(1, "%pd2 to %pd2\n", old_dentry, new_dentry); |
1116 | 1120 | ||
1117 | ncp_age_dentry(server, old_dentry); | 1121 | ncp_age_dentry(server, old_dentry); |