Re: [RFC] weird use of dget_parent() in xfs_filestream_get_parent()

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

 



On Mon, Mar 24, 2025 at 09:52:15PM +0000, Al Viro wrote:
> 1) dget_parent(dentry) never returns NULL; if you have IS_ROOT(dentry) you
> get an equivalent of dget(dentry).  What do you want returned in that
> case?

xfs_filestream_get_parent is only called for regular files.  IS_ROOT can
probably only happen for partially connected trees on nfs exports, in which
case we'd want NULL;

> 
> 2) why bother with dget_parent() in the first place?  What's wrong with
> 	spin_lock(&dentry->d_lock); // stabilizes ->d_parent
>         dir = igrab(dentry->d_parent->d_inode);
> 	spin_unlock(&dentry->d_lock);
> 
> or, if you intended NULL for root, 
> 	spin_lock(&dentry->d_lock); // stabilizes ->d_parent
> 	if (!IS_ROOT(dentry))
> 		dir = igrab(dentry->d_parent->d_inode);
> 	spin_unlock(&dentry->d_lock);
> 
> 
> Is there anything subtle I'm missing here?

Nothing really, except that this probably feelt like poking a bit too
much into internals.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux