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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
>> Cc: Eric Van Hensbergen <ericvh@xxxxxxxxx>
>> Cc: David Howells <dhowells@xxxxxxxxxx>
>> Cc: Ilya Dryomov <idryomov@xxxxxxxxx>
>> Cc: Jan Harkes <jaharkes@xxxxxxxxxx>
>> Cc: Tyler Hicks <tyhicks@xxxxxxxxxxxxx>
>> Cc: Boaz Harrosh <ooo@xxxxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxxx>
> 
> <>
> 
>> 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,
>>  };
>>  
> <>
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux