mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-27 10:39:02 -04:00
Pull misc vfs updates from Christian Brauner:
"Bigger cleanups:
- The lockref dead-count handling is tidied up.
The open-coded check for a count below zero as the dead marker
relies on information the caller should not have.
- make put_mnt_ns() leave mounts connected. Destroying a mount
namespace disconnected its mounts from their mount points. So a
file descriptor still open on the parent of a mount point could be
used to peek under it.
Locked mounts were already kept connected to prevent exactly that.
But a mount is only locked when its tree is copied across a user
namespace boundary. So a mount namespace set up by a privileged
component had no locked mounts and its mounts were disconnected.
Passing UMOUNT_CONNECTED keeps every mount connected and prevents
that bug.
- vfs_prepare_mode() passes S_IFDIR for directories. I meant to fix
that ago but didn't get to it. So now someone finally did it.
This kills the exception where the mode could be 0 when a directory
was created whereas every other creation operation passed it
explicitly already.
- move long delayed work for ufs, jffs2, hfsplus, hfs and affs from
the per-cpu system_long_wq to the new unbound system_dfl_long_wq.
None of that work relies on per-cpu state and the work item is
enqueued with queue_delayed_work() whose timer is global anyway. So
it may as well benefit from scheduler task placement.
Smaller fixes and cleanups:
- unlock_buffer() and journal_end_buffer_io_sync() use
clear_and_wake_up_bit()
- the pipe page pools are unified into a single per-pipe pool and the
extra wake_up(rd_wait) is limited to EPOLLET consumers
- eventpoll now computes its timer slack lazily in ep_poll()
- shrink_dcache_for_umount() keeps making progress on busy roots
- excess xarray nodes are freed in clear_inode()
- romfs detects hard link cycles
- the user path of nested backing files is fixed
- pidfd holds exec_update_lock around the namespace ioctl
- non-memcg-aware nr_cached_objects is skipped during memcg slab
shrink
- iomap_write_iter() always returns status
- mangle_path() is renamed to seq_mangle_path()
- inode timestamp accessors are annotated
- new regression test for pipe->poll_usage.
- a few documentation, kernel-doc and selftest fixes"
* tag 'vfs-7.3-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (67 commits)
selftests/namespaces: Fix racy pipe handshake in timens and pidns_separate
selftests/epoll: add a regression test for pipe->poll_usage
pipe: only enable the extra wake_up(rd_wait) for EPOLLET consumers
pidfd: hold exec_update_lock around namespace ioctl
fs: fix user path of nested backing files
fs: remove stale inode_insert5() kernel-doc parameter
fs: fix switch/case indentation in sysfs() syscall
fs: document semantics of kstat::{uid,gid} fields
dcache: keep shrink_dcache_for_umount() making progress on busy roots
seq_file: rename mangle_path to seq_mangle_path
nstree: add/fix struct ns_id_req kernel-doc member fields
dcache: use lockref routines for dead count checks
lockref: tidy up dead count handling
initramfs: fix typo in reserve_initrd_mem comment
fs/pipe: unify the page pools into a single per-pipe pool
fs: annotate inode timestamp accessors
eventpoll: compute timer slack lazily in ep_poll()
selftests/filesystems: add mntns cleanup test
put_mnt_ns(): leave mounts connected
affs: Move long delayed work on system_dfl_long_wq
...
67 lines
1.5 KiB
C
67 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/* Copyright (c) 2026 Christian Brauner <brauner@kernel.org> */
|
|
#include <linux/fs/super_types.h>
|
|
#include <linux/fs_context.h>
|
|
#include <linux/magic.h>
|
|
|
|
#include "mount.h"
|
|
|
|
static const struct super_operations nullfs_super_operations = {
|
|
.statfs = simple_statfs,
|
|
};
|
|
|
|
static int nullfs_fs_fill_super(struct super_block *s, struct fs_context *fc)
|
|
{
|
|
struct inode *inode;
|
|
|
|
s->s_maxbytes = MAX_LFS_FILESIZE;
|
|
s->s_blocksize = PAGE_SIZE;
|
|
s->s_blocksize_bits = PAGE_SHIFT;
|
|
s->s_magic = NULL_FS_MAGIC;
|
|
s->s_op = &nullfs_super_operations;
|
|
s->s_export_op = NULL;
|
|
s->s_xattr = NULL;
|
|
s->s_time_gran = 1;
|
|
s->s_d_flags = 0;
|
|
|
|
inode = new_inode(s);
|
|
if (!inode)
|
|
return -ENOMEM;
|
|
|
|
/* nullfs is permanently empty... */
|
|
make_empty_dir_inode(inode);
|
|
simple_inode_init_ts(inode);
|
|
inode->i_ino = 1;
|
|
/* ... and immutable. */
|
|
inode->i_flags |= S_IMMUTABLE;
|
|
|
|
s->s_root = d_make_root(inode);
|
|
if (!s->s_root)
|
|
return -ENOMEM;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int nullfs_fs_get_tree(struct fs_context *fc)
|
|
{
|
|
return get_tree_nodev(fc, nullfs_fs_fill_super);
|
|
}
|
|
|
|
static const struct fs_context_operations nullfs_fs_context_ops = {
|
|
.get_tree = nullfs_fs_get_tree,
|
|
};
|
|
|
|
static int nullfs_init_fs_context(struct fs_context *fc)
|
|
{
|
|
fc->ops = &nullfs_fs_context_ops;
|
|
fc->sb_flags |= SB_NOUSER;
|
|
fc->s_iflags |= SB_I_NOEXEC | SB_I_NODEV;
|
|
return 0;
|
|
}
|
|
|
|
struct file_system_type nullfs_fs_type = {
|
|
.name = "nullfs",
|
|
.init_fs_context = nullfs_init_fs_context,
|
|
.kill_sb = kill_anon_super,
|
|
};
|