From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932294AbcHWQ3j (ORCPT ); Tue, 23 Aug 2016 12:29:39 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35368 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932203AbcHWQ3h (ORCPT ); Tue, 23 Aug 2016 12:29:37 -0400 Message-ID: <57BC79EC.1020308@gmail.com> Date: Tue, 23 Aug 2016 19:29:32 +0300 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Miklos Szeredi , linux-fsdevel@vger.kernel.org CC: linux-kernel@vger.kernel.org, Al Viro , Eric Van Hensbergen , David Howells , Ilya Dryomov , Jan Harkes , Tyler Hicks , Greg Kroah-Hartman , Oleg Drokin , Trond Myklebust , Mark Fasheh , Mike Marshall Subject: Re: [PATCH 4/7] fs: make remaining filesystems use .rename2 References: <1471961132-1675-1-git-send-email-mszeredi@redhat.com> <1471961132-1675-5-git-send-email-mszeredi@redhat.com> <57BC78C7.9040709@electrozaur.com> In-Reply-To: <57BC78C7.9040709@electrozaur.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> Cc: Eric Van Hensbergen >> Cc: David Howells >> Cc: Ilya Dryomov >> Cc: Jan Harkes >> Cc: Tyler Hicks >> Cc: Boaz Harrosh > > 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 > > <> > >> 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, >> }; >> > <> >