]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
10 days agoio_uring/zcrx: check unsupported flags on import
Pavel Begunkov [Sun, 15 Feb 2026 21:29:12 +0000 (21:29 +0000)] 
io_uring/zcrx: check unsupported flags on import

The imoorted zcrx registration path checks for ZCRX_REG_IMPORT, as it
should, but doesn't reject any unsupported flags. Fix that.

Cc: stable@vger.kernel.org
Fixes: 00d91481279fb ("io_uring/zcrx: share an ifq between rings")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
11 days agoio_uring/zcrx: fix post open error handling
Pavel Begunkov [Sat, 14 Feb 2026 22:20:47 +0000 (22:20 +0000)] 
io_uring/zcrx: fix post open error handling

Closing a queue doesn't guarantee that all associated page pools are
terminated right away, let the refcounting do the work instead of
releasing the zcrx ctx directly.

Cc: stable@vger.kernel.org
Fixes: e0793de24a9f6 ("io_uring/zcrx: set pp memory provider for an rx queue")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
11 days agoio_uring/zcrx: fix sgtable leak on mapping failures
Pavel Begunkov [Sat, 14 Feb 2026 22:19:32 +0000 (22:19 +0000)] 
io_uring/zcrx: fix sgtable leak on mapping failures

In an unlikely case when io_populate_area_dma() fails, which could only
happen on a PAGE_POOL_32BIT_ARCH_WITH_64BIT_DMA machine,
io_zcrx_map_area() will have an initialised and not freed table. It was
supposed to be cleaned up in the error path, but !is_mapped prevents
that.

Fixes: 439a98b972fbb ("io_uring/zcrx: deduplicate area mapping")
Cc: stable@vger.kernel.org
Reported-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoio_uring: use the right type for creds iteration
Jens Axboe [Thu, 12 Feb 2026 02:47:38 +0000 (19:47 -0700)] 
io_uring: use the right type for creds iteration

In io_ring_ctx_wait_and_kill(), struct creds *creds is used to
iterate and prune credentials. But the correct type is struct cred.
This doesn't matter as the variable isn't used at all, only the index
is used. But it's confusing using a type that isn't valid, so fix it
up.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoio_uring/openclose: fix io_pipe_fixed() slot tracking for specific slots
Jens Axboe [Wed, 11 Feb 2026 22:12:13 +0000 (15:12 -0700)] 
io_uring/openclose: fix io_pipe_fixed() slot tracking for specific slots

__io_fixed_fd_install() returns 0 on success for non-alloc mode
(specific slot), not the slot index. io_pipe_fixed() used this return
value directly as the slot index in fds[], which can cause the reported
values returned via copy_to_user() to be incorrect, or the error path
operating on the incorrect direct descriptor.

Fix by computing the actual 0-based slot index (slot - 1) for specific
slot mode, while preserving the existing behavior for auto-alloc mode
where __io_fixed_fd_install() already returns the allocated index.

Cc: stable@vger.kernel.org
Fixes: 53db8a71ecb4 ("io_uring: add support for IORING_OP_PIPE")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoio_uring/filetable: clamp alloc_hint to the configured alloc range
Jens Axboe [Wed, 11 Feb 2026 22:12:03 +0000 (15:12 -0700)] 
io_uring/filetable: clamp alloc_hint to the configured alloc range

Explicit fixed file install/remove operations on slots outside the
configured alloc range can corrupt alloc_hint via io_file_bitmap_set()
and io_file_bitmap_clear(), which unconditionally update alloc_hint to
the bit position. This causes subsequent auto-allocations to fall
outside the configured range.

For example, if the alloc range is [10, 20) and a file is removed at
slot 2, alloc_hint gets set to 2. The next auto-alloc then starts
searching from slot 2, potentially returning a slot below the range.

Fix this by clamping alloc_hint to [file_alloc_start, file_alloc_end)
at the top of io_file_bitmap_get() before starting the search.

Cc: stable@vger.kernel.org
Fixes: 6e73dffbb93c ("io_uring: let to set a range for file slot allocation")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoio_uring/rsrc: replace reg buffer bit field with flags
Pavel Begunkov [Mon, 9 Feb 2026 14:31:22 +0000 (14:31 +0000)] 
io_uring/rsrc: replace reg buffer bit field with flags

I'll need a flag in the registered buffer struct for dmabuf work, and
it'll be more convenient to have a flags field rather than bit fields,
especially for io_mapped_ubuf initialisation.

We might want to add more flags in the future as well. For example, it
might be useful for debugging and potentially optimisations to split out
a flag indicating the shape of the buffer to gate iov_iter_advance()
walks vs bit/mask arithmetics. It can also be combined with the
direction mask field.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoio_uring/zcrx: improve types for size calculation
Pavel Begunkov [Thu, 5 Feb 2026 18:04:43 +0000 (18:04 +0000)] 
io_uring/zcrx: improve types for size calculation

Make sure io_import_umem() promotes the type to long before calculating
the area size. While the area size is capped at 1GB by
io_validate_user_buf_range() and fits into an "int", it's still too
error prone.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoio_uring/tctx: avoid modifying loop variable in io_ring_add_registered_file
Yang Xiuwei [Tue, 10 Feb 2026 02:34:32 +0000 (10:34 +0800)] 
io_uring/tctx: avoid modifying loop variable in io_ring_add_registered_file

Use a separate 'idx' variable to store the result of array_index_nospec()
instead of modifying the loop variable 'offset' directly. This improves
code clarity by separating the logical index from the sanitized index
used for array access.

No functional change intended.

Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoio_uring: simplify IORING_SETUP_DEFER_TASKRUN && !SQPOLL check
Caleb Sander Mateos [Fri, 6 Feb 2026 21:58:04 +0000 (14:58 -0700)] 
io_uring: simplify IORING_SETUP_DEFER_TASKRUN && !SQPOLL check

io_uring_sanitise_params() already rejects flags that include both
IORING_SETUP_SQPOLL and IORING_SETUP_DEFER_TASKRUN. So it's unnecessary
to check IORING_SETUP_SQPOLL in io_uring_create() when
IORING_SETUP_DEFER_TASKRUN has already been checked. Drop the
!(ctx->flags & IORING_SETUP_SQPOLL) check for the task_complete case.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 weeks agoMerge tag 'for-7.0/block-stable-pages-20260206' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Tue, 10 Feb 2026 02:14:52 +0000 (18:14 -0800)] 
Merge tag 'for-7.0/block-stable-pages-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull bounce buffer dio for stable pages from Jens Axboe:
 "This adds support for bounce buffering of dio for stable pages. This
  was all done by Christoph. In his words:

  This series tries to address the problem that under I/O pages can be
  modified during direct I/O, even when the device or file system
  require stable pages during I/O to calculate checksums, parity or data
  operations. It does so by adding block layer helpers to bounce buffer
  an iov_iter into a bio, then wires that up in iomap and ultimately
  XFS.

  The reason that the file system even needs to know about it, is
  because reads need a user context to copy the data back, and the
  infrastructure to defer ioends to a workqueue currently sits in XFS.
  I'm going to look into moving that into ioend and enabling it for
  other file systems. Additionally btrfs already has it's own
  infrastructure for this, and actually an urgent need to bounce buffer,
  so this should be useful there and could be wire up easily. In fact
  the idea comes from patches by Qu that did this in btrfs.

  This patch fixes all but one xfstests failures on T10 PI capable
  devices (generic/095 seems to have issues with a mix of mmap and
  splice still, I'm looking into that separately), and make qemu VMs
  running Windows, or Linux with swap enabled fine on an XFS file on a
  device using PI.

  Performance numbers on my (not exactly state of the art) NVMe PI test
  setup:

      Sequential reads using io_uring, QD=16.
      Bandwidth and CPU usage (usr/sys):

      | size |        zero copy         |          bounce          |
      +------+--------------------------+--------------------------+
      |   4k | 1316MiB/s (12.65/55.40%) | 1081MiB/s (11.76/49.78%) |
      |  64K | 3370MiB/s ( 5.46/18.20%) | 3365MiB/s ( 4.47/15.68%) |
      |   1M | 3401MiB/s ( 0.76/23.05%) | 3400MiB/s ( 0.80/09.06%) |
      +------+--------------------------+--------------------------+

      Sequential writes using io_uring, QD=16.
      Bandwidth and CPU usage (usr/sys):

      | size |        zero copy         |          bounce          |
      +------+--------------------------+--------------------------+
      |   4k |  882MiB/s (11.83/33.88%) |  750MiB/s (10.53/34.08%) |
      |  64K | 2009MiB/s ( 7.33/15.80%) | 2007MiB/s ( 7.47/24.71%) |
      |   1M | 1992MiB/s ( 7.26/ 9.13%) | 1992MiB/s ( 9.21/19.11%) |
      +------+--------------------------+--------------------------+

  Note that the 64k read numbers look really odd to me for the baseline
  zero copy case, but are reproducible over many repeated runs.

  The bounce read numbers should further improve when moving the PI
  validation to the file system and removing the double context switch,
  which I have patches for that will sent out soon"

* tag 'for-7.0/block-stable-pages-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
  xfs: use bounce buffering direct I/O when the device requires stable pages
  iomap: add a flag to bounce buffer direct I/O
  iomap: support ioends for direct reads
  iomap: rename IOMAP_DIO_DIRTY to IOMAP_DIO_USER_BACKED
  iomap: free the bio before completing the dio
  iomap: share code between iomap_dio_bio_end_io and iomap_finish_ioend_direct
  iomap: split out the per-bio logic from iomap_dio_bio_iter
  iomap: simplify iomap_dio_bio_iter
  iomap: fix submission side handling of completion side errors
  block: add helpers to bounce buffer an iov_iter into bios
  block: remove bio_release_page
  iov_iter: extract a iov_iter_extract_bvecs helper from bio code
  block: open code bio_add_page and fix handling of mismatching P2P ranges
  block: refactor get_contig_folio_len
  block: add a BIO_MAX_SIZE constant and use it

2 weeks agoMerge tag 'for-7.0/block-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Tue, 10 Feb 2026 01:57:21 +0000 (17:57 -0800)] 
Merge tag 'for-7.0/block-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull block updates from Jens Axboe:

 - Support for batch request processing for ublk, improving the
   efficiency of the kernel/ublk server communication. This can yield
   nice 7-12% performance improvements

 - Support for integrity data for ublk

 - Various other ublk improvements and additions, including a ton of
   selftests additions and updated

 - Move the handling of blk-crypto software fallback from below the
   block layer to above it. This reduces the complexity of dealing with
   bio splitting

 - Series fixing a number of potential deadlocks in blk-mq related to
   the queue usage counter and writeback throttling and rq-qos debugfs
   handling

 - Add an async_depth queue attribute, to resolve a performance
   regression that's been around for a qhilw related to the scheduler
   depth handling

 - Only use task_work for IOPOLL completions on NVMe, if it is necessary
   to do so. An earlier fix for an issue resulted in all these
   completions being punted to task_work, to guarantee that completions
   were only run for a given io_uring ring when it was local to that
   ring. With the new changes, we can detect if it's necessary to use
   task_work or not, and avoid it if possible.

 - rnbd fixes:
      - Fix refcount underflow in device unmap path
      - Handle PREFLUSH and NOUNMAP flags properly in protocol
      - Fix server-side bi_size for special IOs
      - Zero response buffer before use
      - Fix trace format for flags
      - Add .release to rnbd_dev_ktype

 - MD pull requests via Yu Kuai
      - Fix raid5_run() to return error when log_init() fails
      - Fix IO hang with degraded array with llbitmap
      - Fix percpu_ref not resurrected on suspend timeout in llbitmap
      - Fix GPF in write_page caused by resize race
      - Fix NULL pointer dereference in process_metadata_update
      - Fix hang when stopping arrays with metadata through dm-raid
      - Fix any_working flag handling in raid10_sync_request
      - Refactor sync/recovery code path, improve error handling for
        badblocks, and remove unused recovery_disabled field
      - Consolidate mddev boolean fields into mddev_flags
      - Use mempool to allocate stripe_request_ctx and make sure
        max_sectors is not less than io_opt in raid5
      - Fix return value of mddev_trylock
      - Fix memory leak in raid1_run()
      - Add Li Nan as mdraid reviewer

 - Move phys_vec definitions to the kernel types, mostly in preparation
   for some VFIO and RDMA changes

 - Improve the speed for secure erase for some devices

 - Various little rust updates

 - Various other minor fixes, improvements, and cleanups

* tag 'for-7.0/block-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (162 commits)
  blk-mq: ABI/sysfs-block: fix docs build warnings
  selftests: ublk: organize test directories by test ID
  block: decouple secure erase size limit from discard size limit
  block: remove redundant kill_bdev() call in set_blocksize()
  blk-mq: add documentation for new queue attribute async_dpeth
  block, bfq: convert to use request_queue->async_depth
  mq-deadline: covert to use request_queue->async_depth
  kyber: covert to use request_queue->async_depth
  blk-mq: add a new queue sysfs attribute async_depth
  blk-mq: factor out a helper blk_mq_limit_depth()
  blk-mq-sched: unify elevators checking for async requests
  block: convert nr_requests to unsigned int
  block: don't use strcpy to copy blockdev name
  blk-mq-debugfs: warn about possible deadlock
  blk-mq-debugfs: add missing debugfs_mutex in blk_mq_debugfs_register_hctxs()
  blk-mq-debugfs: remove blk_mq_debugfs_unregister_rqos()
  blk-mq-debugfs: make blk_mq_debugfs_register_rqos() static
  blk-rq-qos: fix possible debugfs_mutex deadlock
  blk-mq-debugfs: factor out a helper to register debugfs for all rq_qos
  blk-wbt: fix possible deadlock to nest pcpu_alloc_mutex under q_usage_counter
  ...

2 weeks agoMerge tag 'io_uring-bpf-restrictions.4-20260206' of git://git.kernel.org/pub/scm...
Linus Torvalds [Tue, 10 Feb 2026 01:31:17 +0000 (17:31 -0800)] 
Merge tag 'io_uring-bpf-restrictions.4-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull io_uring bpf filters from Jens Axboe:
 "This adds support for both cBPF filters for io_uring, as well as task
  inherited restrictions and filters.

  seccomp and io_uring don't play along nicely, as most of the
  interesting data to filter on resides somewhat out-of-band, in the
  submission queue ring.

  As a result, things like containers and systemd that apply seccomp
  filters, can't filter io_uring operations.

  That leaves them with just one choice if filtering is critical -
  filter the actual io_uring_setup(2) system call to simply disallow
  io_uring. That's rather unfortunate, and has limited us because of it.

  io_uring already has some filtering support. It requires the ring to
  be setup in a disabled state, and then a filter set can be applied.
  This filter set is completely bi-modal - an opcode is either enabled
  or it's not. Once a filter set is registered, the ring can be enabled.
  This is very restrictive, and it's not useful at all to systemd or
  containers which really want both broader and more specific control.

  This first adds support for cBPF filters for opcodes, which enables
  tighter control over what exactly a specific opcode may do. As
  examples, specific support is added for IORING_OP_OPENAT/OPENAT2,
  allowing filtering on resolve flags. And another example is added for
  IORING_OP_SOCKET, allowing filtering on domain/type/protocol. These
  are both common use cases. cBPF was chosen rather than eBPF, because
  the latter is often restricted in containers as well.

  These filters are run post the init phase of the request, which allows
  filters to even dip into data that is being passed in struct in user
  memory, as the init side of requests make that data stable by bringing
  it into the kernel. This allows filtering without needing to copy this
  data twice, or have filters etc know about the exact layout of the
  user data. The filters get the already copied and sanitized data
  passed.

  On top of that support is added for per-task filters, meaning that any
  ring created with a task that has a per-task filter will get those
  filters applied when it's created. These filters are inherited across
  fork as well. Once a filter has been registered, any further added
  filters may only further restrict what operations are permitted.

  Filters cannot change the return value of an operation, they can only
  permit or deny it based on the contents"

* tag 'io_uring-bpf-restrictions.4-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
  io_uring: allow registration of per-task restrictions
  io_uring: add task fork hook
  io_uring/bpf_filter: add ref counts to struct io_bpf_filter
  io_uring/bpf_filter: cache lookup table in ctx->bpf_filters
  io_uring/bpf_filter: allow filtering on contents of struct open_how
  io_uring/net: allow filtering on IORING_OP_SOCKET data
  io_uring: add support for BPF filtering for opcode restrictions

2 weeks agoMerge tag 'for-7.0/io_uring-20260206' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Tue, 10 Feb 2026 01:22:00 +0000 (17:22 -0800)] 
Merge tag 'for-7.0/io_uring-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull io_uring updates from Jens Axboe:

 - Clean up the IORING_SETUP_R_DISABLED and submitter task checking,
   mostly just in preparation for relaxing the locking for SINGLE_ISSUER
   in the future.

 - Improve IOPOLL by using a doubly linked list to manage completions.

   Previously it was singly listed, which meant that to complete request
   N in the chain 0..N-1 had to have completed first. With a doubly
   linked list we can complete whatever request completes in that order,
   rather than need to wait for a consecutive range to be available.
   This reduces latencies.

 - Improve the restriction setup and checking. Mostly in preparation for
   adding further features on top of that. Coming in a separate pull
   request.

 - Split out task_work and wait handling into separate files. These are
   mostly nicely abstracted already, but still remained in the
   io_uring.c file which is on the larger side.

 - Use GFP_KERNEL_ACCOUNT in a few more spots, where appropriate.

 - Ensure even the idle io-wq worker exits if a task no longer has any
   rings open.

 - Add support for a non-circular submission queue.

   By default, the SQ ring keeps moving around, even if only a few
   entries are used for each submission. This can be wasteful in terms
   of cachelines.

   If IORING_SETUP_SQ_REWIND is set for the ring when created, each
   submission will start at offset 0 instead of where we last left off
   doing submissions.

 - Various little cleanups

* tag 'for-7.0/io_uring-20260206' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: (30 commits)
  io_uring/kbuf: fix memory leak if io_buffer_add_list fails
  io_uring: Add SPDX id lines to remaining source files
  io_uring: allow io-wq workers to exit when unused
  io_uring/io-wq: add exit-on-idle state
  io_uring/net: don't continue send bundle if poll was required for retry
  io_uring/rsrc: use GFP_KERNEL_ACCOUNT consistently
  io_uring/futex: use GFP_KERNEL_ACCOUNT for futex data allocation
  io_uring/io-wq: handle !sysctl_hung_task_timeout_secs
  io_uring: fix bad indentation for setup flags if statement
  io_uring/rsrc: take unsigned index in io_rsrc_node_lookup()
  io_uring: introduce non-circular SQ
  io_uring: split out CQ waiting code into wait.c
  io_uring: split out task work code into tw.c
  io_uring/io-wq: don't trigger hung task for syzbot craziness
  io_uring: add IO_URING_EXIT_WAIT_MAX definition
  io_uring/sync: validate passed in offset
  io_uring/eventfd: remove unused ctx->evfd_last_cq_tail member
  io_uring/timeout: annotate data race in io_flush_timeouts()
  io_uring/uring_cmd: explicitly disallow cancelations for IOPOLL
  io_uring: fix IOPOLL with passthrough I/O
  ...

2 weeks agoMerge tag 'pull-filename' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Tue, 10 Feb 2026 00:58:28 +0000 (16:58 -0800)] 
Merge tag 'pull-filename' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs 'struct filename' updates from Al Viro:
 "[Mostly] sanitize struct filename handling"

* tag 'pull-filename' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (68 commits)
  sysfs(2): fs_index() argument is _not_ a pathname
  alpha: switch osf_mount() to strndup_user()
  ksmbd: use CLASS(filename_kernel)
  mqueue: switch to CLASS(filename)
  user_statfs(): switch to CLASS(filename)
  statx: switch to CLASS(filename_maybe_null)
  quotactl_block(): switch to CLASS(filename)
  chroot(2): switch to CLASS(filename)
  move_mount(2): switch to CLASS(filename_maybe_null)
  namei.c: switch user pathname imports to CLASS(filename{,_flags})
  namei.c: convert getname_kernel() callers to CLASS(filename_kernel)
  do_f{chmod,chown,access}at(): use CLASS(filename_uflags)
  do_readlinkat(): switch to CLASS(filename_flags)
  do_sys_truncate(): switch to CLASS(filename)
  do_utimes_path(): switch to CLASS(filename_uflags)
  chdir(2): unspaghettify a bit...
  do_fchownat(): unspaghettify a bit...
  fspick(2): use CLASS(filename_flags)
  name_to_handle_at(): use CLASS(filename_uflags)
  vfs_open_tree(): use CLASS(filename_uflags)
  ...

2 weeks agoMerge tag 'v7.0-rc-part1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Linus Torvalds [Tue, 10 Feb 2026 00:46:51 +0000 (16:46 -0800)] 
Merge tag 'v7.0-rc-part1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client updates from Steve French:

 - multichannel improvements, including making add channel async at
   mount time

 - fix potential double free in open path

 - retry fixes

 - locking improvements

 - fix potential directory lease races

 - cleanup patches for client headers

 - patches to better split out SMB1 code

 - minor cleanup of structs for gcc 14 warnings

 - error handling improvements

* tag 'v7.0-rc-part1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: (74 commits)
  cifs: Fix the copyright banner on smb1maperror.c
  smb: common: add header guards to fs/smb/common/smb2status.h
  smb: client: Avoid a dozen -Wflex-array-member-not-at-end warnings
  smb/client: remove useless comment in mapping_table_ERRSRV
  smb/client: remove some literal NT error codes from ntstatus_to_dos_map
  smb/client: add NT_STATUS_VOLUME_NOT_UPGRADED
  smb/client: add NT_STATUS_NO_USER_KEYS
  smb/client: add NT_STATUS_WRONG_EFS
  smb/client: add NT_STATUS_NO_EFS
  smb/client: add NT_STATUS_NO_RECOVERY_POLICY
  smb/client: add NT_STATUS_RANGE_NOT_FOUND
  smb/client: add NT_STATUS_DECRYPTION_FAILED
  smb/client: add NT_STATUS_ENCRYPTION_FAILED
  smb/client: add NT_STATUS_DIRECTORY_IS_A_REPARSE_POINT
  smb/client: add NT_STATUS_VOLUME_DISMOUNTED
  smb/client: add NT_STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT
  smb/client: add NT_STATUS_VARIABLE_NOT_FOUND
  smb/client: rename ERRinvlevel to ERRunknownlevel
  smb/client: add NT_STATUS_OS2_INVALID_LEVEL
  smb/client: map NT_STATUS_INVALID_INFO_CLASS to ERRbadpipe
  ...

2 weeks agoMerge tag 'dlm-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm
Linus Torvalds [Tue, 10 Feb 2026 00:40:43 +0000 (16:40 -0800)] 
Merge tag 'dlm-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm

Pull dlm updates from David Teigland:
 "This includes several minor code cleanups, and one notable fix for
  recovery of in-progress lock conversions which would lead to a the
  convert operation never completing"

* tag 'dlm-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
  dlm: Avoid -Wflex-array-member-not-at-end warning
  fs/dlm/dir: remove unuse variable count_match
  dlm: Constify struct configfs_item_operations and configfs_group_operations
  fs/dlm: use list_add_tail() instead of open-coding list insertion
  dlm: validate length in dlm_search_rsb_tree
  dlm: fix recovery pending middle conversion

2 weeks agoMerge tag 'gfs2-for-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux...
Linus Torvalds [Tue, 10 Feb 2026 00:29:57 +0000 (16:29 -0800)] 
Merge tag 'gfs2-for-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 updates from Andreas Gruenbacher:

 - Prevent rename() from failing with -ESTALE when there are locking
   conflicts and retry the operation instead

 - Don't fail when fiemap triggers a page fault (xfstest generic/742)

 - Fix another locking request cancellation bug

 - Minor other fixes and cleanups

* tag 'gfs2-for-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
  gfs2: fiemap page fault fix
  gfs2: fix memory leaks in gfs2_fill_super error path
  gfs2: Fix use-after-free in iomap inline data write path
  gfs2: Fix slab-use-after-free in qd_put
  gfs2: Introduce glock_{type,number,sbd} helpers
  gfs2: gfs2_glock_hold cleanup
  gfs: Use fixed GL_GLOCK_MIN_HOLD time
  gfs2: Fix gfs2_log_get_bio argument type
  gfs2: gfs2_chain_bio start sector fix
  gfs2: Initialize bio->bi_opf early
  gfs2: Rename gfs2_log_submit_{bio -> write}
  gfs2: Do not cancel internal demote requests
  gfs2: run_queue cleanup
  gfs2: Retries missing in gfs2_{rename,exchange}
  gfs2: glock cancelation flag fix

2 weeks agoMerge tag 'xfs-merge-7.0' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Linus Torvalds [Tue, 10 Feb 2026 00:11:27 +0000 (16:11 -0800)] 
Merge tag 'xfs-merge-7.0' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs updates from Carlos Maiolino:
 "This contains several improvements to zoned device support,
  performance improvements for the parent pointers, and a new health
  monitoring feature. There are some improvements in the journaling code
  too but no behavior change expected.

  Last but not least, some code refactoring and bug fixes are also
  included in this series"

* tag 'xfs-merge-7.0' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (67 commits)
  xfs: add sysfs stats for zoned GC
  xfs: give the defer_relog stat a xs_ prefix
  xfs: add zone reset error injection
  xfs: refactor zone reset handling
  xfs: don't mark all discard issued by zoned GC as sync
  xfs: allow setting errortags at mount time
  xfs: use WRITE_ONCE/READ_ONCE for m_errortag
  xfs: move the guts of XFS_ERRORTAG_DELAY out of line
  xfs: don't validate error tags in the I/O path
  xfs: allocate m_errortag early
  xfs: fix the errno sign for the xfs_errortag_{add,clearall} stubs
  xfs: validate log record version against superblock log version
  xfs: fix spacing style issues in xfs_alloc.c
  xfs: remove xfs_zone_gc_space_available
  xfs: use a seprate member to track space availabe in the GC scatch buffer
  xfs: check for deleted cursors when revalidating two btrees
  xfs: fix UAF in xchk_btree_check_block_owner
  xfs: check return value of xchk_scrub_create_subord
  xfs: only call xf{array,blob}_destroy if we have a valid pointer
  xfs: get rid of the xchk_xfile_*_descr calls
  ...

2 weeks agoMerge tag 'erofs-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang...
Linus Torvalds [Tue, 10 Feb 2026 00:08:40 +0000 (16:08 -0800)] 
Merge tag 'erofs-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs

Pull erofs updates from Gao Xiang:
 "In this cycle, inode page cache sharing among filesystems on the same
  machine is now supported, which is particularly useful for
  high-density hosts running tens of thousands of containers.

  In addition, we fully isolate the EROFS core on-disk format from other
  optional encoded layouts since the core on-disk part is designed to be
  simple, effective, and secure. Users can use the core format to build
  unique golden immutable images and import their filesystem trees
  directly from raw block devices via DMA, page-mapped DAX devices,
  and/or file-backed mounts without having to worry about unnecessary
  intrinsic consistency issues found in other generic filesystems by
  design. However, the full vision is still working in progress and will
  spend more time to achieve final goals.

  There are other improvements and bug fixes as usual, as listed below:

   - Support inode page cache sharing among filesystems

   - Formally separate optional encoded (aka compressed) inode layouts
     (and the implementations) from the EROFS core on-disk aligned plain
     format for future zero-trust security usage

   - Improve performance by caching the fact that an inode does not have
     a POSIX ACL

   - Improve LZ4 decompression error reporting

   - Enable LZMA by default and promote DEFLATE and Zstandard algorithms
     out of EXPERIMENTAL status

   - Switch to inode_set_cached_link() to cache symlink lengths

   - random bugfixes and minor cleanups"

* tag 'erofs-for-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: (31 commits)
  erofs: fix UAF issue for file-backed mounts w/ directio option
  erofs: update compression algorithm status
  erofs: fix inline data read failure for ztailpacking pclusters
  erofs: avoid some unnecessary #ifdefs
  erofs: handle end of filesystem properly for file-backed mounts
  erofs: separate plain and compressed filesystems formally
  erofs: use inode_set_cached_link()
  erofs: mark inodes without acls in erofs_read_inode()
  erofs: implement .fadvise for page cache share
  erofs: support compressed inodes for page cache share
  erofs: support unencoded inodes for page cache share
  erofs: pass inode to trace_erofs_read_folio
  erofs: introduce the page cache share feature
  erofs: using domain_id in the safer way
  erofs: add erofs_inode_set_aops helper to set the aops
  erofs: support user-defined fingerprint name
  erofs: decouple `struct erofs_anon_fs_type`
  fs: Export alloc_empty_backing_file
  erofs: tidy up erofs_init_inode_xattrs()
  erofs: add missing documentation about `directio` mount option
  ...

2 weeks agoMerge tag 'hfs-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/hfs
Linus Torvalds [Tue, 10 Feb 2026 00:00:21 +0000 (16:00 -0800)] 
Merge tag 'hfs-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/hfs

Pull hfs/hfsplus updates from Viacheslav Dubeyko:
 "This pull request contains several fixes of syzbot reported issues and
  HFS+ fixes of xfstests failures.

   - fix an issue reported by syzbot triggering BUG_ON() in the case of
     corrupted superblock, replacing the BUG_ON()s with proper error
     handling (Jori Koolstra)

   - fix memory leaks in the mount logic of HFS/HFS+ file systems. When
     HFS/HFS+ were converted to the new mount api a bug was introduced
     by changing the allocation pattern of sb->s_fs_info (Mehdi Ben Hadj
     Khelifa)

   - fix hfs_bnode_create() by returning ERR_PTR(-EEXIST) instead of
     the node pointer when it's already hashed.  This avoids a double
     unload_nls() on mount failure (suggested by Shardul Bankar)

   - set inode's mode as regular file for system inodes (Tetsuo Handa)

  The rest fix failures in generic/020, generic/037, generic/062,
  generic/480, and generic/498 xfstests for the case of HFS+ file
  system. Currently, only 30 xfstests' test-cases experience failures
  for HFS+ file system (initially, it was around 100 failed xfstests)"

* tag 'hfs-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/hfs:
  hfsplus: avoid double unload_nls() on mount failure
  hfsplus: fix warning issue in inode.c
  hfsplus: fix generic/062 xfstests failure
  hfsplus: fix generic/037 xfstests failure
  hfsplus: pretend special inodes as regular files
  hfsplus: return error when node already exists in hfs_bnode_create
  hfs: Replace BUG_ON with error handling for CNID count checks
  hfsplus: fix generic/020 xfstests failure
  hfsplus: fix volume corruption issue for generic/498
  hfsplus: fix volume corruption issue for generic/480
  hfsplus: ensure sb->s_fs_info is always cleaned up
  hfs: ensure sb->s_fs_info is always cleaned up

2 weeks agoMerge tag 'nilfs2-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyk...
Linus Torvalds [Mon, 9 Feb 2026 23:55:41 +0000 (15:55 -0800)] 
Merge tag 'nilfs2-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/nilfs2

Pull nilfs2 updates from Viacheslav Dubeyko:

 - Fix potential block overflow that cause system hang

   When executing the FITRIM command, an underflow can occur in the
   calculation of nblocks. This ultimately leads to the block layer
   function __blkdev_issue_discard() taking an excessively long time
   to process the bio chain, and the ns_segctor_sem lock remains held
   for a long period.

   This prevents other tasks from acquiring the ns_segctor_sem lock,
   resulting in a hang reported by syzbot (Edward Adam Davis)

 - Fix missing struct keywords in nilfs2_api.h kernel-doc (Ryusuke
   Konishi)

 - Convert nilfs_super_block to kernel-doc

   Eliminate 40+ kernel-doc warnings in nilfs2_ondisk.h by converting
   all of the struct member comments to kernel-doc comments (Randy
   Dunlap)

* tag 'nilfs2-v7.0-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/nilfs2:
  nilfs2: fix missing struct keywords in nilfs2_api.h kernel-doc
  nilfs2: convert nilfs_super_block to kernel-doc
  nilfs2: Fix potential block overflow that cause system hang

2 weeks agoMerge tag 'for-6.20-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Linus Torvalds [Mon, 9 Feb 2026 23:45:21 +0000 (15:45 -0800)] 
Merge tag 'for-6.20-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs updates from David Sterba:
 "User visible changes, feature updates:

   - when using block size > page size, enable direct IO

   - fallback to buffered IO if the data profile has duplication,
     workaround to avoid checksum mismatches on block group profiles
     with redundancy, real direct IO is possible on single or RAID0

   - redo export of zoned statistics, moved from sysfs to
     /proc/pid/mountstats due to size limitations of the former

  Experimental features:

   - remove offload checksum tunable, intended to find best way to do it
     but since we've switched to offload to thread for everything we
     don't need it anymore

   - initial support for remap-tree feature, a translation layer of
     logical block addresses that allow changes without moving/rewriting
     blocks to do eg. relocation, or other changes that require COW

  Notable fixes:

   - automatic removal of accidentally leftover chunks when
     free-space-tree is enabled since mkfs.btrfs v6.16.1

   - zoned mode:
      - do not try to append to conventional zones when RAID is mixing
        zoned and conventional drives
      - fixup write pointers when mixing zoned and conventional on
        DUP/RAID* profiles

   - when using squota, relax deletion rules for qgroups with 0 members
     to allow easier recovery from accounting bugs, also add more checks
     to detect bad accounting

   - fix periodic reclaim scanning, properly check boundary conditions
     not to trigger it unexpectedly or miss the time to run it

   - trim:
      - continue after first error
      - change reporting to the first detected error
      - add more cancellation points
      - reduce contention of big device lock that can block other
        operations when there's lots of trimmed space

   - when chunk allocation is forced (needs experimental build) fix
     transaction abort when unexpected space layout is detected

  Core:

   - switch to crypto library API for checksumming, removed module
     dependencies, pointer indirections, etc.

   - error handling improvements

   - adjust how and where transaction commit or abort are done and are
     maybe not necessary

   - minor compression optimization to skip single block ranges

   - improve how compression folios are handled

   - new and updated selftests

   - cleanups, refactoring:
      - auto-freeing and other automatic variable cleanup conversion
      - structure size optimizations
      - condition annotations"

* tag 'for-6.20-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (137 commits)
  btrfs: get rid of compressed_bio::compressed_folios[]
  btrfs: get rid of compressed_folios[] usage for encoded writes
  btrfs: get rid of compressed_folios[] usage for compressed read
  btrfs: remove the old btrfs_compress_folios() infrastructure
  btrfs: switch to btrfs_compress_bio() interface for compressed writes
  btrfs: introduce btrfs_compress_bio() helper
  btrfs: zlib: introduce zlib_compress_bio() helper
  btrfs: zstd: introduce zstd_compress_bio() helper
  btrfs: lzo: introduce lzo_compress_bio() helper
  btrfs: zoned: factor out the zone loading part into a testable function
  btrfs: add cleanup function for btrfs_free_chunk_map
  btrfs: tests: add cleanup functions for test specific functions
  btrfs: raid56: fix memory leak of btrfs_raid_bio::stripe_uptodate_bitmap
  btrfs: tests: add unit tests for pending extent walking functions
  btrfs: fix EEXIST abort due to non-consecutive gaps in chunk allocation
  btrfs: fix transaction commit blocking during trim of unallocated space
  btrfs: handle user interrupt properly in btrfs_trim_fs()
  btrfs: preserve first error in btrfs_trim_fs()
  btrfs: continue trimming remaining devices on failure
  btrfs: do not BUG_ON() in btrfs_remove_block_group()
  ...

2 weeks agofs: fuse: fix max() of incompatible types
Arnd Bergmann [Tue, 23 Dec 2025 21:54:03 +0000 (22:54 +0100)] 
fs: fuse: fix max() of incompatible types

The 'max()' value of a 'long long' and an 'unsigned int' is problematic
if the former is negative:

In function 'fuse_wr_pages',
    inlined from 'fuse_perform_write' at fs/fuse/file.c:1347:27:
include/linux/compiler_types.h:652:45: error: call to '__compiletime_assert_390' declared with attribute error: min(((pos + len - 1) >> 12) - (pos >> 12) + 1, max_pages) signedness error
  652 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
      |                                             ^

Use a temporary variable to make it clearer what is going on here.

Fixes: 0f5bb0cfb0b4 ("fs: use min() or umin() instead of min_t()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 weeks agoMerge tag 'vfs-7.0-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 23:13:05 +0000 (15:13 -0800)] 
Merge tag 'vfs-7.0-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull misc vfs updates from Christian Brauner:
 "This contains a mix of VFS cleanups, performance improvements, API
  fixes, documentation, and a deprecation notice.

  Scalability and performance:

   - Rework pid allocation to only take pidmap_lock once instead of
     twice during alloc_pid(), improving thread creation/teardown
     throughput by 10-16% depending on false-sharing luck. Pad the
     namespace refcount to reduce false-sharing

   - Track file lock presence via a flag in ->i_opflags instead of
     reading ->i_flctx, avoiding false-sharing with ->i_readcount on
     open/close hot paths. Measured 4-16% improvement on 24-core
     open-in-a-loop benchmarks

   - Use a consume fence in locks_inode_context() to match the
     store-release/load-consume idiom, eliminating a hardware fence on
     some architectures

   - Annotate cdev_lock with __cacheline_aligned_in_smp to prevent
     false-sharing

   - Remove a redundant DCACHE_MANAGED_DENTRY check in
     __follow_mount_rcu() that never fires since the caller already
     verifies it, eliminating a 100% mispredicted branch

   - Fix a 100% mispredicted likely() in devcgroup_inode_permission()
     that became wrong after a prior code reorder

  Bug fixes and correctness:

   - Make insert_inode_locked() wait for inode destruction instead of
     skipping, fixing a corner case where two matching inodes could
     exist in the hash

   - Move f_mode initialization before file_ref_init() in alloc_file()
     to respect the SLAB_TYPESAFE_BY_RCU ordering contract

   - Add a WARN_ON_ONCE guard in try_to_free_buffers() for folios with
     no buffers attached, preventing a null pointer dereference when
     AS_RELEASE_ALWAYS is set but no release_folio op exists

   - Fix select restart_block to store end_time as timespec64, avoiding
     truncation of tv_sec on 32-bit architectures

   - Make dump_inode() use get_kernel_nofault() to safely access inode
     and superblock fields, matching the dump_mapping() pattern

  API modernization:

   - Make posix_acl_to_xattr() allocate the buffer internally since
     every single caller was doing it anyway. Reduces boilerplate and
     unnecessary error checking across ~15 filesystems

   - Replace deprecated simple_strtoul() with kstrtoul() for the
     ihash_entries, dhash_entries, mhash_entries, and mphash_entries
     boot parameters, adding proper error handling

   - Convert chardev code to use guard(mutex) and __free(kfree) cleanup
     patterns

   - Replace min_t() with min() or umin() in VFS code to avoid silently
     truncating unsigned long to unsigned int

   - Gate LOOKUP_RCU assertions behind CONFIG_DEBUG_VFS since callers
     already check the flag

  Deprecation:

   - Begin deprecating legacy BSD process accounting (acct(2)). The
     interface has numerous footguns and better alternatives exist
     (eBPF)

  Documentation:

   - Fix and complete kernel-doc for struct export_operations, removing
     duplicated documentation between ReST and source

   - Fix kernel-doc warnings for __start_dirop() and ilookup5_nowait()

  Testing:

   - Add a kunit test for initramfs cpio handling of entries with
     filesize > PATH_MAX

  Misc:

   - Add missing <linux/init_task.h> include in fs_struct.c"

* tag 'vfs-7.0-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (28 commits)
  posix_acl: make posix_acl_to_xattr() alloc the buffer
  fs: make insert_inode_locked() wait for inode destruction
  initramfs_test: kunit test for cpio.filesize > PATH_MAX
  fs: improve dump_inode() to safely access inode fields
  fs: add <linux/init_task.h> for 'init_fs'
  docs: exportfs: Use source code struct documentation
  fs: move initializing f_mode before file_ref_init()
  exportfs: Complete kernel-doc for struct export_operations
  exportfs: Mark struct export_operations functions at kernel-doc
  exportfs: Fix kernel-doc output for get_name()
  acct(2): begin the deprecation of legacy BSD process accounting
  device_cgroup: remove branch hint after code refactor
  VFS: fix __start_dirop() kernel-doc warnings
  fs: Describe @isnew parameter in ilookup5_nowait()
  fs/namei: Remove redundant DCACHE_MANAGED_DENTRY check in __follow_mount_rcu
  fs: only assert on LOOKUP_RCU when built with CONFIG_DEBUG_VFS
  select: store end_time as timespec64 in restart block
  chardev: Switch to guard(mutex) and __free(kfree)
  namespace: Replace simple_strtoul with kstrtoul to parse boot params
  dcache: Replace simple_strtoul with kstrtoul in set_dhash_entries
  ...

2 weeks agoMerge tag 'vfs-7.0-rc1.iomap' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 23:08:16 +0000 (15:08 -0800)] 
Merge tag 'vfs-7.0-rc1.iomap' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs iomap updates from Christian Brauner:

 - Erofs page cache sharing preliminaries:

   Plumb a void *private parameter through iomap_read_folio() and
   iomap_readahead() into iomap_iter->private, matching iomap DIO. Erofs
   uses this to replace a bogus kmap_to_page() call, as preparatory work
   for page cache sharing.

 - Fix for invalid folio access:

   Fix an invalid folio access when a folio without iomap_folio_state
   is fully submitted to the IO helper â€” the helper may call
   folio_end_read() at any time, so ctx->cur_folio must be invalidated
   after full submission.

* tag 'vfs-7.0-rc1.iomap' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  iomap: fix invalid folio access after folio_end_read()
  erofs: hold read context in iomap_iter if needed
  iomap: stash iomap read ctx in the private field of iomap_iter

2 weeks agoMerge tag 'vfs-7.0-rc1.namespace' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Mon, 9 Feb 2026 22:43:47 +0000 (14:43 -0800)] 
Merge tag 'vfs-7.0-rc1.namespace' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs mount updates from Christian Brauner:

 - statmount: accept fd as a parameter

   Extend struct mnt_id_req with a file descriptor field and a new
   STATMOUNT_BY_FD flag. When set, statmount() returns mount information
   for the mount the fd resides on â€” including detached mounts
   (unmounted via umount2(MNT_DETACH)).

   For detached mounts the STATMOUNT_MNT_POINT and STATMOUNT_MNT_NS_ID
   mask bits are cleared since neither is meaningful. The capability
   check is skipped for STATMOUNT_BY_FD since holding an fd already
   implies prior access to the mount and equivalent information is
   available through fstatfs() and /proc/pid/mountinfo without
   privilege. Includes comprehensive selftests covering both attached
   and detached mount cases.

 - fs: Remove internal old mount API code (1 patch)

   Now that every in-tree filesystem has been converted to the new
   mount API, remove all the legacy shim code in fs_context.c that
   handled unconverted filesystems. This deletes ~280 lines including
   legacy_init_fs_context(), the legacy_fs_context struct, and
   associated wrappers. The mount(2) syscall path for userspace remains
   untouched. Documentation references to the legacy callbacks are
   cleaned up.

 - mount: add OPEN_TREE_NAMESPACE to open_tree()

   Container runtimes currently use CLONE_NEWNS to copy the caller's
   entire mount namespace â€” only to then pivot_root() and recursively
   unmount everything they just copied. With large mount tables and
   thousands of parallel container launches this creates significant
   contention on the namespace semaphore.

   OPEN_TREE_NAMESPACE copies only the specified mount tree (like
   OPEN_TREE_CLONE) but returns a mount namespace fd instead of a
   detached mount fd. The new namespace contains the copied tree mounted
   on top of a clone of the real rootfs.

   This functions as a combined unshare(CLONE_NEWNS) + pivot_root() in a
   single syscall. Works with user namespaces: an unshare(CLONE_NEWUSER)
   followed by OPEN_TREE_NAMESPACE creates a mount namespace owned by
   the new user namespace. Mount namespace file mounts are excluded from
   the copy to prevent cycles. Includes ~1000 lines of selftests"

* tag 'vfs-7.0-rc1.namespace' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  selftests/open_tree: add OPEN_TREE_NAMESPACE tests
  mount: add OPEN_TREE_NAMESPACE
  fs: Remove internal old mount API code
  selftests: statmount: tests for STATMOUNT_BY_FD
  statmount: accept fd as a parameter
  statmount: permission check should return EPERM

2 weeks agoMerge tag 'vfs-7.0-rc1.atomic_open' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Mon, 9 Feb 2026 22:25:37 +0000 (14:25 -0800)] 
Merge tag 'vfs-7.0-rc1.atomic_open' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs atomic_open updates from Christian Brauner:
 "Allow knfsd to use atomic_open()

  While knfsd offers combined exclusive create and open results to
  clients, on some filesystems those results are not atomic. The
  separate vfs_create() + vfs_open() sequence in dentry_create() can
  produce races and unexpected errors. For example, open O_CREAT with
  mode 0 will succeed in creating the file but return -EACCES from
  vfs_open(). Additionally, network filesystems benefit from reducing
  remote round-trip operations by using a single atomic_open() call.

  Teach dentry_create() -- whose sole caller is knfsd -- to use
  atomic_open() for filesystems that support it"

* tag 'vfs-7.0-rc1.atomic_open' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  fs/namei: fix kernel-doc markup for dentry_create
  VFS/knfsd: Teach dentry_create() to use atomic_open()
  VFS: Prepare atomic_open() for dentry_create()
  VFS: move dentry_create() from fs/open.c to fs/namei.c

2 weeks agoMerge tag 'vfs-7.0-rc1.nullfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 21:41:34 +0000 (13:41 -0800)] 
Merge tag 'vfs-7.0-rc1.nullfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs nullfs update from Christian Brauner:
 "Add a completely catatonic minimal pseudo filesystem called "nullfs"
  and make pivot_root() work in the initramfs.

  Currently pivot_root() does not work on the real rootfs because it
  cannot be unmounted. Userspace has to recursively delete initramfs
  contents manually before continuing boot, using the fragile
  switch_root sequence (overmount + chroot).

  Add nullfs, a minimal immutable filesystem that serves as the true
  root of the mount hierarchy. The mutable rootfs (tmpfs/ramfs) is
  mounted on top of it. This allows userspace to simply:

      chdir(new_root);
      pivot_root(".", ".");
      umount2(".", MNT_DETACH);

  without the traditional switch_root workarounds. systemd already
  handles this correctly. It tries pivot_root() first and falls back
  to MS_MOVE only when that fails.

  This also means rootfs mounts in unprivileged namespaces no longer
  need MNT_LOCKED, since the immutable nullfs guarantees nothing can be
  revealed by unmounting the covering mount.

  nullfs is a single-instance filesystem (get_tree_single()) marked
  SB_NOUSER | SB_I_NOEXEC | SB_I_NODEV with an immutable empty root
  directory. This means sooner or later it can be used to overmount
  other directories to hide their contents without any additional
  protection needed.

  We enable it unconditionally. If we see any real regression we'll
  hide it behind a boot option.

  nullfs has extensions beyond this in the future. It will serve as a
  concept to support the creation of completely empty mount namespaces -
  which is work coming up in the next cycle"

* tag 'vfs-7.0-rc1.nullfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  fs: use nullfs unconditionally as the real rootfs
  docs: mention nullfs
  fs: add immutable rootfs
  fs: add init_pivot_root()
  fs: ensure that internal tmpfs mount gets mount id zero

2 weeks agoMerge tag 'vfs-7.0-rc1.minix' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 21:38:07 +0000 (13:38 -0800)] 
Merge tag 'vfs-7.0-rc1.minix' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull minix update from Christian Brauner:
 "Consolidate and strengthen superblock validation in
  minix_check_superblock()

  The minix filesystem driver does not validate several superblock
  fields before using them during mount, allowing a crafted filesystem
  image to trigger out-of-bounds accesses (reported by syzbot)"

* tag 'vfs-7.0-rc1.minix' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  minix: Add required sanity checking to minix_check_superblock()

2 weeks agoMerge tag 'vfs-7.0-rc1.btrfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 21:05:35 +0000 (13:05 -0800)] 
Merge tag 'vfs-7.0-rc1.btrfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs updates for btrfs from Christian Brauner:
 "This contains some changes for btrfs that are taken to the vfs tree to
  stop duplicating VFS code for subvolume/snapshot dentry

  Btrfs has carried private copies of the VFS may_delete() and
  may_create() functions in fs/btrfs/ioctl.c for permission checks
  during subvolume creation and snapshot destruction. These copies have
  drifted out of sync with the VFS originals â€” btrfs_may_delete() is
  missing the uid/gid validity check and btrfs_may_create() is missing
  the audit_inode_child() call.

  Export the VFS functions as may_{create,delete}_dentry() and switch
  btrfs to use them, removing ~70 lines of duplicated code"

* tag 'vfs-7.0-rc1.btrfs' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  btrfs: use may_create_dentry() in btrfs_mksubvol()
  btrfs: use may_delete_dentry() in btrfs_ioctl_snap_destroy()
  fs: export may_create() as may_create_dentry()
  fs: export may_delete() as may_delete_dentry()

2 weeks agoMerge tag 'vfs-7.0-rc1.fserror' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Mon, 9 Feb 2026 20:21:37 +0000 (12:21 -0800)] 
Merge tag 'vfs-7.0-rc1.fserror' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs error reporting updates from Christian Brauner:
 "This contains the changes to support generic I/O error reporting.

  Filesystems currently have no standard mechanism for reporting
  metadata corruption and file I/O errors to userspace via fsnotify.
  Each filesystem (xfs, ext4, erofs, f2fs, etc.) privately defines
  EFSCORRUPTED, and error reporting to fanotify is inconsistent or
  absent entirely.

  This introduces a generic fserror infrastructure built around struct
  super_block that gives filesystems a standard way to queue metadata
  and file I/O error reports for delivery to fsnotify.

  Errors are queued via mempools and queue_work to avoid holding
  filesystem locks in the notification path; unmount waits for pending
  events to drain. A new super_operations::report_error callback lets
  filesystem drivers respond to file I/O errors themselves (to be used
  by an upcoming XFS self-healing patchset).

  On the uapi side, EFSCORRUPTED and EUCLEAN are promoted from private
  per-filesystem definitions to canonical errno.h values across all
  architectures"

* tag 'vfs-7.0-rc1.fserror' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  ext4: convert to new fserror helpers
  xfs: translate fsdax media errors into file "data lost" errors when convenient
  xfs: report fs metadata errors via fsnotify
  iomap: report file I/O errors to the VFS
  fs: report filesystem and file I/O errors to fsnotify
  uapi: promote EFSCORRUPTED and EUCLEAN to errno.h

2 weeks agoMerge tag 'vfs-7.0-rc1.leases' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 19:59:07 +0000 (11:59 -0800)] 
Merge tag 'vfs-7.0-rc1.leases' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs lease updates from Christian Brauner:
 "This contains updates for lease support to require filesystems to
  explicitly opt-in to lease support

  Currently kernel_setlease() falls through to generic_setlease() when a
  a filesystem does not define ->setlease(), silently granting lease
  support to every filesystem regardless of whether it is prepared for
  it.

  This is a poor default: most filesystems never intended to support
  leases, and the silent fallthrough makes it impossible to distinguish
  "supports leases" from "never thought about it".

  This inverts the default. It adds explicit

.setlease = generic_setlease;

  assignments to every in-tree filesystem that should retain lease
  support, then changes kernel_setlease() to return -EINVAL when
  ->setlease is NULL.

  With the new default in place, simple_nosetlease() is redundant and
  is removed along with all references to it"

* tag 'vfs-7.0-rc1.leases' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (25 commits)
  fuse: add setlease file operation
  fs: remove simple_nosetlease()
  filelock: default to returning -EINVAL when ->setlease operation is NULL
  xfs: add setlease file operation
  ufs: add setlease file operation
  udf: add setlease file operation
  tmpfs: add setlease file operation
  squashfs: add setlease file operation
  overlayfs: add setlease file operation
  orangefs: add setlease file operation
  ocfs2: add setlease file operation
  ntfs3: add setlease file operation
  nilfs2: add setlease file operation
  jfs: add setlease file operation
  jffs2: add setlease file operation
  gfs2: add a setlease file operation
  fat: add setlease file operation
  f2fs: add setlease file operation
  exfat: add setlease file operation
  ext4: add setlease file operation
  ...

2 weeks agoMerge tag 'vfs-7.0-rc1.nonblocking_timestamps' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Mon, 9 Feb 2026 19:25:01 +0000 (11:25 -0800)] 
Merge tag 'vfs-7.0-rc1.nonblocking_timestamps' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs timestamp updates from Christian Brauner:
 "This contains the changes to support non-blocking timestamp updates.

  Since commit 66fa3cedf16a ("fs: Add async write file modification
  handling") file_update_time_flags() unconditionally returns -EAGAIN
  when any timestamp needs updating and IOCB_NOWAIT is set. This makes
  non-blocking direct writes impossible on file systems with granular
  enough timestamps, which in practice means all of them.

  This reworks the timestamp update path to propagate IOCB_NOWAIT
  through ->update_time so that file systems which can update timestamps
  without blocking are no longer penalized.

  With that groundwork in place, the core change passes IOCB_NOWAIT into
  ->update_time and returns -EAGAIN only when the file system indicates
  it would block.

  XFS implements non-blocking timestamp updates by using the new
  ->sync_lazytime and open-coding generic_update_time without the
  S_NOWAIT check, since the lazytime path through the generic helpers
  can never block in XFS"

* tag 'vfs-7.0-rc1.nonblocking_timestamps' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  xfs: enable non-blocking timestamp updates
  xfs: implement ->sync_lazytime
  fs: refactor file_update_time_flags
  fs: add support for non-blocking timestamp updates
  fs: add a ->sync_lazytime method
  fs: factor out a sync_lazytime helper
  fs: refactor ->update_time handling
  fat: cleanup the flags for fat_truncate_time
  nfs: split nfs_update_timestamps
  fs: allow error returns from generic_update_time
  fs: remove inode_update_time

2 weeks agoMerge tag 'vfs-7.0-rc1.initrd' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 19:03:25 +0000 (11:03 -0800)] 
Merge tag 'vfs-7.0-rc1.initrd' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs initrd removal from Christian Brauner:
 "Remove the deprecated linuxrc-based initrd code path and related dead
  code. The linuxrc initrd path was deprecated in 2020 and this series
  completes its removal. If we see real-life regressions we'll revert.

  The core change removes handle_initrd() and init_linuxrc() â€” the
  entire flow that ran /linuxrc from an initrd, pivoted roots, and
  handed off to the real root filesystem. With that gone, initrd_load()
  becomes void (no longer short-circuits prepare_namespace()),
  rd_load_image() is simplified to always load /initrd.image instead of
  taking a path, and rd_load_disk() is deleted.

  The /proc/sys/kernel/real-root-dev sysctl and its backing variable are
  removed since they only existed for linuxrc to communicate the real
  root device back to the kernel.

  The no-op load_ramdisk= and prompt_ramdisk= parameters are dropped,
  and noinitrd and ramdisk_start= gain deprecation warnings.

  Initramfs is entirely unaffected. The non-linuxrc initrd path
  (root=/dev/ram0) is preserved but now carries a deprecation warning
  targeting January 2027 removal"

* tag 'vfs-7.0-rc1.initrd' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  init: remove /proc/sys/kernel/real-root-dev
  initrd: remove deprecated code path (linuxrc)
  init: remove deprecated "load_ramdisk" and "prompt_ramdisk" command line parameters

2 weeks agoMerge tag 'vfs-7.0-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Linus Torvalds [Mon, 9 Feb 2026 18:41:56 +0000 (10:41 -0800)] 
Merge tag 'vfs-7.0-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs rust updates from Christian Brauner:
 "Allow inlining C helpers into Rust when using LTO: Add the
  __rust_helper annotation to all VFS-related Rust helper functions.

  Currently, C helpers cannot be inlined into Rust code even under LTO
  because LLVM detects slightly different codegen options between the C
  and Rust compilation units (differing null-pointer-check flags,
  builtin lists, and target feature strings). The __rust_helper macro is
  the first step toward fixing this: it is currently #defined to
  nothing, but a follow-up series will change it to __always_inline when
  compiling with LTO (while keeping it empty for bindgen, which ignores
  inline functions).

  This picks up the VFS portion (fs, pid_namespace, poll) of a larger
  tree-wide series"

* tag 'vfs-7.0-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  rust: poll: add __rust_helper to helpers
  rust: pid_namespace: add __rust_helper to helpers
  rust: fs: add __rust_helper to helpers

2 weeks agoMerge tag 'selinux-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Mon, 9 Feb 2026 18:38:05 +0000 (10:38 -0800)] 
Merge tag 'selinux-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux

Pull selinux updates from Paul Moore:

 - Add support for SELinux based access control of BPF tokens

   We worked with the BPF devs to add the necessary LSM hooks when the
   BPF token code was first introduced, but it took us a bit longer to
   add the SELinux wiring and support.

   In order to preserve existing token-unaware SELinux policies, the new
   code is gated by the new "bpf_token_perms" policy capability.

   Additional details regarding the new permissions, and behaviors can
   be found in the associated commit.

 - Remove a BUG() from the SELinux capability code

   We now perform a similar check during compile time so we can safely
   remove the BUG() call.

* tag 'selinux-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
  selinux: drop the BUG() in cred_has_capability()
  selinux: fix a capabilities parsing typo in selinux_bpf_token_capable()
  selinux: add support for BPF token access control
  selinux: move the selinux_blob_sizes struct

2 weeks agoMerge tag 'lsm-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm
Linus Torvalds [Mon, 9 Feb 2026 18:16:48 +0000 (10:16 -0800)] 
Merge tag 'lsm-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm

Pull lsm updates from Paul Moore:

 - Unify the security_inode_listsecurity() calls in NFSv4

   While looking at security_inode_listsecurity() with an eye towards
   improving the interface, we realized that the NFSv4 code was making
   multiple calls to the LSM hook that could be consolidated into one.

 - Mark the LSM static branch keys as static - this helps resolve some
   sparse warnings

 - Add __rust_helper annotations to the LSM and cred wrapper functions

 - Remove the unsused set_security_override_from_ctx() function

 - Minor fixes to some of the LSM kdoc comment blocks

* tag 'lsm-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/lsm:
  lsm: make keys for static branch static
  cred: remove unused set_security_override_from_ctx()
  rust: security: add __rust_helper to helpers
  rust: cred: add __rust_helper to helpers
  nfs: unify security_inode_listsecurity() calls
  lsm: fix kernel-doc struct member names

2 weeks agoMerge tag 'audit-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoor...
Linus Torvalds [Mon, 9 Feb 2026 18:13:03 +0000 (10:13 -0800)] 
Merge tag 'audit-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit

Pull audit updates from Paul Moore:

 - Improve the NETFILTER_PKT audit records

   Add source and destination ports to the NETFILTER_PKT audit records
   while also consolidating a lot of the code into a new, singular
   audit_log_nf_skb() function. This new approach to structuring the
   NETFILTER_PKT record generation should eliminate some unnecessary
   overhead when audit is not built into the kernel.

 - Update the audit syscall classifier code

   Add the listxattrat(), getxattrat(), and fchmodat2() syscall to the
   audit code which classifies syscalls into categories of operations,
   e.g. "read" or "change attributes".

 - Move the syscall classifier declarations into audit_arch.h

   Shuffle around some header file declarations to resolve some sparse
   warnings.

* tag 'audit-pr-20260203' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit:
  audit: move the compat_xxx_class[] extern declarations to audit_arch.h
  audit: add missing syscalls to read class
  audit: include source and destination ports to NETFILTER_PKT
  audit: add audit_log_nf_skb helper function
  audit: add fchmodat2() to change attributes class

2 weeks agoMerge tag 'tpmdd-next-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkk...
Linus Torvalds [Mon, 9 Feb 2026 18:11:28 +0000 (10:11 -0800)] 
Merge tag 'tpmdd-next-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd

Pull tpm updates from Jarkko Sakkinen.

* tag 'tpmdd-next-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd:
  tpm: st33zp24: Fix missing cleanup on get_burstcount() error
  tpm: tpm_i2c_infineon: Fix locality leak on get_burstcount() failure

2 weeks agoMerge tag 'i3c/for-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux
Linus Torvalds [Mon, 9 Feb 2026 18:06:44 +0000 (10:06 -0800)] 
Merge tag 'i3c/for-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux

Pull i3c updates from Alexandre Belloni:
 "Subsystem:
   - add sysfs entry and attribute for Device NACK Retry count

  Drivers:
   - dw: Device NACK Retry configuration knob
   - mipi-i3c-hci: support multi-bus instances, runtime PM, and suspend
   - renesas: suspend/resume support"

* tag 'i3c/for-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux: (52 commits)
  i3c: dw-i3c-master: fix SIR reject bit mapping for dynamic addresses
  i3c: dw-i3c-master: convert spinlock usage to scoped guards
  i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers()
  i3c: mipi-i3c-hci-pci: Add System Suspend support
  i3c: mipi-i3c-hci: Add optional System Suspend support
  i3c: master: Add i3c_master_do_daa_ext() for post-hibernation address recovery
  i3c: dw: Initialize spinlock to avoid upsetting lockdep
  i3c: mipi-i3c-hci-pci: Add Runtime PM support
  i3c: mipi-i3c-hci: Add optional Runtime PM support
  i3c: master: Introduce optional Runtime PM support
  i3c: mipi-i3c-hci: Factor out master dynamic address setting into helper
  i3c: mipi-i3c-hci: Allow core re-initialization for Runtime PM support
  i3c: mipi-i3c-hci: Factor out core initialization into helper
  i3c: mipi-i3c-hci: Factor out IO mode setting into helper
  i3c: mipi-i3c-hci: Factor out software reset into helper
  i3c: mipi-i3c-hci: Add PIO suspend and resume support
  i3c: mipi-i3c-hci: Refactor PIO register initialization
  i3c: mipi-i3c-hci: Add DMA suspend and resume support
  i3c: mipi-i3c-hci: Extract ring initialization from hci_dma_init()
  i3c: mipi-i3c-hci: Introduce helper to restore DAT
  ...

2 weeks agoMerge tag 'rcu.release.v7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu...
Linus Torvalds [Mon, 9 Feb 2026 17:46:26 +0000 (09:46 -0800)] 
Merge tag 'rcu.release.v7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux

Pull RCU updates from Boqun Feng:

 - RCU Tasks Trace:

   Re-implement RCU tasks trace in term of SRCU-fast, not only more than
   500 lines of code are saved because of the reimplementation, a new
   set of API, rcu_read_{,un}lock_tasks_trace(), becomes possible as
   well. Compared to the previous rcu_read_{,un}lock_trace(), the new
   API avoid the task_struct accesses thanks to the SRCU-fast semantics.

   As a result, the old rcu_read{,un}lock_trace() API is now deprecated.

 - RCU Torture Test:
    - Multiple improvements on kvm-series.sh (parallel run and
      progress showing metrics)
    - Add context checks to rcu_torture_timer()
    - Make config2csv.sh properly handle comments in .boot files
    - Include commit discription in testid.txt

 - Miscellaneous RCU changes:
    - Reduce synchronize_rcu() latency by reporting GP kthread's
      CPU QS early
    - Use suitable gfp_flags for the init_srcu_struct_nodes()
    - Fix rcu_read_unlock() deadloop due to softirq
    - Correctly compute probability to invoke ->exp_current()
      in rcutorture
    - Make expedited RCU CPU stall warnings detect stall-end races

 - RCU nocb:
    - Remove unnecessary WakeOvfIsDeferred wake path and callback
      overload handling
    - Extract nocb_defer_wakeup_cancel() helper

* tag 'rcu.release.v7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux: (25 commits)
  rcu/nocb: Extract nocb_defer_wakeup_cancel() helper
  rcu/nocb: Remove dead callback overload handling
  rcu/nocb: Remove unnecessary WakeOvfIsDeferred wake path
  rcu: Reduce synchronize_rcu() latency by reporting GP kthread's CPU QS early
  srcu: Use suitable gfp_flags for the init_srcu_struct_nodes()
  rcu: Fix rcu_read_unlock() deadloop due to softirq
  rcutorture: Correctly compute probability to invoke ->exp_current()
  rcu: Make expedited RCU CPU stall warnings detect stall-end races
  rcutorture: Add --kill-previous option to terminate previous kvm.sh runs
  rcutorture: Prevent concurrent kvm.sh runs on same source tree
  torture: Include commit discription in testid.txt
  torture: Make config2csv.sh properly handle comments in .boot files
  torture: Make kvm-series.sh give run numbers and totals
  torture: Make kvm-series.sh give build numbers and totals
  torture: Parallelize kvm-series.sh guest-OS execution
  rcutorture: Add context checks to rcu_torture_timer()
  rcutorture: Test rcu_tasks_trace_expedite_current()
  srcu: Create an rcu_tasks_trace_expedite_current() function
  checkpatch: Deprecate rcu_read_{,un}lock_trace()
  rcu: Update Requirements.rst for RCU Tasks Trace
  ...

2 weeks agoMerge tag 'linux_kselftest-next-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kerne...
Linus Torvalds [Mon, 9 Feb 2026 17:42:21 +0000 (09:42 -0800)] 
Merge tag 'linux_kselftest-next-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kselftest updates from Shuah Khan:
 "resctrl test:
   - fix division by zero error on Hygon
   - fix non-contiguous CBM check for Hygon
   - define CPU vendor IDs as bits to match usage
   - add CPU vendor detection for Hygon

  misc:
   - coredeump test: use __builtin_trap() instead of a null pointer
   - anon_inode: replace null pointers with empty arrays
   - kublk: include message in _Static_assert for C11 compatibility
   - run_kselftest.sh: add `--skip` argument option
   - pidfd: fix typo in comment"

* tag 'linux_kselftest-next-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  selftests/pidfd: fix typo in comment
  selftests/run_kselftest.sh: Add `--skip` argument option
  selftests/resctrl: Fix non-contiguous CBM check for Hygon
  selftests/resctrl: Add CPU vendor detection for Hygon
  selftests/resctrl: Define CPU vendor IDs as bits to match usage
  selftests/resctrl: Fix a division by zero error on Hygon
  kselftest/kublk: include message in _Static_assert for C11 compatibility
  kselftest/anon_inode: replace null pointers with empty arrays
  kselftest/coredump: use __builtin_trap() instead of null pointer

2 weeks agoMerge tag 'linux_kselftest-kunit-6.20-rc1' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Mon, 9 Feb 2026 17:37:55 +0000 (09:37 -0800)] 
Merge tag 'linux_kselftest-kunit-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull kunit updates from Shuah Khan:
 "kunit:
   - add __rust_helper to helpers
   - fix up const mismatch in many assert functions
   - fix up const mismatch in test_list_sort
   - protect KUNIT_BINARY_STR_ASSERTION against ERR_PTR values
   - respect KBUILD_OUTPUT env variable by default
   - add bash completion

  kunit tool:
   - add test for nested test result reporting
   - do not overwrite test status based on subtest counts
   - add 32-bit big endian ARM configuration to qemu_configs
   - rename test_data_path() to _test_data_path()
   - do not rely on implicit working directory change"

* tag 'linux_kselftest-kunit-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  kunit: add bash completion
  kunit: tool: test: Don't rely on implicit working directory change
  kunit: tool: test: Rename test_data_path() to _test_data_path()
  kunit: qemu_configs: Add 32-bit big endian ARM configuration
  kunit: tool: Don't overwrite test status based on subtest counts
  kunit: tool: Add test for nested test result reporting
  kunit: respect KBUILD_OUTPUT env variable by default
  kunit: Protect KUNIT_BINARY_STR_ASSERTION against ERR_PTR values
  test_list_sort: fix up const mismatch
  kunit: fix up const mis-match in many assert functions
  rust: kunit: add __rust_helper to helpers

2 weeks agoMerge tag 'auxdisplay-v6.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy...
Linus Torvalds [Mon, 9 Feb 2026 17:32:33 +0000 (09:32 -0800)] 
Merge tag 'auxdisplay-v6.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-auxdisplay

Pull auxdisplay updates from Andy Shevchenko:

 - A good refactoring of arm-charlcd to use modern kernel APIs

* tag 'auxdisplay-v6.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-auxdisplay:
  auxdisplay: max6959: Replace slab.h with device/devres.h
  auxdisplay: arm-charlcd: Remove redundant ternary operators
  auxdisplay: arm-charlcd: Join string literals back
  auxdisplay: arm-charlcd: Use readl_poll_timeout
  auxdisplay: arm-charlcd: Don't use "proxy" headers
  auxdisplay: arm-charlcd: drop of_match_ptr()
  auxdisplay: arm-charlcd: Remove unneeded info message
  auxdisplay: arm-charlcd: convert to use device managed APIs
  auxdisplay: arm-charlcd: fix release_mem_region() size

2 weeks agocifs: Fix the copyright banner on smb1maperror.c
David Howells [Mon, 9 Feb 2026 14:07:05 +0000 (14:07 +0000)] 
cifs: Fix the copyright banner on smb1maperror.c

Fix the copyright banner on smb1maperror.c to be the same as netmisc.c.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb: common: add header guards to fs/smb/common/smb2status.h
Stefan Metzmacher [Tue, 3 Feb 2026 15:20:12 +0000 (16:20 +0100)] 
smb: common: add header guards to fs/smb/common/smb2status.h

This will allow it to be included multiple times without problems,
that's needed for the smbdirect move to common code.

Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb: client: Avoid a dozen -Wflex-array-member-not-at-end warnings
Gustavo A. R. Silva [Mon, 10 Nov 2025 11:48:55 +0000 (20:48 +0900)] 
smb: client: Avoid a dozen -Wflex-array-member-not-at-end warnings

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

Move the conflicting declaration to the end of the corresponding
structure. Notice that struct smb2_file_all_info is a flexible
structure, this is a structure that contains a flexible-array
member.

Fix the following warnings:

12 fs/smb/client/cached_dir.h:51:35: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: remove useless comment in mapping_table_ERRSRV
Huiwen He [Wed, 21 Jan 2026 11:49:12 +0000 (19:49 +0800)] 
smb/client: remove useless comment in mapping_table_ERRSRV

These array elements have already been defined.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: remove some literal NT error codes from ntstatus_to_dos_map
Huiwen He [Wed, 21 Jan 2026 11:49:11 +0000 (19:49 +0800)] 
smb/client: remove some literal NT error codes from ntstatus_to_dos_map

When an NT error code is not in ntstatus_to_dos_map, ntstatus_to_dos()
will return the default ERRHRD and ERRGENERAL.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_VOLUME_NOT_UPGRADED
Huiwen He [Wed, 21 Jan 2026 11:49:10 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_VOLUME_NOT_UPGRADED

See MS-ERREf 2.3.1 STATUS_VOLUME_NOT_UPGRADED.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_NO_USER_KEYS
Huiwen He [Wed, 21 Jan 2026 11:49:09 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_NO_USER_KEYS

See MS-ERREf 2.3.1 STATUS_NO_USER_KEYS.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_WRONG_EFS
Huiwen He [Wed, 21 Jan 2026 11:49:08 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_WRONG_EFS

See MS-ERREf 2.3.1 STATUS_WRONG_EFS.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_NO_EFS
Huiwen He [Wed, 21 Jan 2026 11:49:07 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_NO_EFS

See MS-ERREf 2.3.1 STATUS_NO_EFS.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_NO_RECOVERY_POLICY
Huiwen He [Wed, 21 Jan 2026 11:49:06 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_NO_RECOVERY_POLICY

See MS-ERREf 2.3.1 STATUS_NO_RECOVERY_POLICY.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_RANGE_NOT_FOUND
Huiwen He [Wed, 21 Jan 2026 11:49:05 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_RANGE_NOT_FOUND

See MS-ERREf 2.3.1 STATUS_RANGE_NOT_FOUND.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_DECRYPTION_FAILED
Huiwen He [Wed, 21 Jan 2026 11:49:04 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_DECRYPTION_FAILED

See MS-ERREf 2.3.1 STATUS_DECRYPTION_FAILED.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_ENCRYPTION_FAILED
Huiwen He [Wed, 21 Jan 2026 11:49:03 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_ENCRYPTION_FAILED

See MS-ERREf 2.3.1 STATUS_ENCRYPTION_FAILED.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_DIRECTORY_IS_A_REPARSE_POINT
Huiwen He [Wed, 21 Jan 2026 11:49:02 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_DIRECTORY_IS_A_REPARSE_POINT

See MS-ERREf 2.3.1 STATUS_DIRECTORY_IS_A_REPARSE_POINT.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_VOLUME_DISMOUNTED
Huiwen He [Wed, 21 Jan 2026 11:49:01 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_VOLUME_DISMOUNTED

See MS-ERREf 2.3.1 STATUS_VOLUME_DISMOUNTED.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT
Huiwen He [Wed, 21 Jan 2026 11:49:00 +0000 (19:49 +0800)] 
smb/client: add NT_STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT

See MS-ERREf 2.3.1 STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_VARIABLE_NOT_FOUND
Huiwen He [Wed, 21 Jan 2026 11:48:59 +0000 (19:48 +0800)] 
smb/client: add NT_STATUS_VARIABLE_NOT_FOUND

See MS-ERREf 2.3.1 STATUS_VARIABLE_NOT_FOUND.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: rename ERRinvlevel to ERRunknownlevel
Huiwen He [Wed, 21 Jan 2026 11:48:58 +0000 (19:48 +0800)] 
smb/client: rename ERRinvlevel to ERRunknownlevel

See MS-CIFS 2.2.2.4 ERRunknownlevel. Keep the name consistent with the
documentation.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: add NT_STATUS_OS2_INVALID_LEVEL
Huiwen He [Wed, 21 Jan 2026 11:48:57 +0000 (19:48 +0800)] 
smb/client: add NT_STATUS_OS2_INVALID_LEVEL

See MS-CIFS 2.2.2.4 STATUS_OS2_INVALID_LEVEL.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: map NT_STATUS_INVALID_INFO_CLASS to ERRbadpipe
Huiwen He [Wed, 21 Jan 2026 11:48:56 +0000 (19:48 +0800)] 
smb/client: map NT_STATUS_INVALID_INFO_CLASS to ERRbadpipe

See MS-CIFS 2.2.2.4 STATUS_INVALID_INFO_CLASS.

Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: introduce KUnit test to check search result of smb2_error_map_table
ChenXiaoSong [Sun, 18 Jan 2026 09:13:13 +0000 (17:13 +0800)] 
smb/client: introduce KUnit test to check search result of smb2_error_map_table

The KUnit test are executed when cifs.ko is loaded.

Just like `fs/ext4/mballoc.c` includes `fs/ext4/mballoc-test.c`.
`smb2maperror.c` also includes `smb2maperror_test.c`, allowing KUnit
tests to access any functions and variables in `smb2maperror.c`.

The maperror_test_check_search() checks whether all elements can be
correctly found in the array.

Suggested-by: David Howells <dhowells@redhat.com>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: use bsearch() to find target in smb2_error_map_table
ChenXiaoSong [Tue, 23 Dec 2025 09:24:40 +0000 (17:24 +0800)] 
smb/client: use bsearch() to find target in smb2_error_map_table

The smb2_error_map_table array currently has 1740 elements. When searching
for the last element, the original loop-based search method requires 1740
comparisons, while binary search algorithm requires only 10 comparisons.

Suggested-by: David Howells <dhowells@redhat.com>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/linux-cifs/20260106071507.1420900-5-chenxiaosong.chenxiaosong@linux.dev/
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agosmb/client: check whether smb2_error_map_table is sorted in ascending order
ChenXiaoSong [Wed, 24 Dec 2025 01:33:28 +0000 (09:33 +0800)] 
smb/client: check whether smb2_error_map_table is sorted in ascending order

Although the array is sorted at build time, verify the ordering again
when cifs.ko is loaded to avoid potential regressions introduced by
future script changes.

Suggested-by: David Howells <dhowells@redhat.com>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/linux-cifs/20260106071507.1420900-4-chenxiaosong.chenxiaosong@linux.dev/
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Autogenerate SMB2 error mapping table
David Howells [Tue, 23 Dec 2025 00:05:34 +0000 (00:05 +0000)] 
cifs: Autogenerate SMB2 error mapping table

Autogenerate the SMB2 status to error code mapping table, from the
smb2status.h common header, sorting it by NT status code so that it can be
searched by binary chopping. This also reduces the number of places this
list is duplicated in the source.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <stfrench@microsoft.com>
cc: ChenXiaoSong <chenxiaosong@kylinos.cn>
cc: linux-cifs@vger.kernel.org
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/linux-cifs/20260106071507.1420900-3-chenxiaosong.chenxiaosong@linux.dev/
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Label SMB2 statuses with errors
David Howells [Tue, 23 Dec 2025 00:04:01 +0000 (00:04 +0000)] 
cifs: Label SMB2 statuses with errors

Label the SMB2 status entries with error codes as a prelude to
autogenerating the mapping table.  This was done with the following script:

        #!/usr/bin/perl -w
        use strict;

        my @error_mapping_table = ();
        my %statuses = ();

        #
        # Read the status list
        #
        my $f = "fs/smb/common/smb2status.h";
        open FILE, "<$f" || die $f;
        my @contents = <FILE>;
        close FILE || die;

        my $l = 0;
        foreach (@contents) {
            $l++;
            if (m!^#define\s*([A-Za-z0-9_]+)\s+cpu_to_le32[(]([0-9a-fA-Fx]+)[)]!) {
                my $status = $1;
                my $code = $2;
                my $s;

                next if ($status =~ /^STATUS_SEVERITY/);

                if (exists($statuses{$status})) {
                    print("$f:$l: Duplicate declaration of ", $s->{status}, "\n");
                } else {
                    my %_s = (
                        status => $status,
                        code   => hex($code)
                        );
                    $statuses{$status} = \%_s;
                }
            }
        }

        #
        # Read the SMB2 status => error mapping table
        #
        $f = "fs/smb/client/smb2maperror.c";
        open(MFILE, "<$f") || die $f;
        my @maperror = <MFILE>;
        close MFILE || die;

        my $parse = 0;
        my $acc = "";
        $l = 0;
        foreach my $line (@maperror) {
            chomp $line;
            $l++;
            if ($parse == 0 &&
                $line =~ /^static const struct status_to_posix_error smb2_error_map_table/) {
                $parse = 1;
                next;
            }

            last if ($parse >= 1 && $line =~ /^[}];/);

            if ($parse == 1) {
                if ($line =~ /[\t][{].*[}],/) {
                    $acc = $line;
                    $parse = 3;
                } elsif ($line =~ /[\t][{].*/) {
                    $acc = $line;
                    $parse = 2;
                    next;
                } elsif ($line =~ m!^\s*/[*].*[*]/!) {
                    next;
                } else {
                    die "smb2maperror.c:$l: unparseable mapping element\n";
                }
            }
            if ($parse == 2) {
                if ($line =~ /.*[}],/) {
                    $acc .= $line;
                    $parse = 3;
                } else {
                    $acc .= $line;
                }
            }

            if ($parse == 3) {
                $acc =~ s/\s+//g;
                if ($acc =~ m/[{](.*)[}]/) {
                    $acc = $1;
                } else {
                    die "'$acc'";
                }
                my ($status, $error, $string) = split(/,/, $acc);

                if (exists($statuses{$status})) {
                    my $s = $statuses{$status};

                    if (exists($s->{error})) {
                        print("$f:$l: Dup mapping entry $status\n");
                    }

                    $s->{error} = $error;
                    #print $s->{code}, " => ", $error, "\n";
                } else {
                    print STDERR "$f:$l: Unknown status $status\n";
                }

                $acc = "";
                $parse = 1;
            }
        }

        #
        # Sort the error table by STATUS_* value
        #
        my @order = ();

        foreach my $status (keys(%statuses)) {
            my $s = $statuses{$status};
            push @order, $s;
            unless (exists($s->{code})) {
                print("Unknown code for ", $s->{status}, "\n")
            } else {
                #print("Code for ", $s->{status}, " is ", $s->{code}, "\n");
            }
        }

        @order = sort( { $a->{code} <=> $b->{code} } @order);

        foreach my $s (@order) {
            my $status = $s->{status};
            my $error  = $s->{error};
            my $code   = $s->{code};

            my $pad = " ";
            if (length($status) < 32) {
                my $n = 32 - length($status);
                $pad = "\t" x ((($n-1) / 8) + 1);
            }
            #printf("#define %s%scpu_to_le32(0x%08x) // -%s\n", $status, $pad, $code, $error);
            #printf("\t%s%s= 0x%08x, // -%s\n", $status, $pad, $code, $error);
        }

        #
        # Decorate the definitions
        #
        my @output = ();
        for (my $i = 0; $i <= $#contents; $i++) {
            my $line = $contents[$i];
            if ($line =~ m!^#define\s*([A-Za-z0-9_]+)\s+cpu_to_le32[(]([0-9a-fA-Fx]+)[)]!) {
                my $status = $1;
                my $code = $2;

                if ($status =~ /^STATUS_SEVERITY/) {
                    push @output, $line;
                    next;
                }

                my $pad = " ";
                if (length($status) < 40) {
                    my $n = 40 - length($status);
                    $pad = "\t" x ((($n-1) / 8) + 1);
                }

                my $s = $statuses{$1};
                my $error = "EIO";
                if (exists($s->{error})) {
                    $error = $s->{error};
                } else {
                    if (!$s->{code}) {
                        print "ZERO ", $status, "\n";
                        $error = "0";
                    } else {
                        $error = "-EIO";
                    }
                }

                #my $rev = "#define " . $status . $pad . "_S(" . $2 . ", " . $error . ")\n";
                my $rev = "#define " . $status . $pad . "cpu_to_le32(" . $2 . ") // " . $error . "\n";

                push @output, $rev;
            } else {
                push @output, $line;
            }
        }

        open FILE, ">fs/smb/common/smb2status.h" || die;
        print FILE @output;
        close FILE || die;

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <stfrench@microsoft.com>
cc: ChenXiaoSong <chenxiaosong@kylinos.cn>
cc: linux-cifs@vger.kernel.org
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/linux-cifs/20260106071507.1420900-2-chenxiaosong.chenxiaosong@linux.dev/
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Make BCC accessors conditional
David Howells [Wed, 17 Dec 2025 21:23:56 +0000 (21:23 +0000)] 
cifs: SMB1 split: Make BCC accessors conditional

Make the BCC accessor functions conditional.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: connect.c
David Howells [Wed, 17 Dec 2025 17:41:38 +0000 (17:41 +0000)] 
cifs: SMB1 split: connect.c

Split SMB1-specific connection management stuff to smb1ops.c and move
CIFSTCon() to cifssmb.c.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: sess.c
David Howells [Wed, 17 Dec 2025 16:14:36 +0000 (16:14 +0000)] 
cifs: SMB1 split: sess.c

Split SMB1-specific session setup stuff into smb1session.c.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: cifsencrypt.c
David Howells [Wed, 17 Dec 2025 15:34:08 +0000 (15:34 +0000)] 
cifs: SMB1 split: cifsencrypt.c

Split SMB1-specific message signing into smb1encrypt.c.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: netmisc.c
David Howells [Wed, 17 Dec 2025 15:25:59 +0000 (15:25 +0000)] 
cifs: SMB1 split: netmisc.c

Split a variety of bits from netmisc.c into other places, notably the error
table into smb1maperror.c.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: misc.c
David Howells [Wed, 17 Dec 2025 15:22:19 +0000 (15:22 +0000)] 
cifs: SMB1 split: misc.c

Split SMB1 bits from misc.c to smb1misc.c.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: cifs_debug.c
David Howells [Wed, 17 Dec 2025 12:53:23 +0000 (12:53 +0000)] 
cifs: SMB1 split: cifs_debug.c

Split SMB1 bits from cifs_debug.c to smb1debug.c.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Move inline funcs
David Howells [Wed, 17 Dec 2025 15:14:22 +0000 (15:14 +0000)] 
cifs: SMB1 split: Move inline funcs

Move some SMB1-specific inline funcs to smb1proto.h.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Fix cifs_dump_mids() to call ->dump_detail
David Howells [Wed, 17 Dec 2025 15:44:07 +0000 (15:44 +0000)] 
cifs: Fix cifs_dump_mids() to call ->dump_detail

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Don't return smb_hdr from cifs_{,small_}buf_get()
David Howells [Wed, 17 Dec 2025 17:47:22 +0000 (17:47 +0000)] 
cifs: SMB1 split: Don't return smb_hdr from cifs_{,small_}buf_get()

Return void* rather than struct smb_hdr* from from cifs_buf_get() and
cifs_small_buf_get() as SMB2/3 shouldn't be accessing smb_hdr.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Move BCC access functions
David Howells [Wed, 17 Dec 2025 15:09:39 +0000 (15:09 +0000)] 
cifs: SMB1 split: Move BCC access functions

Move the BCC access functions to smb1proto.h as they're only applicable to
SMB1.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Adjust #includes
David Howells [Wed, 17 Dec 2025 15:03:25 +0000 (15:03 +0000)] 
cifs: SMB1 split: Adjust #includes

Adjust the #include set after the removal of the SMB1 protocol defs from
cifspdu.h.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Split SMB1 protocol defs into smb1pdu.h
David Howells [Wed, 17 Dec 2025 13:22:00 +0000 (13:22 +0000)] 
cifs: SMB1 split: Split SMB1 protocol defs into smb1pdu.h

Split SMB1 protocol defs into smb1pdu.h.  This should perhaps go in the
common/ directory.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Add some #includes
David Howells [Wed, 17 Dec 2025 22:06:22 +0000 (22:06 +0000)] 
cifs: SMB1 split: Add some #includes

Add some #includes to make sure things continue to compile as splitting
occurs.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Move some SMB1 received PDU checking bits to smb1transport.c
David Howells [Thu, 11 Sep 2025 13:09:17 +0000 (14:09 +0100)] 
cifs: SMB1 split: Move some SMB1 received PDU checking bits to smb1transport.c

Move some SMB1 received checking bits to smb1transport.c from misc.c
so that they're with the rest of the receive handling code.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Move some SMB1 receive bits to smb1transport.c
David Howells [Wed, 10 Sep 2025 07:47:09 +0000 (08:47 +0100)] 
cifs: SMB1 split: Move some SMB1 receive bits to smb1transport.c

Move some SMB1 receive bits to smb1transport.c from smb1ops.c where they're
mixed in with unrelated code to do with encoding, decoding and processing
PDUs.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Separate out SMB1 decls into smb1proto.h
David Howells [Wed, 17 Dec 2025 09:42:22 +0000 (09:42 +0000)] 
cifs: SMB1 split: Separate out SMB1 decls into smb1proto.h

Separate out SMB1 declarations scriptedly into smb1proto.h.  Script below:

#!/usr/bin/perl -w
use strict;
unless (@ARGV) {
    die "Usage: $0 <c_file1> [<c_file2> ...]\n";
}

# Data tracking
my %funcs = (); # Func name => { func prototype }
my %headers = (); # Header filename => { header content }
my %c_files = (); # C filename => { ordered func list, header pref }
my %cmarkers = (); # C filename marker => { header filename it's in }

# Parse state
my $pathname = "-";
my $lineno = 0;

sub error(@) {
    print STDERR $pathname, ":", $lineno, ": ", @_, "\n";
    exit(1);
}

sub pad($) {
    # Reindent the function arguments to line the arguments up with the char
    # after the opening bracket on the func argument list
    my ($lines) = @_;
    return $lines if ($#{$lines} <= 0);
    my $has_empty = 0;
    for (my $i = 0; $i <= $#{$lines}; $i++) {
$lines->[$i] =~ s/^[ \t]+//;
$has_empty = 1 if ($lines->[$i] eq "");
    }

    if ($has_empty) {
my @clean = grep /.+/, @{$lines};
$lines = \@clean;
    }

    my $indlen = index($lines->[0], "(");
    return $lines if ($indlen < 0);
    my $indent = "";
    $indlen++;
    $indent .= "\t" x ($indlen / 8);
    $indent .= " " x ($indlen % 8);

    my @padded = ();
    my $acc = "";
    my $len = -$indlen;
    for (my $i = 0; $i <= $#{$lines}; $i++) {
my $argument = $lines->[$i];
my $arglen = length($argument);
my $last = ($i == $#{$lines} ? 1 : 0);

if ($i == 0 ||
    $i == 1) {
    $acc .= $argument;
    $acc .= ";" if ($last);
    $len += $arglen + $last;
    next;
}
if (!$acc) {
    $acc = $indent . $argument;
    $acc .= ";" if ($last);
    $len += $arglen + $last;
    next;
}
if ($indlen + $len + 1 + $arglen + $last > 79) {
    push @padded, $acc;
    $acc = $indent . $argument;
    $acc .= ";" if ($last);
    $len = $arglen + $last;
    next;
}

$acc .= " " . $argument;
$acc .= ";" if ($last);
$len += 1 + $arglen + $last;
    }
    push @padded, $acc if ($acc);
    return \@padded;
}

sub earliest(@) {
    my $ret = -1;
    foreach (@_) {
$ret = $_ if ($ret < 0 || ($_ >= 0 && $_ < $ret));
    }
    return $ret;
}

foreach my $file (@ARGV) {
    # Open the file for reading.
    next if $file =~ /trace[.]h$/;
    next if $file =~ /smbdirect[.][ch]$/;
    open my $fh, "<$file"
or die "Could not open file '$file'";
    $pathname = $file;
    $lineno = 0;

    my $filename;
    my @file_content = ();
    my @copy = ();

    my $state = 0;
    my $qual = "";
    my $type = "";
    my $funcname = "";
    my @funcdef = ();
    my $bracket = 0;
    my $comment = 0;
    my $smb1 = 0;
    my $header = 0;
    my $inline = 0;
    my $file_marker = "";
    my $config = "";
    my $c_file = 0;

    $filename = $pathname;
    $filename =~ s!.*/!!;

    if ($file =~ m!.h$!) {
my %new_h_file = (
    path    => $pathname,
    fname   => $filename,
    content => [],
    );
$header = \%new_h_file;
$headers{$filename} = \%new_h_file;
    } elsif ($file =~ m!.c$!) {
my %new_c_file = (
    path  => $pathname,
    fname => $filename,
    funcs => [],
    );
$c_file = \%new_c_file;
$c_files{$filename} = \%new_c_file;
    } else {
warn("Ignoring unexpected file $file\n");
next;
    }

    $smb1 = 1 if ($file =~ m!/smb1ops.c|/cifssmb.c|/cifstransport.c!);

    foreach my $line (<$fh>) {
$lineno++;
chomp($line);
push @copy, $line;
if (!$line) {
    # Blank line
    push @file_content, @copy;
    @copy = ();
    next;
}

# Handle continuation or end of block comment.  Look for C file
# prototype insertion point markers.
if ($comment) {
    if ($line =~ m![*]/!) {
if ($comment == 2 && $file_marker) {
    $cmarkers{$file_marker} = $file_marker;
    push @copy, "#C_MARKER " . $file_marker;
    $file_marker = 0;
}
$comment = 0;
    } else {
$comment++;
if ($comment == 2 && $line =~ m! [*] ([a-z][a-z_0-9]*[.][c])$!) {
    $file_marker = $1;
    print("Found file marker ", $file_marker, " in ", $filename, "\n");
}
    }
    push @file_content, @copy;
    @copy = ();
    next;
}

# Check cpp directives, particularly looking for SMB1 bits
if ($line =~ /^[#]/) {
    if ($header) {
if ($line =~ /ifdef.*(CONFIG_[A-Z0-9_])/) {
    error("multiconfig") if $config;
    $config = $1;
    $smb1++ if ($config eq "CONFIG_CIFS_ALLOW_INSECURE_LEGACY");
} elsif ($line =~ /endif/) {
    $smb1-- if ($config eq "CONFIG_CIFS_ALLOW_INSECURE_LEGACY");
    $config = "";
}
    }
    push @file_content, @copy;
    @copy = ();
    next;
}

# Exclude interference in finding func names and return types
if ($line =~ /^[{]/ ||
    $line =~ /##/ ||
    $line =~ /^[_a-z0-9A-Z]+:$/ || # goto label
    $line =~ /^do [{]/ ||
    $line =~ m!^//!) {
    push @file_content, @copy;
    @copy = ();
    next;
}

# Start of a block comment
if ($line =~ m!^/[*]!) {
    $comment = 1 unless ($line =~ m![*]/!);
    push @file_content, @copy;
    @copy = ();
    next;
}

# End of a braced section, such as a function implementation
if ($line =~ /^[}]/) {
$type = "";
$qual = "";
$funcname = "";
@funcdef = ();
push @file_content, @copy;
@copy = ();
next;
}

if ($line =~ /^typedef/) {
    $type = "";
    $qual = "";
    $funcname = "";
    @funcdef = ();
    push @file_content, @copy;
    @copy = ();
    next;
}

# Extract function qualifiers.  There may be multiple of these in more
# or less any order.  Some of them cause the func to be skipped (e.g. inline).

if ($line =~ /^(static|extern|inline|noinline|noinline_for_stack|__always_inline)\W/ ||
    $line =~ /^(static|extern|inline|noinline|noinline_for_stack|__always_inline)$/) {
    error("Unexpected qualifier '$1'") if ($state != 0);
    while ($line =~ /^(static|extern|inline|noinline|noinline_for_stack|__always_inline)\W/ ||
   $line =~ /^(static|extern|inline|noinline|noinline_for_stack|__always_inline)$/) {
$qual .= " " if ($qual);
$qual .= $1;
$inline = 1 if ($1 eq "inline");
$inline = 1 if ($1 eq "__always_inline");
$line = substr($line, length($1));
$line =~ s/^\s+//;
    }
}

if ($state == 0) {
    # Extract what we assume to be the return type
    if ($line =~ /^\s/) {
push @file_content, @copy;
@copy = ();
next;
    }
    while ($line =~ /^(unsigned|signed|bool|char|short|int|long|void|const|volatile|(struct|union|enum)\s+[_a-zA-Z][_a-zA-Z0-9]*|[*]|__init|__exit|__le16|__le32|__le64|__be16|__be32|__be64)/) {
$type .= " " if $type;
$type .= $1;
$line = substr($line, length($1));
$line =~ s/^\s+//;
    }
    if ($line =~ /^struct [{]/) {
# Ignore structure definitions
$type = "";
$qual = "";
$funcname = "";
@funcdef = ();
push @file_content, @copy;
@copy = ();
next;
    }
    if (index($line, "=") >= 0) {
# Ignore assignments
$type = "";
$qual = "";
$funcname = "";
@funcdef = "";
push @file_content, @copy;
@copy = ();
next;
    }

    # Try and extract a function's type and name
    while ($line =~ /(^[_a-zA-Z][_a-zA-Z0-9]*)/) {
my $name = $1;
$line = substr($line, length($name));
next if ($line =~ /^[{]/);
$line =~ s/^\s+//;

my $ch = substr($line, 0, 1);
last if ($ch eq "[" || $ch eq ";"); # Global variables

if ($ch eq "(") {
    # Found the function name
    $state = 1;
    $line = substr($line, 1);
    $funcname = $name;
    my $tmp = $qual . $type . " " . $funcname . "(";
    $tmp =~ s/[*] /*/;
    push @funcdef, $tmp;
    $bracket = 1;
    last;
}

if ($type) {
    last if (index($line, ";") >= 0 && index($line, "(") == -1);
    error("Unexpected name '$name' after '$type'");
}

$type .= " " if $type;
$type .= $name;
if ($line =~ /^(\s*[*]+)/) {
    my $ptr = $1;
    $type .= $ptr;
    $line = substr($line, length($ptr));
}
    }
}

# Try and extract a function's argument list
my $from = 0;
if ($state == 1) {
    while (1) {
my $o = index($line, "(", $from);
my $c = index($line, ")", $from);
my $m = index($line, ",", $from);

my $b = earliest($o, $c, $m);
if ($b < 0) {
    push @funcdef, $line
unless ($line eq "");
    last;
}
my $ch = substr($line, $b, 1);

# Push the arguments separately on to the list
if ($ch eq ",") {
    push @funcdef, substr($line, 0, $b + 1);
    $line = substr($line, $b + 1);
    $from = 0;
} elsif ($ch eq "(") {
    # Handle brackets in the argument list (e.g. function
    # pointers)
    $bracket++;
    $from = $b + 1;
} elsif ($ch eq ")") {
    $bracket--;
    if ($bracket == 0) {
push @funcdef, substr($line, 0, $b + 1);
$line = substr($line, $b + 1);
$state = 2;
last;
    }
    $from = $b + 1;
}
    }
}

if ($state == 2) {
    $inline = 1 if ($qual =~ /inline/);
    #print("QUAL $qual $type $funcname $inline ", $#funcdef, "\n");
    if (!$header &&
$qual !~ /static/ &&
$funcname ne "__acquires" &&
$funcname ne "__releases" &&
$funcname ne "module_init" &&
$funcname ne "module_exit" &&
$funcname ne "module_param" &&
$funcname ne "module_param_call" &&
$funcname ne "PROC_FILE_DEFINE" &&
$funcname !~ /MODULE_/ &&
$funcname !~ /DEFINE_/) {

# Okay, we appear to have a function implementation
my $func;
my $dup = 0;

if (exists($funcs{$funcname})) {
    $func = $funcs{$funcname};
    if (exists $func->{body}) {
print("dup $funcname\n");
$dup = 1;
    }
} else {
    my %new_func = (
name => $funcname,
cond => "",
legacy => 0,
);
    $func = \%new_func;
    $funcs{$funcname} = $func;
    $func->{body} = pad(\@funcdef);
}
$func->{body} = pad(\@funcdef);
$func->{legacy} = 1 if $smb1;

if ($funcname eq "cifs_inval_name_dfs_link_error") {
    $func->{cond} = "#ifdef CONFIG_CIFS_DFS_UPCALL";
} elsif ($funcname eq "cifs_listxattr") {
    $func->{cond} = "#ifdef CONFIG_CIFS_XATTR";
}

push @{$c_file->{funcs}}, $func
    unless $dup;
    } elsif (!$header || $inline) {
# Ignore inline function implementations and other weirdies
push @file_content, @copy;
    } elsif ($header && !$inline) {
push @file_content, "#FUNCPROTO " . $funcname;

my $func;

if (exists($funcs{$funcname})) {
    $func = $funcs{$funcname};
    $func->{lineno} = $lineno;
    $func->{pathname} = $pathname;
} else {
    my %new_func = (
name => $funcname,
cond => "",
lineno => $lineno,
pathname => $pathname,
legacy => 0,
);
    $func = \%new_func;
    $funcs{$funcname} = $func;
}

$func->{legacy} = 1 if $smb1;
    }

    @funcdef = ();
    $type = "";
    $qual = "";
    $funcname = "";
    $inline = 0;
    $state = 0;
    @copy = ();
}
if ($line =~ /;/) {
    $type = "";
    $qual = "";
    $funcname = "";
    @funcdef = ();
    $state = 0;
    push @file_content, @copy;
    @copy = ();
}
    }
    close($fh);

    if ($header) {
$header->{content} = \@file_content;
    }
}

sub write_header($)
{
    my ($header) = @_;
    my $path = $header->{path};
    my $legacy = 0;

    $legacy = 1 if ($path =~ m!smb1proto[.]h!);

    my @output = ();

    foreach my $line (@{$header->{content}}) {
if ($line =~ "^[#]C_MARKER (.*)") {
    my $file_marker = $cmarkers{$1};
    my $c_file = $c_files{$file_marker};
    print("Found $line\n");
    foreach my $func (@{$c_file->{funcs}}) {
print("func ", $func->{name}, "\n");
push @output, @{$func->{body}};
    }
    next;
} elsif ($line =~ "^[#]FUNCPROTO ([_a-zA-Z0-9]+)") {
    my $funcname = $1;
    my $func = $funcs{$funcname};
    if (!$func->{body}) {
print($func->{pathname}, ":", $func->{lineno}, ": '", $funcname,
      "' dead prototype\n");
next;
    }
    if ($func->{legacy} == $legacy) {
#push @output, $line;
push @output, @{$func->{body}};
    }
} else {
    push @output, $line;
}
    }

    open my $fh, ">$path"
or die "Could not open file '$path' for writing";
    foreach my $f (@output) {
print($fh $f, "\n") or die $path;
    }
    close($fh) or die $path;
}

foreach my $h (keys(%headers)) {
    write_header($headers{$h});
}

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Create smb1proto.h for SMB1 declarations
David Howells [Wed, 17 Dec 2025 09:54:35 +0000 (09:54 +0000)] 
cifs: SMB1 split: Create smb1proto.h for SMB1 declarations

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: SMB1 split: Rename cifstransport.c
David Howells [Wed, 17 Dec 2025 16:10:05 +0000 (16:10 +0000)] 
cifs: SMB1 split: Rename cifstransport.c

Rename cifstransport.c to smb1transport.c in order to give consistent names
SMB1-specific files.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/ntlmssp.h
David Howells [Thu, 11 Dec 2025 11:50:51 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/ntlmssp.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/reparse.h
David Howells [Thu, 11 Dec 2025 11:50:51 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/reparse.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/smb2proto.h
David Howells [Thu, 11 Dec 2025 11:50:51 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/smb2proto.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/cifs_debug.h
David Howells [Thu, 11 Dec 2025 11:50:51 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/cifs_debug.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/cifs_swn.h
David Howells [Thu, 11 Dec 2025 11:50:50 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/cifs_swn.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/compress.h
David Howells [Thu, 11 Dec 2025 11:50:50 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/compress.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/cifs_spnego.h
David Howells [Thu, 11 Dec 2025 11:50:49 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/cifs_spnego.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/fs_context.h
David Howells [Thu, 11 Dec 2025 11:50:49 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/fs_context.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/fscache.h
David Howells [Thu, 11 Dec 2025 11:50:49 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/fscache.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/cifsglob.h
David Howells [Thu, 11 Dec 2025 11:50:49 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/cifsglob.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
2 weeks agocifs: Scripted clean up fs/smb/client/dns_resolve.h
David Howells [Thu, 11 Dec 2025 11:50:48 +0000 (11:50 +0000)] 
cifs: Scripted clean up fs/smb/client/dns_resolve.h

Remove externs, correct argument names and reformat declarations.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>