mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Acked-by: David Howells <[email protected]> [AFS] Acked-by: Mike Marshall <[email protected]> Cc: Eric Van Hensbergen <[email protected]> Cc: Ilya Dryomov <[email protected]> Cc: Jan Harkes <[email protected]> Cc: Tyler Hicks <[email protected]> Cc: Oleg Drokin <[email protected]> Cc: Trond Myklebust <[email protected]> Cc: Mark Fasheh <[email protected]>
This commit is contained in:
parent
e0e0be8a83
commit
1cd66c93ba
17 changed files with 78 additions and 31 deletions
|
|
@ -1061,7 +1061,8 @@ out:
|
|||
}
|
||||
|
||||
static int ceph_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)
|
||||
{
|
||||
struct ceph_fs_client *fsc = ceph_sb_to_client(old_dir->i_sb);
|
||||
struct ceph_mds_client *mdsc = fsc->mdsc;
|
||||
|
|
@ -1069,6 +1070,9 @@ static int ceph_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
int op = CEPH_MDS_OP_RENAME;
|
||||
int err;
|
||||
|
||||
if (flags)
|
||||
return -EINVAL;
|
||||
|
||||
if (ceph_snap(old_dir) != ceph_snap(new_dir))
|
||||
return -EXDEV;
|
||||
if (ceph_snap(old_dir) != CEPH_NOSNAP) {
|
||||
|
|
@ -1498,7 +1502,7 @@ const struct inode_operations ceph_dir_iops = {
|
|||
.link = ceph_link,
|
||||
.unlink = ceph_unlink,
|
||||
.rmdir = ceph_unlink,
|
||||
.rename = ceph_rename,
|
||||
.rename2 = ceph_rename,
|
||||
.create = ceph_create,
|
||||
.atomic_open = ceph_atomic_open,
|
||||
};
|
||||
|
|
@ -1509,7 +1513,7 @@ const struct inode_operations ceph_snapdir_iops = {
|
|||
.getattr = ceph_getattr,
|
||||
.mkdir = ceph_mkdir,
|
||||
.rmdir = ceph_unlink,
|
||||
.rename = ceph_rename,
|
||||
.rename2 = ceph_rename,
|
||||
};
|
||||
|
||||
const struct dentry_operations ceph_dentry_ops = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue