linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <openosd@gmail.com>
To: Miklos Szeredi <mszeredi@redhat.com>, linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Eric Van Hensbergen <ericvh@gmail.com>,
	David Howells <dhowells@redhat.com>,
	Ilya Dryomov <idryomov@gmail.com>,
	Jan Harkes <jaharkes@cs.cmu.edu>,
	Tyler Hicks <tyhicks@canonical.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Oleg Drokin <oleg.drokin@intel.com>,
	Trond Myklebust <trond.myklebust@primarydata.com>,
	Mark Fasheh <mfasheh@suse.com>,
	Mike Marshall <hubcap@omnibond.com>
Subject: Re: [PATCH 4/7] fs: make remaining filesystems use .rename2
Date: Tue, 23 Aug 2016 19:29:32 +0300	[thread overview]
Message-ID: <57BC79EC.1020308@gmail.com> (raw)
In-Reply-To: <57BC78C7.9040709@electrozaur.com>

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,
>>  };
>>  
> <>
> 

  reply	other threads:[~2016-08-23 16:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 14:05 [PATCH 0/7] vfs: finish rename -> rename2 conversion Miklos Szeredi
2016-08-23 14:05 ` [PATCH 1/7] ncpfs: fix unused variable warning Miklos Szeredi
2016-08-23 14:05 ` [PATCH 2/7] fs: support RENAME_NOREPLACE for local filesystems Miklos Szeredi
2016-08-23 21:48   ` Richard Weinberger
2016-08-25 12:52   ` Bob Copeland
2016-09-08 13:55   ` Jan Kara
2016-08-23 14:05 ` [PATCH 3/7] libfs: support RENAME_NOREPLACE in simple_rename() Miklos Szeredi
2016-08-23 14:47   ` Greg Kroah-Hartman
2016-08-23 14:05 ` [PATCH 4/7] fs: make remaining filesystems use .rename2 Miklos Szeredi
2016-08-23 14:47   ` Greg Kroah-Hartman
2016-08-23 17:30     ` Mike Marshall
2016-08-23 16:24   ` Boaz Harrosh
2016-08-23 16:29     ` Boaz Harrosh [this message]
2016-08-23 14:05 ` [PATCH 5/7] vfs: remove unused i_op->rename Miklos Szeredi
2016-08-23 14:05 ` [PATCH 6/7] fs: rename "rename2" i_op to "rename" Miklos Szeredi
2016-08-23 14:05 ` [PATCH 7/7] vfs: add note about i_op->rename changes to porting Miklos Szeredi
2016-08-23 15:36 ` [PATCH 4/7] fs: make remaining filesystems use .rename2 David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57BC79EC.1020308@gmail.com \
    --to=openosd@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=ericvh@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hubcap@omnibond.com \
    --cc=idryomov@gmail.com \
    --cc=jaharkes@cs.cmu.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=mszeredi@redhat.com \
    --cc=oleg.drokin@intel.com \
    --cc=trond.myklebust@primarydata.com \
    --cc=tyhicks@canonical.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).