* [PATCH] fs: fix ups and tidy ups to /proc/filesystems caching
@ 2026-06-10 14:39 Mateusz Guzik
2026-06-12 12:26 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Guzik @ 2026-06-10 14:39 UTC (permalink / raw)
To: brauner
Cc: viro, jack, linux-kernel, linux-fsdevel, adobriyan, cuiyunhui,
Mateusz Guzik
- add missing unlocks in some corner cases
- whitespace touch ups
- s/smp_store_release/rcu_assign_pointer/ [nop, the macro expands to the same thing]
- mark file_systems_string as __read_mostly
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
Preferably this will get folded into the patch which introduces caching
to begin with, I'm posting a "full patch" just in case a separate entry
is preferred.
fs/filesystems.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/fs/filesystems.c b/fs/filesystems.c
index 771fc31a69b8..673a03b5f32b 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -54,7 +54,7 @@ struct file_systems_string {
};
static unsigned long file_systems_gen;
-static struct file_systems_string __rcu *file_systems_string;
+static struct file_systems_string __read_mostly __rcu *file_systems_string;
static void invalidate_filesystems_string(void);
#else
@@ -269,7 +269,7 @@ static __cold noinline int regen_filesystems_string(void)
hlist_for_each_entry_rcu(p, &file_systems, list) {
if (!(p->fs_flags & FS_REQUIRES_DEV))
newlen += strlen("nodev");
- newlen += strlen("\t") + strlen(p->name) + strlen("\n");
+ newlen += strlen("\t") + strlen(p->name) + strlen("\n");
}
spin_unlock(&file_systems_lock);
@@ -289,6 +289,7 @@ static __cold noinline int regen_filesystems_string(void)
* Did someone beat us to it?
*/
if (old && old->gen == file_systems_gen) {
+ spin_unlock(&file_systems_lock);
kfree(new);
return 0;
}
@@ -297,6 +298,7 @@ static __cold noinline int regen_filesystems_string(void)
* Did the list change in the meantime?
*/
if (gen != file_systems_gen) {
+ spin_unlock(&file_systems_lock);
kfree(new);
goto retry;
}
@@ -321,15 +323,11 @@ static __cold noinline int regen_filesystems_string(void)
* generation above and messes it up.
*/
spin_unlock(&file_systems_lock);
- if (old)
- kfree_rcu(old, rcu);
+ kfree(new);
return -EINVAL;
}
- /*
- * Paired with consume fence in READ_ONCE() in filesystems_proc_show()
- */
- smp_store_release(&file_systems_string, new);
+ rcu_assign_pointer(file_systems_string, new);
spin_unlock(&file_systems_lock);
if (old)
kfree_rcu(old, rcu);
--
2.48.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] fs: fix ups and tidy ups to /proc/filesystems caching
2026-06-10 14:39 [PATCH] fs: fix ups and tidy ups to /proc/filesystems caching Mateusz Guzik
@ 2026-06-12 12:26 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2026-06-12 12:26 UTC (permalink / raw)
To: Mateusz Guzik
Cc: Christian Brauner, viro, jack, linux-kernel, linux-fsdevel,
adobriyan, cuiyunhui
On Wed, 10 Jun 2026 16:39:54 +0200, Mateusz Guzik wrote:
> - add missing unlocks in some corner cases
> - whitespace touch ups
> - s/smp_store_release/rcu_assign_pointer/ [nop, the macro expands to the same thing]
> - mark file_systems_string as __read_mostly
Applied to the vfs-7.2.procfs branch of the vfs/vfs.git tree.
Patches in the vfs-7.2.procfs branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-7.2.procfs
[1/1] fs: fix ups and tidy ups to /proc/filesystems caching
https://git.kernel.org/vfs/vfs/c/cf30ceccfaec
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-12 12:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 14:39 [PATCH] fs: fix ups and tidy ups to /proc/filesystems caching Mateusz Guzik
2026-06-12 12:26 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox