[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240316235717.GI538574@ZenIV>
Date: Sat, 16 Mar 2024 23:57:17 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Jeff Layton <jlayton@...nel.org>
Cc: Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Chuck Lever <chuck.lever@...cle.com>,
Alexander Aring <alex.aring@...il.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>, Steve French <sfrench@...ba.org>,
Paulo Alcantara <pc@...guebit.com>,
Ronnie Sahlberg <ronniesahlberg@...il.com>,
Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey <tom@...pey.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
David Howells <dhowells@...hat.com>, Tyler Hicks <code@...icks.com>,
Neil Brown <neilb@...e.de>, Olga Kornievskaia <kolga@...app.com>,
Dai Ngo <Dai.Ngo@...cle.com>, Miklos Szeredi <miklos@...redi.hu>,
Amir Goldstein <amir73il@...il.com>,
Namjae Jeon <linkinjeon@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-nfs@...r.kernel.org, linux-cifs@...r.kernel.org,
samba-technical@...ts.samba.org, netfs@...ts.linux.dev,
ecryptfs@...r.kernel.org, linux-unionfs@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH RFC 03/24] vfs: add try_break_deleg calls for parents to
vfs_{link,rename,unlink}
On Fri, Mar 15, 2024 at 12:52:54PM -0400, Jeff Layton wrote:
> @@ -4603,9 +4606,12 @@ int vfs_link(struct dentry *old_dentry, struct mnt_idmap *idmap,
> else if (max_links && inode->i_nlink >= max_links)
> error = -EMLINK;
> else {
> - error = try_break_deleg(inode, delegated_inode);
> - if (!error)
> - error = dir->i_op->link(old_dentry, dir, new_dentry);
> + error = try_break_deleg(dir, delegated_inode);
> + if (!error) {
> + error = try_break_deleg(inode, delegated_inode);
> + if (!error)
> + error = dir->i_op->link(old_dentry, dir, new_dentry);
> + }
A minor nit: that might be easier to follow as
error = try_break_deleg(dir, delegated_inode);
if (!error)
error = try_break_deleg(inode, delegated_inode);
if (!error)
error = dir->i_op->link(old_dentry, dir, new_dentry);
and let the compiler deal with optimizing it - any C compiler is going to be
able to figure out that one out. vfs_link() is a mix of those styles anyway -
we have
if (!error && (inode->i_state & I_LINKABLE)) {
spin_lock(&inode->i_lock);
inode->i_state &= ~I_LINKABLE;
spin_unlock(&inode->i_lock);
}
immediately afterwards; might as well make that consistent, especially since
you are getting more shallow nesting that way.
Powered by blists - more mailing lists