linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Ian Kent <raven@themaw.net>
Cc: Brian Foster <bfoster@redhat.com>,
	linux-xfs <linux-xfs@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Dave Chinner <dchinner@redhat.com>,
	Eric Sandeen <sandeen@sandeen.net>
Subject: Re: [REPOST PATCH v3 06/16] xfs: mount-api - make xfs_parse_param() take context .parse_param() args
Date: Thu, 26 Sep 2019 04:32:10 +0100	[thread overview]
Message-ID: <20190926033210.GS26530@ZenIV.linux.org.uk> (raw)
In-Reply-To: <4ffaefd2ec14ea2379feb7aa78d8e29a872efc70.camel@themaw.net>

On Thu, Sep 26, 2019 at 10:57:48AM +0800, Ian Kent wrote:

> > Ok, so I'm not terribly familiar with the core mount code in the
> > first
> > place. Can you elaborate a bit on the where the whole "source" thing
> > comes from and why/how it's necessary to boot?

device name.  And there's nothing special about boot.

> Your not alone.
> 
> I've pondered over the VFS mount code fairly often over the years
> and I've not seen it before either.
> 
> About all I know is it's needed for rootfs, so I guess it's needed
> to resolve the boot device when no file system is yet mounted and
> a normal path walk can't be done.

Bollocks.  Absolute root is ramfs or tmpfs and we do have mknod done
there.

Root filesystem is a complete red herring.

> Maybe an additional fs_context_purpose needs to be defined, maybe
> FS_CONTEXT_FOR_ROOTFS for example.

NO.  ->purpose should go away, not be extended.  And again, that
has fuck-all to do with rootfs.

> That's probably the cleanest way to handle it, not sure it would
> properly cover the cases though.
> 
> That wouldn't be an entirely trivial change so David and Al would
> likely need to get involved and Linus would need to be willing to
> accept it.

> > BTW, this all implies there is some reason for an fs to handle the
> > "source" option, so what happens if one actually does? ISTM the
> > ->parse_param() callout would return 0 and vfs_parse_fs_param() would
> > skip its own update of fc->source. Hm?
> 
> As I understand it that's not a problem because the file system
> will need to have converted the parameter value to some "source"
> value usable by the kernel.
 
For fsck sake...  It's where the first argument of mount(2) goes.
As in, "/dev/sda4" when you say mount -t xfs /dev/sda4 /mnt
Or "10.1.1.18:/srv/nfs/mirrors" in
mount -t nfs4 10.1.1.18:/srv/nfs/mirrors /home/mirrors/public \
	 -o rsize=8192,wsize=8192,proto=tcp,ro

Note that it's not in any real sense different from any other
option - its interpretation is entirely up to fs type.  The
only reason why it's separate is historical - way, way back
there had been no filesystem types and mount(2) got just
a block device pathname + mountpoint + one flag (ro/rw).
No (string) options either.  There has been a long and nasty
history, considerably older than Linux, including such things
as magical binary structures (each for its own fs type - check
how e.g.  OSF is doing that).

But accidents of calling conventions aside, device name is just
another fs option.  And device name is a misnomer - witness
what e.g. NFS is doing.  Keeping it special for new API
was pointless, so we have this in vfs_kern_mount():
        fc = fs_context_for_mount(type, flags);
        if (IS_ERR(fc))
                return ERR_CAST(fc);

        if (name)
                ret = vfs_parse_fs_string(fc, "source",
                                          name, strlen(name));
        if (!ret)
                ret = parse_monolithic_mount_data(fc, data);  
        if (!ret)
                mnt = fc_mount(fc);
        else   
                mnt = ERR_PTR(ret);

        put_fs_context(fc); 

and sys_mount() ends up passing the first argument as 'name' to
vfs_kern_mount().  That's it - nothing more to it.

  reply	other threads:[~2019-09-26  3:32 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 13:21 [REPOST PATCH v3 00/16] xfs: mount API patch series Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 01/16] vfs: Create fs_context-aware mount_bdev() replacement Ian Kent
2019-09-24 21:33   ` Al Viro
2019-09-25  5:15     ` Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 02/16] xfs: remove very old mount option Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 03/16] xfs: mount-api - add fs parameter description Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 04/16] xfs: mount-api - refactor suffix_kstrtoint() Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 05/16] xfs: mount-api - refactor xfs_parseags() Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 06/16] xfs: mount-api - make xfs_parse_param() take context .parse_param() args Ian Kent
2019-09-24 14:37   ` Brian Foster
2019-09-25  0:20     ` Ian Kent
2019-09-25 14:33       ` Brian Foster
2019-09-26  2:57         ` Ian Kent
2019-09-26  3:32           ` Al Viro [this message]
2019-09-26  4:22           ` Ian Kent
2019-09-26  4:14   ` Al Viro
2019-09-26  7:06     ` Ian Kent
2019-09-26  7:34       ` Ian Kent
2019-09-26 13:05     ` David Howells
2019-09-24 13:22 ` [REPOST PATCH v3 07/16] xfs: mount-api - move xfs_parseargs() validation to a helper Ian Kent
2019-09-24 14:37   ` Brian Foster
2019-09-25  0:32     ` Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 08/16] xfs: mount-api - refactor xfs_fs_fill_super() Ian Kent
2019-09-24 14:38   ` Brian Foster
2019-09-24 13:22 ` [REPOST PATCH v3 09/16] xfs: mount-api - add xfs_get_tree() Ian Kent
2019-09-24 14:38   ` Brian Foster
2019-09-25  7:42     ` Ian Kent
2019-09-25  8:07       ` Ian Kent
2019-09-25 14:34         ` Brian Foster
2019-09-26  3:27           ` Ian Kent
2019-09-26 11:14             ` Brian Foster
2019-09-27  1:16               ` Ian Kent
2019-09-27 11:02                 ` Brian Foster
2019-09-24 13:22 ` [REPOST PATCH v3 10/16] xfs: mount-api - add xfs_remount_rw() helper Ian Kent
2019-09-24 13:22 ` [REPOST PATCH v3 11/16] xfs: mount-api - add xfs_remount_ro() helper Ian Kent
2019-09-24 14:38   ` Brian Foster
2019-09-25  5:19     ` Ian Kent
2019-09-24 13:23 ` [REPOST PATCH v3 12/16] xfs: mount api - add xfs_reconfigure() Ian Kent
2019-09-24 14:38   ` Brian Foster
2019-09-25  5:21     ` Ian Kent
2019-09-25 14:34       ` Brian Foster
2019-09-24 13:23 ` [REPOST PATCH v3 13/16] xfs: mount-api - add xfs_fc_free() Ian Kent
2019-09-24 13:23 ` [REPOST PATCH v3 14/16] xfs: mount-api - dont set sb in xfs_mount_alloc() Ian Kent
2019-09-24 13:23 ` [REPOST PATCH v3 15/16] xfs: mount-api - switch to new mount-api Ian Kent
2019-09-24 13:23 ` [REPOST PATCH v3 16/16] xfs: mount-api - remove legacy mount functions Ian Kent

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=20190926033210.GS26530@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=bfoster@redhat.com \
    --cc=dchinner@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=raven@themaw.net \
    --cc=sandeen@sandeen.net \
    /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).