mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 06:32:08 +00: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 <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>
This commit is contained in:
parent
e0e0be8a83
commit
1cd66c93ba
17 changed files with 78 additions and 31 deletions
|
@ -1096,13 +1096,17 @@ static int kernfs_iop_rmdir(struct inode *dir, struct dentry *dentry)
|
|||
}
|
||||
|
||||
static int kernfs_iop_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 kernfs_node *kn = old_dentry->d_fsdata;
|
||||
struct kernfs_node *new_parent = new_dir->i_private;
|
||||
struct kernfs_syscall_ops *scops = kernfs_root(kn)->syscall_ops;
|
||||
int ret;
|
||||
|
||||
if (flags)
|
||||
return -EINVAL;
|
||||
|
||||
if (!scops || !scops->rename)
|
||||
return -EPERM;
|
||||
|
||||
|
@ -1133,7 +1137,7 @@ const struct inode_operations kernfs_dir_iops = {
|
|||
|
||||
.mkdir = kernfs_iop_mkdir,
|
||||
.rmdir = kernfs_iop_rmdir,
|
||||
.rename = kernfs_iop_rename,
|
||||
.rename2 = kernfs_iop_rename,
|
||||
};
|
||||
|
||||
static struct kernfs_node *kernfs_leftmost_descendant(struct kernfs_node *pos)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue