mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Marc Aurèle La France" <tsi@tuyoix.net>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Christian Brauner" <brauner@kernel.org>,
	"David Howells" <dhowells@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] debugfs show actual source in /proc/mounts
Date: Wed, 14 Aug 2024 10:20:09 -0500	[thread overview]
Message-ID: <48c5e8bb-2f65-41ee-b9ce-f31b2997b751@redhat.com> (raw)
In-Reply-To: <2024081417-husked-unfair-172c@gregkh>

On 8/13/24 11:50 PM, Greg Kroah-Hartman wrote:
> On Tue, Aug 13, 2024 at 02:18:07PM -0500, Eric Sandeen wrote:
>> On 8/13/24 4:54 AM, Greg Kroah-Hartman wrote:
>>> On Sat, Aug 10, 2024 at 01:25:27PM -0600, Marc Aurèle La France wrote:
>>>> After its conversion to the new mount API, debugfs displays "none" in
>>>> /proc/mounts instead of the actual source.  Fix this by recognising its
>>>> "source" mount option.
>>>>
>>>> Signed-off-by: Marc Aurèle La France <tsi@tuyoix.net>
>>>> Fixes: a20971c18752 ("vfs: Convert debugfs to use the new mount API")
>>>> Cc: stable@vger.kernel.org # 6.10.x: 9f111059e725: fs_parse: add uid & gid option option parsing helpers
>>>> Cc: stable@vger.kernel.org # 6.10.x: 49abee5991e1: debugfs: Convert to new uid/gid option parsing helpers
>>>
>>> As this came from a fs tree, I'll let the vfs maintainer take it if they
>>> think it is ok as I know nothing about the fs_parse stuff at the moment,
>>> sorry.
>>
>> Hm, I guess this is OK, though it seems a little unexpected for debugfs
>> to have to parse the trivial internal "source" option.
>>
>> This actually worked OK until
>>
>> 0c07c273a5fe debugfs: continue to ignore unknown mount options
>>
>> but after that commit, debugfs claims to parse "source" successfully even
>> though it has not. So really, it Fixes: that commit, not the original
>> conversion.
>>
>> I'm not sure of a better approach offhand, but maybe a comment about why
>> Opt_source exists in debugfs would help future readers?
> 
> Why is debugfs unique here?  Why does it need to do something that
> nothing else needs to do (like sysfs or tracefs or anything else...)

It's kind of a long sad story.

Originally, debugfs took no mount options. And because it had no mount option
handling, it had nowhere to reject anything, and so any/all random options
were silently accepted and ignored.

Then mode/uid/gid mount options were added to it in 2012 with:

d6e486868cde debugfs: add mode, uid and gid options

and it continued to ignore unknown options:

+               /*
+                * We might like to report bad mount options here;
+                * but traditionally debugfs has ignored all mount options
+                */

A decade+ later, I forward-ported dhowells' mount API conversion with

a20971c18752 vfs: Convert debugfs to use the new mount API

after some discussion and agreement that we really should be rejecting
unknown options, and all seemed well until ...

https://lore.kernel.org/linux-kernel/20240527100618.np2wqiw5mz7as3vk@ninjato/T/

it was reported that busybox was (incorrectly) passing in "auto" and "noauto"
from fstab during mount, and thus failing. So, 

0c07c273a5fe debugfs: continue to ignore unknown mount options

got merged to re-allow/re-ignore all unknown options in the spirit of "don't
break userspace". All unknown options were re-ignored including, as it turns
out, "source" which then led to the current reported problem.

As for why it's different from tracefs, that's a good question. Tracefs was
cut-n-pasted from debugfs, and had the "ignore unknown options" behavior from
day one, which in retrospect was probably a mistake. And now its behavior
does differ from debugfs, but nobody has reported the busybox problem against
it, I guess. This is an inconsistency.

sysfs has no ->parse_param at all, so vfs_parse_fs_param() falls into the:

        /* If the filesystem doesn't take any arguments, give it the
         * default handling of source.
         */
        ret = vfs_parse_fs_param_source(fc, param);

case which handles the internal "source" argument just fine.

-Eric 





  reply	other threads:[~2024-08-14 15:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-10 19:25 Marc Aurèle La France
2024-08-13  9:54 ` Greg Kroah-Hartman
2024-08-13 19:18   ` Eric Sandeen
2024-08-14  4:50     ` Greg Kroah-Hartman
2024-08-14 15:20       ` Eric Sandeen [this message]
2024-08-14 15:26         ` Greg Kroah-Hartman
2024-08-19  1:29     ` Marc Aurèle La France
2024-08-30  3:44       ` Marc Aurèle La France
2024-08-30 13:38         ` Eric Sandeen
2024-08-31  3:51           ` Marc Aurèle La France

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=48c5e8bb-2f65-41ee-b9ce-f31b2997b751@redhat.com \
    --to=sandeen@redhat.com \
    --cc=brauner@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tsi@tuyoix.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

all inboxes | Powered by JetHome®