Re: [PATCH 6/7] kernfs: Allow kernfs nodes to be deactivated and re-activated

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

 



Hello,

On Tue, Aug 23, 2022 at 01:49:07PM +0800, Chengming Zhou wrote:
> > -		if (pos->flags & KERNFS_ACTIVATED)
> > +		if (kernfs_active(pos) || (kn->flags & KERNFS_REMOVING))
> 
> May I ask a question, what's the difference between kernfs_active() and KERNFS_ACTIVATED?
> 
> KERNFS_ACTIVATED is always set when kernfs_activate() and never clear, so I think it means:
> 
> 1. !KERNFS_ACTIVATED : allocated but not activated
> 2. KERNFS_ACTIVATED && !kernfs_active() : make deactivated by kernfs_deactivate_locked()
> 
> I see most code check kernfs_active(), but two places check KERNFS_ACTIVATED, I'm not sure where
> should check KERNFS_ACTIVATED, or is there any chance we can remove KERNFS_ACTIVATED?

Yeah, ACTIVATED means taht created but never activated while kernfs_active()
means currently active. I tried to substitute all ACTIVATED tests with
kernfs_active() and remove the former but I wasn't sure about changing
kernfs_add_one() behavior.

I think it's too confusing to combine the initial activated state with
user-requested show/hide state and causes other problems like
kernfs_activate() used to activate newly created files unhiding files
explicitly deactivated. Lemme separate out show/hide state into something
separate so that the distinction is clear.

Thanks.

-- 
tejun



[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