lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250213040931.GU1977892@ZenIV>
Date: Thu, 13 Feb 2025 04:09:31 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: NeilBrown <neilb@...e.de>
Cc: Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Jeff Layton <jlayton@...nel.org>,
	Dave Chinner <david@...morbit.com>, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 19/19] nfs: switch to _async for all directory ops.

On Thu, Feb 13, 2025 at 03:51:16AM +0000, Al Viro wrote:
> On Thu, Feb 06, 2025 at 04:42:56PM +1100, NeilBrown wrote:
> >  nfs_sillyrename(struct inode *dir, struct dentry *dentry)
> >  {
> >  	static unsigned int sillycounter;
> > @@ -447,7 +451,8 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
> >  	struct dentry *sdentry;
> >  	struct inode *inode = d_inode(dentry);
> >  	struct rpc_task *task;
> > -	int            error = -EBUSY;
> > +	struct dentry *base;
> > +	int error = -EBUSY;
> >  
> >  	dfprintk(VFS, "NFS: silly-rename(%pd2, ct=%d)\n",
> >  		dentry, d_count(dentry));
> > @@ -461,10 +466,11 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
> >  
> >  	fileid = NFS_FILEID(d_inode(dentry));
> >  
> > +	base = d_find_alias(dir);
> 
> Huh?  That would better be dentry->d_parent and all operations are in
> that directory, so you don't even need to grab a reference...
> 
> >  	sdentry = NULL;
> >  	do {
> >  		int slen;
> > -		dput(sdentry);
> > +
> >  		sillycounter++;
> >  		slen = scnprintf(silly, sizeof(silly),
> >  				SILLYNAME_PREFIX "%0*llx%0*x",
> > @@ -474,14 +480,19 @@ nfs_sillyrename(struct inode *dir, struct dentry *dentry)
> >  		dfprintk(VFS, "NFS: trying to rename %pd to %s\n",
> >  				dentry, silly);
> >  
> > -		sdentry = lookup_one_len(silly, dentry->d_parent, slen);
> > -		/*
> > -		 * N.B. Better to return EBUSY here ... it could be
> > -		 * dangerous to delete the file while it's in use.
> > -		 */
> > -		if (IS_ERR(sdentry))
> > -			goto out;
> > -	} while (d_inode(sdentry) != NULL); /* need negative lookup */
> > +		sdentry = lookup_and_lock_one(NULL, silly, slen,
> > +					      base,
> > +					      LOOKUP_CREATE | LOOKUP_EXCL
> > +					      | LOOKUP_RENAME_TARGET
> > +					      | LOOKUP_PARENT_LOCKED);
> > +	} while (PTR_ERR_OR_ZERO(sdentry) == -EEXIST); /* need negative lookup */
> 
> What's wrong with sdentry == ERR_PTR(-EEXIST)?

BTW, do you need to mess with NFS_DATA_BLOCKED with that thing in place?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ