Re: [PoC 0/7] Kobjectify filesystem

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

 



On Fri, Apr 29, 2016 at 11:31:48PM +0100, Al Viro wrote:
> On Fri, Apr 29, 2016 at 01:28:00PM -0500, Goldwyn Rodrigues wrote:
> 
> > Yes, you can register any attribute to sysfs, and most filesystems
> > are doing exactly that. They maintain the kobject in their
> > <fs>_super_block struct and use it to create /sys/fs/<fstype>/<id>
> > entries. So what I propose is this:
>
> [snip]
> 
> What's really missing here is
> 
> 0. carefully audit the existing sysfs users of that sort - they are _very_
> easy to get wrong, especially wrt lifetime issues and locking.  As you have
> demonstrated yourself in this patchset, BTW...

They don't screw with superblock lifetimes for this very reason.

On the XFS side, we create the kset object for /sys/fs/xfs in the
XFs module init function, and destroy it in the module exit
function. There are also some "global" sysfs objects
created/destroyed under /sys/fs/xfs at the same time.

The per-superblock objects (e.g. /sys/fs/xfs/<dev>/*) are created
inside the struct xfs_mount, which means their life cycle is
maintained inside the life of the struct superblock. i.e. they are
created inside ->fill_super, and removal (and removal completion)
occurs inside ->put_super and hence have no impact on or control
over the superblock life cycle.

ext4 has the same structure of init and teardown, as does btrfs
(though it identifies mounted filesystems by uuid rather than device
names).

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



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