linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Goldwyn Rodrigues <rgoldwyn@suse.de>,
	Viacheslav Dubeyko <slava@dubeyko.com>,
	linux-fsdevel@vger.kernel.org,
	Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PoC 0/7] Kobjectify filesystem
Date: Thu, 5 May 2016 08:20:28 +1000	[thread overview]
Message-ID: <20160504222028.GY26977@dastard> (raw)
In-Reply-To: <20160429223147.GZ25498@ZenIV.linux.org.uk>

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@fromorbit.com

      parent reply	other threads:[~2016-05-04 22:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  2:01 [PoC 0/7] Kobjectify filesystem Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 1/7] Add kset to file_system_type Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 2/7] Add kobject to super_block Goldwyn Rodrigues
2016-04-29  2:26   ` Al Viro
2016-04-29 19:09     ` Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 3/7] Create sysfs files under sb Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 4/7] Report file system events Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 5/7] ocfs2: Use the sb's kset Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 6/7] ocfs2: create filecheck files Goldwyn Rodrigues
2016-04-29  2:01 ` [PoC 7/7] ocfs2: report inode errors to userspace Goldwyn Rodrigues
2016-04-29 17:32 ` [PoC 0/7] Kobjectify filesystem Viacheslav Dubeyko
2016-04-29 18:28   ` Goldwyn Rodrigues
2016-04-29 20:16     ` Viacheslav Dubeyko
2016-04-29 22:09       ` Goldwyn Rodrigues
2016-04-29 22:31     ` Al Viro
2016-04-29 22:45       ` Goldwyn Rodrigues
2016-05-04 22:20       ` Dave Chinner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160504222028.GY26977@dastard \
    --to=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    --cc=rgoldwyn@suse.de \
    --cc=slava@dubeyko.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).