From: Charalampos Mitrodimas <charmitro@posteo.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Christian Brauner <brauner@kernel.org>,
David Howells <dhowells@redhat.com>,
Eric Sandeen <sandeen@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Charalampos Mitrodimas <charmitro@posteo.net>
Subject: [PATCH] debugfs: fix mount options not being applied
Date: Mon, 04 Aug 2025 14:30:04 +0000 [thread overview]
Message-ID: <20250804-debugfs-mount-opts-v1-1-bc05947a80b5@posteo.net> (raw)
Mount options (uid, gid, mode) are silently ignored when debugfs is
mounted. This is a regression introduced during the conversion to the
new mount API.
When the mount API conversion was done, the line that sets
sb->s_fs_info to the parsed options was removed. This causes
debugfs_apply_options() to operate on a NULL pointer.
As an example, with the bug the "mode" mount option is ignored:
$ mount -o mode=0666 -t debugfs debugfs /tmp/debugfs_test
$ mount | grep debugfs_test
debugfs on /tmp/debugfs_test type debugfs (rw,relatime)
$ ls -ld /tmp/debugfs_test
drwx------ 25 root root 0 Aug 4 14:16 /tmp/debugfs_test
With the fix applied, it works as expected:
$ mount -o mode=0666 -t debugfs debugfs /tmp/debugfs_test
$ mount | grep debugfs_test
debugfs on /tmp/debugfs_test type debugfs (rw,relatime,mode=666)
$ ls -ld /tmp/debugfs_test
drw-rw-rw- 37 root root 0 Aug 2 17:28 /tmp/debugfs_test
Fix this by restoring the missing sb->s_fs_info assignment in
debugfs_fill_super() and by calling debugfs_reconfigure() in
debugfs_get_tree() to apply options when reusing an existing
superblock.
Fixes: a20971c18752 ("vfs: Convert debugfs to use the new mount API")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220406
Signed-off-by: Charalampos Mitrodimas <charmitro@posteo.net>
---
fs/debugfs/inode.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index a0357b0cf362d8ac47ff810e162402d6a8ae2cb9..ffe6402c77126b2a23beaa85160dfe578f59599c 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -275,6 +275,7 @@ static int debugfs_fill_super(struct super_block *sb, struct fs_context *fc)
set_default_d_op(sb, &debugfs_dops);
sb->s_d_flags |= DCACHE_DONTCACHE;
+ sb->s_fs_info = fc->s_fs_info;
debugfs_apply_options(sb);
return 0;
@@ -282,10 +283,15 @@ static int debugfs_fill_super(struct super_block *sb, struct fs_context *fc)
static int debugfs_get_tree(struct fs_context *fc)
{
+ int err;
+
if (!(debugfs_allow & DEBUGFS_ALLOW_API))
return -EPERM;
- return get_tree_single(fc, debugfs_fill_super);
+ err = get_tree_single(fc, debugfs_fill_super);
+ if (!err)
+ err = debugfs_reconfigure(fc);
+ return err;
}
static void debugfs_free_fc(struct fs_context *fc)
---
base-commit: 3c4a063b1f8ab71352df1421d9668521acb63cd9
change-id: 20250804-debugfs-mount-opts-2a68d7741f05
Best regards,
--
Charalampos Mitrodimas <charmitro@posteo.net>
next reply other threads:[~2025-08-04 14:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 14:30 Charalampos Mitrodimas [this message]
2025-08-04 16:48 ` Greg Kroah-Hartman
2025-08-04 17:22 ` Eric Sandeen
2025-08-05 17:03 ` Eric Sandeen
2025-08-05 17:22 ` Charalampos Mitrodimas
2025-08-06 16:33 ` Eric Sandeen
2025-08-08 14:13 ` Christian Brauner
2025-08-13 22:02 ` Eric Sandeen
2025-08-13 23:49 ` Charalampos Mitrodimas
2025-08-14 9:05 ` Aleksa Sarai
2025-08-14 13:47 ` Aleksa Sarai
2025-08-14 16:46 ` Eric Sandeen
2025-08-15 0:31 ` Aleksa Sarai
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=20250804-debugfs-mount-opts-v1-1-bc05947a80b5@posteo.net \
--to=charmitro@posteo.net \
--cc=brauner@kernel.org \
--cc=dakr@kernel.org \
--cc=dhowells@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sandeen@redhat.com \
/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®