Re: [PATCH] dcache: remove unnecessary NULL check in dget_dlock()

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

 



On Sun, Oct 22, 2023 at 06:45:20PM +0200, Vegard Nossum wrote:

> @@ -1707,7 +1701,7 @@ static enum d_walk_ret find_submount(void *_data, struct dentry *dentry)
>  {
>  	struct dentry **victim = _data;
>  	if (d_mountpoint(dentry)) {
> -		__dget_dlock(dentry);
> +		dget_dlock(dentry);
>  		*victim = dentry;

		*victim = dget_dlock(dentry);

>  		return D_WALK_QUIT;
>  	}
> @@ -1853,7 +1847,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
>  	 * don't need child lock because it is not subject
>  	 * to concurrency here
>  	 */
> -	__dget_dlock(parent);
> +	dget_dlock(parent);
>  	dentry->d_parent = parent;

	dentry->d_parent = dget_dlock(parent);

> - *	Given a dentry or %NULL pointer increment the reference count
> - *	if appropriate and return the dentry. A dentry will not be 
> - *	destroyed when it has references.
> + *	Given a dentry, increment the reference count and return the
> + *	dentry.
> + *
> + *	Context: @dentry->d_lock must be held.

... and dentry must be alive.  There are many ways the caller could
use to guarantee that - any of the "it's hashed", "it's positive",
"its ->d_lockref.count is not negative" would suffice under ->d_lock.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux