Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1468690

Re: [PATCH 4/7] fs: make remaining filesystems use .rename2

From Boaz Harrosh <openosd@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/7] fs: make remaining filesystems use .rename2
Date 2016-08-23 18:30 +0200
Message-ID <s9mKm-6om-29@gated-at.bofh.it> (permalink)
References <s9kyS-52F-33@gated-at.bofh.it> <s9kIx-563-3@gated-at.bofh.it> <s9mKl-6om-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 08/23/2016 07:24 PM, Boaz Harrosh wrote:
> On 08/23/2016 05:05 PM, Miklos Szeredi wrote:
>> 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, exofs, 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>
>> Cc: Eric Van Hensbergen <ericvh@gmail.com>
>> Cc: David Howells <dhowells@redhat.com>
>> Cc: Ilya Dryomov <idryomov@gmail.com>
>> Cc: Jan Harkes <jaharkes@cs.cmu.edu>
>> Cc: Tyler Hicks <tyhicks@canonical.com>
>> Cc: Boaz Harrosh <ooo@electrozaur.com>
> 
> Hi exofs is not a distributed file system in the nfs-client 
> sense. All meta-data operations happen on the single exofs mount.
> The distribution of an exofs cluster is done by an NFSD-like daemon
> that supports pNFS, and an std pNFS-client.
> So the code you see below is just the same as an ext4 FS with
> a raid of iscsi devices below it. (Even if then later this FS is
> exported by an NFSD server)
> 
> That said it is fine as is don't sweat over this unused FS so:
> ACK-by: Boaz Harrosh <ooo@electrozaur.com>
> 
> <>
> 
>> diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c
>> index 622a686bb08b..897280163f3c 100644
>> --- a/fs/exofs/namei.c
>> +++ b/fs/exofs/namei.c
>> @@ -227,7 +227,8 @@ static int exofs_rmdir(struct inode *dir, struct dentry *dentry)
>>  }
>>  
>>  static int exofs_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 inode *old_inode = d_inode(old_dentry);
>>  	struct inode *new_inode = d_inode(new_dentry);
>> @@ -237,6 +238,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry,
>>  	struct exofs_dir_entry *old_de;
>>  	int err = -ENOENT;
>>  
>> +	if (flags)
>> +		return -EINVAL;
>> +

+	if (flags & ~RENAME_NOREPLACE)
+		return -EINVAL;
+

And move to the other patch if you feel like it

>>  	old_de = exofs_find_entry(old_dir, old_dentry, &old_page);
>>  	if (!old_de)
>>  		goto out;
>> @@ -310,7 +314,7 @@ const struct inode_operations exofs_dir_inode_operations = {
>>  	.mkdir  	= exofs_mkdir,
>>  	.rmdir  	= exofs_rmdir,
>>  	.mknod  	= exofs_mknod,
>> -	.rename 	= exofs_rename,
>> +	.rename2	= exofs_rename,
>>  	.setattr	= exofs_setattr,
>>  };
>>  
> <>
> 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 4/7] fs: make remaining filesystems use .rename2 Miklos Szeredi <mszeredi@redhat.com> - 2016-08-23 16:20 +0200
  Re: [PATCH 4/7] fs: make remaining filesystems use .rename2 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-23 16:50 +0200
    Re: [PATCH 4/7] fs: make remaining filesystems use .rename2 Mike Marshall <hubcap@omnibond.com> - 2016-08-23 19:40 +0200
  Re: [PATCH 4/7] fs: make remaining filesystems use .rename2 David Howells <dhowells@redhat.com> - 2016-08-23 17:50 +0200
  Re: [PATCH 4/7] fs: make remaining filesystems use .rename2 Boaz Harrosh <ooo@electrozaur.com> - 2016-08-23 18:30 +0200
    Re: [PATCH 4/7] fs: make remaining filesystems use .rename2 Boaz Harrosh <openosd@gmail.com> - 2016-08-23 18:30 +0200

csiph-web