1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-11 17:10:13 +00:00

Compare commits

...

61 Commits

Author SHA1 Message Date
Linus Torvalds
187d080140 Crypto library fixes for v6.19-rc1
Fixes for some recent regressions as well as some longstanding issues:
 
  - Fix incorrect output from the arm64 NEON implementation of GHASH
 
  - Merge the ksimd scopes in the arm64 XTS code to reduce stack usage
 
  - Roll up the BLAKE2b round loop on 32-bit kernels to greatly reduce
    code size and stack usage
 
  - Add missing RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS dependency
 
  - Fix chacha-riscv64-zvkb.S to not use frame pointer for data
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYIADIWIQSacvsUNc7UX4ntmEPzXCl4vpKOKwUCaTuQ6hQcZWJpZ2dlcnNA
 a2VybmVsLm9yZwAKCRDzXCl4vpKOK9wsAQCdhMvzStncAZ6j/NU6On6naWyHu0i/
 FWEstWGZrG6I7AD/ewrX4Dl9I6r/nKfpWxTna5MdssCbyDTMav1mHxOztgw=
 =VAoK
 -----END PGP SIGNATURE-----

Merge tag 'libcrypto-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux

Pull crypto library fixes from Eric Biggers:
 "Fixes for some recent regressions as well as some longstanding issues:

   - Fix incorrect output from the arm64 NEON implementation of GHASH

   - Merge the ksimd scopes in the arm64 XTS code to reduce stack usage

   - Roll up the BLAKE2b round loop on 32-bit kernels to greatly reduce
     code size and stack usage

   - Add missing RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS dependency

   - Fix chacha-riscv64-zvkb.S to not use frame pointer for data"

* tag 'libcrypto-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux:
  crypto: arm64/ghash - Fix incorrect output from ghash-neon
  crypto/arm64: sm4/xts - Merge ksimd scopes to reduce stack bloat
  crypto/arm64: aes/xts - Use single ksimd scope to reduce stack bloat
  lib/crypto: blake2s: Replace manual unrolling with unrolled_full
  lib/crypto: blake2b: Roll up BLAKE2b round loop on 32-bit
  lib/crypto: riscv: Depend on RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
  lib/crypto: riscv/chacha: Avoid s0/fp register
2025-12-12 22:08:09 +12:00
Linus Torvalds
35ebee7e72 block-6.19-20251211
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmk7RxcQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpnClD/94oSzn0ViI+kmtPcqiHVilGCQYIaBiQuUN
 N+Z3XiLCPUgPDeWxycbFflQ2pmuODXzOC5XZddC0hitxj4jIqL8jBwI0T/WOPXyw
 A0g8S7/Ny3Le5FftBy7duqjIDycXGYhKYD9sQEvSBTf0yu3QpT4hPRveuPouSPkz
 d4H73j+9VMrLRyXGuALhhdwIaqu6/QRtArjc1Yickisi5dEqpwSrHk0CQEe1zJgs
 wgeItEwfnDVdU0wNiLxSJY0HsTzYXtyYWAT5KiFPCPkHYZd1tadcwZ3D9aLF/oH8
 LzLAX19QrTX11lVXP7FbipClYE5gprKDe4qPTExXQrPD7j3Ba4LWIl4QXZ2A4LPE
 Epam6R+ugOyly2+S2dea1lByoKafviRm4CqR3Ixr+S8ayTUser3oy6I1xGEi9v7D
 qF4LJ1ziLWz1kWoLdoOyJCDv0W3vK1U1Rflt24woOLZNpw2S20q7+vwwLQHoWxnY
 GBDRMi3NjCXH4qCJOaly5tnLNTzdxh0h64WsbjO+DGXOnOr39wH6TN4czkW4PPR5
 IwFpP7HurRJMivoSHP50tRqbFLXETlAdceYV8HuhNYhlCIY6NaQbYr7PKzNk/GcJ
 e2/AkRNgJf5GRzemrfkCtndBCsyi1IMsFN0GXbhH6Xr705Lpkpf5qs77Mexg3+TK
 laf5G/vCDw==
 =h5ad
 -----END PGP SIGNATURE-----

Merge tag 'block-6.19-20251211' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull block fixes from Jens Axboe:

 - Always initialize DMA state, fixing a potentially nasty issue on the
   block side

 - btrfs zoned write fix with cached zone reports

 - Fix corruption issues in bcache with chained bio's, and further make
   it clear that the chained IO handler is simply a marker, it's not
   code meant to be executed

 - Kill old code dealing with synchronous IO polling in the block layer,
   that has been dead for a long time. Only async polling is supported
   these days

 - Fix a lockdep issue in tag_set management, moving it to RCU

 - Fix an issue with ublks bio_vec iteration

 - Don't unconditionally enforce blocking issue of ublk control
   commands, allow some of them with non-blocking issue as they
   do not block

* tag 'block-6.19-20251211' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
  blk-mq-dma: always initialize dma state
  blk-mq: delete task running check in blk_hctx_poll()
  block: fix cached zone reports on devices with native zone append
  block: Use RCU in blk_mq_[un]quiesce_tagset() instead of set->tag_list_lock
  ublk: don't mutate struct bio_vec in iteration
  block: prohibit calls to bio_chain_endio
  bcache: fix improper use of bi_end_io
  ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue
2025-12-12 22:04:18 +12:00
Linus Torvalds
14df4eb7e7 io_uring-6.19-20251211
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAmk7RvYQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpr7UD/4qqOmmEq92nPJ9v9zeebrTCtO5Hah1HY11
 D1Cc7KRqt2F6Jy1oN+LzQc1jXguLnQCxMuIRp1f3waTC/j4v4qfjjba+no/CZnLp
 jwC0UWEeXx8wVx3RkAg3qJJzixGEvJ4pWPYQCYp29LkCkzLL47y7VTBoVPxHiSog
 MpRGhTWjdFOLX4C/czm6kwpZM/2LkaG6dDpjZFIZm3inHTbP6QGBWdS+Q3VRzAJn
 YodteJifva4cefcEhP8zZeWLmzHMJLz0cQgnrhYG9michaCNoqM1y3TThvf6h3Ls
 8ivwD+0PxzoQ32yImUfSOsqlmn+EI0kevaUVvN74vPT4d5RUxSCOR27z9fPxwI60
 JE2xpPN5i6CICc8c1tJJDYDHvElM1C7cueKfr/PTusOvmiI8W+n3VTMl8rVuo25d
 2k3ATGq3/E9yfx+/yu3jsjPVYPV52byPsDJ0vs3ixipxS4CdLlvwa3rIvyyrOatl
 Z6gFhbtTmB5LExSGfI/v+D6Lv7Pe1j6AHfo1RY64D0HR7FmnPMn/95WgTAXr28to
 vUnOWQ+XjFE4DzLaOZvHV170QajHh2oCBICOlkEdRWc1ubQJ96zTRpco74xGNcw6
 Z4+3BxwotR205vbrQwiEIKaGfHDWK72hLdObX2wuPuiPZltchSHb4zZAdmavlUBV
 e2QzsEzaJQ==
 =ZPJt
 -----END PGP SIGNATURE-----

Merge tag 'io_uring-6.19-20251211' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux

Pull io_uring fix from Jens Axboe:
 "Single fix for io_uring headed to stable, fixing an issue introduced
  with the min_wait support earlier this year, where SQPOLL didn't get
  correctly woken if an event arrived once the event waiting has
  finished the min_wait portion.

  As we already have regression tests for this added and people
  reporting new failures there, let's get this one flushed out
  so it can bubble back down to stable as well"

* tag 'io_uring-6.19-20251211' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux:
  io_uring: fix min_wait wakeups for SQPOLL
2025-12-12 22:01:32 +12:00
Linus Torvalds
ce825345dd Three ksmbd server fixes
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmk7qq0ACgkQiiy9cAdy
 T1FBYQwAsagM3pGOhSum710iGgeFAcV/UDKV7rcY3wVRvLmVTuNA4RdTeLkxMrkQ
 LW3k7xlDwveV1qmzPvbprIlOVGawWRexXpiIMqShCDH48yPrLWL4W59AlXDAudUC
 Cn6zMMLHaOg9mcOw3gzraEUFfn0WvcvdhExOLfP9nJGd1ppzqMoOUhIeqy2fOD7R
 uBaO4tBAC2400egegqnijcc+4RWMtSUi1PL3KCSjrL2wJCEFGi5RPvVc2r+3i4We
 7tJJ2jozExTZQBkRqF1qlLGbq8C2G6xWYfZ6x41zaKAjP065zpKuoGpdhPzAZfH+
 Qek2sh5b5Ofx/zZvlhrpKZ5G01LR522g4kZcIG7+qrGDDZsnWjjAnQJlfWO/ZFa4
 j9li9AsIa58qNoMD3q3OY7vaDy21x0TFwcIpXAZ9Vj9Q+/A534+kAigtx90DEbvK
 d4muR0PvUAAS2YgDVn1I9Wpeil+jqMrLoj45mKmX8qCOpbXhZI49KjYX6jZohhWh
 E6WAOCN4
 =Nxpo
 -----END PGP SIGNATURE-----

Merge tag 'v6.19-rc-smb3-server-fixes' of git://git.samba.org/ksmbd

Pull smb server fixes from Steve French:

 - minor cleanup

 - minor update to comment to avoid confusion about fs type

* tag 'v6.19-rc-smb3-server-fixes' of git://git.samba.org/ksmbd:
  smb/server: add comment to FileSystemName of FileFsAttributeInformation
  smb/server: remove unused nterr.h
  smb/server: rename include guard in smb_common.h
2025-12-12 21:59:19 +12:00
Linus Torvalds
10cc3e9a11 12 smb3 client fixes
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEE6fsu8pdIjtWE/DpLiiy9cAdyT1EFAmk7dYEACgkQiiy9cAdy
 T1FxRQwApjZCYV2NdvIfcrvHoZJ0xn6GTA4xqbLIC4ETVj7NoyperL2NaJxgA3GV
 b++DQhsPMOnj8JL3s33+j8O6TzUOmkrW/sZp9Mm23QYHDXS5KTwFkymrzv1Kd3iz
 XFAGwTy+ToDtWaC61dExXo/pdsNpK+sMaQ4re+RTs2RGpQbXhN3TPAEhDYD5O4Z9
 2PhogsDf3/Y4gJOqtW7KwAegudLG1aRbDdpQNOvrLFVrEDGo9WeQD70xDNnYrjZl
 /YOR3EFLWEhYFTy1v/Kj/RH8Hl56lzRnj31/IwZoGuPJQLFnD8heGjG0iCtZtCgf
 Dxnb6/35R45ITdx5wErb2f2pzGd8QCd5ei3HYM+sgQyyH2T2YcDamTVODDbxrk3U
 fruHVsHh3GqM//nx1Tmxlt6lKMTKVdQ3dAJ8WHnUpOLaSSbSco8IU2L2CLjbHT4j
 62N9MQQky3k7YtoDdDFLP8hDB6EBDVqINn0Q0Rc3Za57ucXZI7yBBdoBZN3dUUOS
 5HPzItdY
 =GQrC
 -----END PGP SIGNATURE-----

Merge tag 'v6.19-rc-part2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - Fix incorrect error code defines

 - Add missing error code definitions

 - Add parenthesis around NT_STATUS code defines to fix checkpatch
   warnings

 - Remove some duplicated protocol definitions, moving to common code
   shared by client and server

 - Add missing protocol documentation reference (for change notify)

 - Correct struct definition (for duplicate_extents_to_file_ex)

* tag 'v6.19-rc-part2-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  smb/client: remove DeviceType Flags and Device Characteristics definitions
  smb: move File Attributes definitions into common/fscc.h
  smb: update struct duplicate_extents_to_file_ex
  smb: move file_notify_information to common/fscc.h
  smb: move SMB2 Notify Action Flags into common/smb2pdu.h
  smb: move notify completion filter flags into common/smb2pdu.h
  smb/client: add parentheses to NT error code definitions containing bitwise OR operator
  smb: add documentation references for smb2 change notify definitions
  smb/client: add 4 NT error code definitions
  smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
  smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
  smb/client: fix NT_STATUS_NO_DATA_DETECTED value
2025-12-12 21:56:25 +12:00
Linus Torvalds
6bb34aff1e NFS client updates for Linux 6.19
Highlights include:
 
 Bugfixes:
 - Fix 'nlink' attribute update races when unlinking a file.
 - Add missing initialisers for the directory verifier in various places.
 - Don't regress the NFSv4 open state due to misordered racing replies.
 - Ensure the NFSv4.x callback server uses the correct transport
   connection.
 - Fix potential use-after-free races when shutting down the NFSv4.x
   callback server.
 - Fix a pNFS layout commit crash.
 - Assorted fixes to ensure correct propagation of mount options when the
   client crosses a filesystem boundary and triggers the VFS automount
   code.
 - More localio fixes.
 
 Features and cleanups:
 - Add initial support for basic directory delegations.
 - SunRPC back channel code cleanups.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQR8xgHcVzJNfOYElJo6EXfx2a6V0QUCaTrPnQAKCRA6EXfx2a6V
 0aLQAPwOs+bfoaPuk/EsC87m3rAtFJNPMg65toJY/6JnXnTGXgEAs1XlCcSCgc10
 bsX+D6QIudOoWExwFfLlVlFAFikGKQc=
 =DoZq
 -----END PGP SIGNATURE-----

Merge tag 'nfs-for-6.19-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs

Pull NFS client updates from Trond Myklebust:
 "Bugfixes:
   - Fix 'nlink' attribute update races when unlinking a file
   - Add missing initialisers for the directory verifier in various
     places
   - Don't regress the NFSv4 open state due to misordered racing replies
   - Ensure the NFSv4.x callback server uses the correct transport
     connection
   - Fix potential use-after-free races when shutting down the NFSv4.x
     callback server
   - Fix a pNFS layout commit crash
   - Assorted fixes to ensure correct propagation of mount options when
     the client crosses a filesystem boundary and triggers the VFS
     automount code
   - More localio fixes

  Features and cleanups:
   - Add initial support for basic directory delegations
   - SunRPC back channel code cleanups"

* tag 'nfs-for-6.19-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (24 commits)
  NFSv4: Handle NFS4ERR_NOTSUPP errors for directory delegations
  nfs/localio: remove 61 byte hole from needless ____cacheline_aligned
  nfs/localio: remove alignment size checking in nfs_is_local_dio_possible
  NFS: Fix up the automount fs_context to use the correct cred
  NFS: Fix inheritance of the block sizes when automounting
  NFS: Automounted filesystems should inherit ro,noexec,nodev,sync flags
  Revert "nfs: ignore SB_RDONLY when mounting nfs"
  Revert "nfs: clear SB_RDONLY before getting superblock"
  Revert "nfs: ignore SB_RDONLY when remounting nfs"
  NFS: Add a module option to disable directory delegations
  NFS: Shortcut lookup revalidations if we have a directory delegation
  NFS: Request a directory delegation during RENAME
  NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK
  NFS: Add support for sending GDD_GETATTR
  NFSv4/pNFS: Clear NFS_INO_LAYOUTCOMMIT in pnfs_mark_layout_stateid_invalid
  NFSv4.1: protect destroying and nullifying bc_serv structure
  SUNRPC: new helper function for stopping backchannel server
  SUNRPC: cleanup common code in backchannel request
  NFSv4.1: pass transport for callback shutdown
  NFSv4: ensure the open stateid seqid doesn't go backwards
  ...
2025-12-12 21:52:42 +12:00
ZhangGuoDong
ab0347e67d smb/client: remove DeviceType Flags and Device Characteristics definitions
These definitions are already in common/smb2pdu.h, so remove the duplicated
ones from the client.

Co-developed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-11 00:53:07 -06:00
ChenXiaoSong
2b6abb893e smb: move File Attributes definitions into common/fscc.h
These definitions are specified in MS-FSCC 2.6, so move them into fscc.h.

Modify the following places:

  - FILE_ATTRIBUTE__MASK -> FILE_ATTRIBUTE_MASK
  - Update FILE_ATTRIBUTE_MASK value
  - cpu_to_le32(constant) -> cpu_to_le32(MACRO DEFINITION)

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-11 00:53:03 -06:00
ChenXiaoSong
c97503321e smb: update struct duplicate_extents_to_file_ex
Add the missing field to the structure (see MS-FSCC 2.3.9.2), and correct
the section number in the documentation reference.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-11 00:52:54 -06:00
Keith Busch
a0750fae73 blk-mq-dma: always initialize dma state
Ensure the dma state is initialized when we're not using the contiguous
iova, otherwise the caller may be using a stale state from a previous
request that could use the coalesed iova allocation.

Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
Reported-by: Sebastian Ott <sebott@redhat.com>
Tested-by: Sebastian Ott <sebott@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-10 13:41:11 -07:00
Eric Biggers
f6a458746f crypto: arm64/ghash - Fix incorrect output from ghash-neon
Commit 9a7c987fb92b ("crypto: arm64/ghash - Use API partial block
handling") made ghash_finup() pass the wrong buffer to
ghash_do_simd_update().  As a result, ghash-neon now produces incorrect
outputs when the message length isn't divisible by 16 bytes.  Fix this.

(I didn't notice this earlier because this code is reached only on CPUs
that support NEON but not PMULL.  I haven't yet found a way to get
qemu-system-aarch64 to emulate that configuration.)

Fixes: 9a7c987fb92b ("crypto: arm64/ghash - Use API partial block handling")
Cc: stable@vger.kernel.org
Reported-by: Diederik de Haas <diederik@cknow-tech.com>
Closes: https://lore.kernel.org/linux-crypto/DETXT7QI62KE.F3CGH2VWX1SC@cknow-tech.com/
Tested-by: Diederik de Haas <diederik@cknow-tech.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Link: https://lore.kernel.org/r/20251209223417.112294-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-12-10 09:46:26 -08:00
Fengnan Chang
f22ecf9c14 blk-mq: delete task running check in blk_hctx_poll()
blk_hctx_poll() always checks if the task is running or not, and returns
1 if the task is running. This is a leftover from when polled IO was
purely for synchronous IO, and doesn't make sense anymore when polled IO
is purely asynchronous. Similarly, marking the task as TASK_RUNNING is
also superflous, as the very much has to be running to enter the
function in the first place.

It looks like there has been this judgment for historical reasons, and
in very early versions of this function the user would set the process
state to TASK_UNINTERRUPTIBLE.

Signed-off-by: Diangang Li <lidiangang@bytedance.com>
Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
[axboe: kill all remnants of task running, pointless now. massage message]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-10 02:40:52 -07:00
Johannes Thumshirn
2c38ec934d block: fix cached zone reports on devices with native zone append
When mounting a btrfs file system on virtio-blk which supports native
Zone Append there has been a WARN triggering in btrfs' space management
code.

Further looking into btrfs' zoned statistics uncovered the filesystem
expecting the zones to be used, but the write pointers being 0:
 # cat /sys/fs/btrfs/8eabd2e7-3294-4f9e-9b58-7e64135c8bf4/zoned_stats
 active block-groups: 4
         reclaimable: 0
         unused: 0
         need reclaim: false
 data relocation block-group: 1342177280
 active zones:
         start: 1073741824, wp: 0 used: 0, reserved: 0, unusable: 0
         start: 1342177280, wp: 0 used: 0, reserved: 0, unusable: 0
         start: 1610612736, wp: 0 used: 16384, reserved: 0, unusable: 18446744073709535232
         start: 1879048192, wp: 0 used: 131072, reserved: 0, unusable: 18446744073709420544

Looking at the blkzone report output for the zone in question
(1610612736) the write pointer on the device moved, but the filesystem
did not see a change on the write pointer:
 # blkzone report -c 1 -o 0x300000 /dev/vda
   start: 0x000300000, len 0x080000, cap 0x080000, wptr 0x000040 reset:0 non-seq:0, zcond: 2(oi) [type: 2(SEQ_WRITE_REQUIRED)]

The zone write pointer is 0, because btrfs is using the cached version
of blkdev_report_zones() and as virtio-blk is supporting native zone
append, but blkdev_revalidate_zones() does not initialize the zone write
plugs in this case.

Not skipping the revalidate of sequential zones in
blkdev_revalidate_zones() callchain fixes this issue.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Fixes: a6aa36e957a1 ("block: Remove zone write plugs when handling native zone append writes")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-09 22:35:54 -07:00
ChenXiaoSong
08c2a7d2ba smb: move file_notify_information to common/fscc.h
This struct definition is specified in MS-FSCC, and KSMBD will also use it,
so move it into common header file.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:23:03 -06:00
ChenXiaoSong
6539e18517 smb: move SMB2 Notify Action Flags into common/smb2pdu.h
Some of these definitions are already in common/smb2pdu.h. Remove the
duplicate client side definitions, and add all SMB2 Notify Action Flags to
common header file.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:22:58 -06:00
ChenXiaoSong
9ec7629b43 smb: move notify completion filter flags into common/smb2pdu.h
Some of these definitions are already in common/smb2pdu.h, remove the
duplicate client side definitions, and move FILE_NOTIFY_CHANGE_NAME to
common header file.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:22:54 -06:00
ChenXiaoSong
a71a4aab48 smb/client: add parentheses to NT error code definitions containing bitwise OR operator
Use the following shell commands:

  # Add "("
  sed -i '/|/s/ 0x/ (0x/' fs/smb/client/nterr.h
  # Add ")" if line does not end with a comment
  sed -i '/|/ { /.*\*\/$/! s/$/)/ }' fs/smb/client/nterr.h
  # Add ")" if line end with a comment
  sed -i '/|/ s/[[:space:]]*\/\*/)&/' fs/smb/client/nterr.h

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:22:34 -06:00
ChenXiaoSong
bcdd6cfaf2 smb: add documentation references for smb2 change notify definitions
To make it easier to locate the documentation during development.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:22:01 -06:00
ChenXiaoSong
a9adafd401 smb/client: add 4 NT error code definitions
From server/nterr.h that has been removed.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:21:42 -06:00
ChenXiaoSong
9f99caa895 smb/client: fix NT_STATUS_UNABLE_TO_FREE_VM value
This was reported by the KUnit tests in the later patches.

See MS-ERREF 2.3.1 STATUS_UNABLE_TO_FREE_VM. Keep it consistent with the
value in the documentation.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:20:17 -06:00
ChenXiaoSong
b2b50fca34 smb/client: fix NT_STATUS_DEVICE_DOOR_OPEN value
This was reported by the KUnit tests in the later patches.

See MS-ERREF 2.3.1 STATUS_DEVICE_DOOR_OPEN. Keep it consistent with the
value in the documentation.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:20:01 -06:00
ChenXiaoSong
a1237c203f smb/client: fix NT_STATUS_NO_DATA_DETECTED value
This was reported by the KUnit tests in the later patches.

See MS-ERREF 2.3.1 STATUS_NO_DATA_DETECTED. Keep it consistent with the
value in the documentation.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:19:43 -06:00
ChenXiaoSong
2e0d224d89 smb/server: add comment to FileSystemName of FileFsAttributeInformation
Explained why FileSystemName is always set to "NTFS".

Link: 84392651b0
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:01:36 -06:00
ChenXiaoSong
98def4eb02 smb/server: remove unused nterr.h
KSMBD does not use these NT error code definitions. Instead, it uses the
SMB2 status code definitions defined in common/smb2status.h.

By the way, server/nterr.h contains the following additional definitions
compared to client/nterr.h:

  - NT_STATUS_PENDING
  - NT_STATUS_INVALID_LOCK_RANGE
  - NT_STATUS_NETWORK_SESSION_EXPIRED
  - NT_STATUS_NO_PREAUTH_INTEGRITY_HASH_OVERLAP

We can add them to client/nterr.h in the next patch.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:01:16 -06:00
ChenXiaoSong
01ab0d1640 smb/server: rename include guard in smb_common.h
Make the include guard more descriptive to avoid conflicts with include
guards that may be used in the future.

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
2025-12-09 21:00:48 -06:00
Jens Axboe
e15cb2200b io_uring: fix min_wait wakeups for SQPOLL
Using min_wait, two timeouts are given:

1) The min_wait timeout, within which up to 'wait_nr' events are
   waited for.
2) The overall long timeout, which is entered if no events are generated
   in the min_wait window.

If the min_wait has expired, any event being posted must wake the task.
For SQPOLL, that isn't the case, as it won't trigger the io_has_work()
condition, as it will have already processed the task_work that happened
when an event was posted. This causes any event to trigger post the
min_wait to not always cause the waiting application to wakeup, and
instead it will wait until the overall timeout has expired. This can be
shown in a test case that has a 1 second min_wait, with a 5 second
overall wait, even if an event triggers after 1.5 seconds:

axboe@m2max-kvm /d/iouring-mre (master)> zig-out/bin/iouring
info: MIN_TIMEOUT supported: true, features: 0x3ffff
info: Testing: min_wait=1000ms, timeout=5s, wait_nr=4
info: 1 cqes in 5000.2ms

where the expected result should be:

axboe@m2max-kvm /d/iouring-mre (master)> zig-out/bin/iouring
info: MIN_TIMEOUT supported: true, features: 0x3ffff
info: Testing: min_wait=1000ms, timeout=5s, wait_nr=4
info: 1 cqes in 1500.3ms

When the min_wait timeout triggers, reset the number of completions
needed to wake the task. This should ensure that any future events will
wake the task, regardless of how many events it originally wanted to
wait for.

Reported-by: Tip ten Brink <tip@tenbrinkmeijs.com>
Cc: stable@vger.kernel.org
Fixes: 1100c4a2656d ("io_uring: add support for batch wait timeout")
Link: https://github.com/axboe/liburing/issues/1477
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-09 16:54:12 -07:00
Ard Biesheuvel
6f7d948192 crypto/arm64: sm4/xts - Merge ksimd scopes to reduce stack bloat
Merge the two ksimd scopes in the implementation of SM4-XTS to prevent
stack bloat in cases where the compiler fails to combine the stack slots
for the kernel mode FP/SIMD buffers.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20251203163803.157541-6-ardb@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-12-09 15:10:21 -08:00
Ard Biesheuvel
a9a8b1a383 crypto/arm64: aes/xts - Use single ksimd scope to reduce stack bloat
The ciphertext stealing logic in the AES-XTS implementation creates a
separate ksimd scope to call into the FP/SIMD core routines, and in some
cases (CONFIG_KASAN_STACK is one, but there might be others), the 528
byte kernel mode FP/SIMD buffer that is allocated inside this scope is
not shared with the preceding ksimd scope, resulting in unnecessary
stack bloat.

Considering that

a) the XTS ciphertext stealing logic is never called for block
   encryption use cases, and XTS is rarely used for anything else,

b) in the vast majority of cases, the entire input block is processed
   during the first iteration of the loop,

we can combine both ksimd scopes into a single one with no practical
impact on how often/how long FP/SIMD is en/disabled, allowing us to
reuse the same stack slot for both FP/SIMD routine calls.

Fixes: ba3c1b3b5ac9 ("crypto/arm64: aes-blk - Switch to 'ksimd' scoped guard API")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20251203163803.157541-5-ardb@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-12-09 15:10:21 -08:00
Eric Biggers
68b233b1d5 lib/crypto: blake2s: Replace manual unrolling with unrolled_full
As we're doing in the BLAKE2b code, use unrolled_full to make the
compiler handle the loop unrolling.  This simplifies the code slightly.
The generated object code is nearly the same with both gcc and clang.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20251205051155.25274-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-12-09 15:10:21 -08:00
Eric Biggers
2e8f7b170a lib/crypto: blake2b: Roll up BLAKE2b round loop on 32-bit
BLAKE2b has a state of 16 64-bit words.  Add the message data in and
there are 32 64-bit words.  With the current code where all the rounds
are unrolled to enable constant-folding of the blake2b_sigma values,
this results in a very large code size on 32-bit kernels, including a
recurring issue where gcc uses a large amount of stack.

There's just not much benefit to this unrolling when the code is already
so large.  Let's roll up the rounds when !CONFIG_64BIT.

To avoid having to duplicate the code, just write the code once using a
loop, and conditionally use 'unrolled_full' from <linux/unroll.h>.

Then, fold the now-unneeded ROUND() macro into the loop.  Finally, also
remove the now-unneeded override of the stack frame size warning.

Code size improvements for blake2b_compress_generic():

                  Size before (bytes)    Size after (bytes)
                  -------------------    ------------------
    i386, gcc           27584                 3632
    i386, clang         18208                 3248
    arm32, gcc          19912                 2860
    arm32, clang        21336                 3344

Running the BLAKE2b benchmark on a !CONFIG_64BIT kernel on an x86_64
processor shows a 16384B throughput change of 351 => 340 MB/s (gcc) or
442 MB/s => 375 MB/s (clang).  So clearly not much of a slowdown either.
But also that microbenchmark also effectively disregards cache usage,
which is important in practice and is far better in the smaller code.

Note: If we rolled up the loop on x86_64 too, the change would be
7024 bytes => 1584 bytes and 1960 MB/s => 1396 MB/s (gcc), or
6848 bytes => 1696 bytes and 1920 MB/s => 1263 MB/s (clang).
Maybe still worth it, though not quite as clearly beneficial.

Fixes: 91d689337fe8 ("crypto: blake2b - add blake2b generic implementation")
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20251205050330.89704-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-12-09 15:10:21 -08:00
Eric Biggers
1cd5bb6e9e lib/crypto: riscv: Depend on RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
Replace the RISCV_ISA_V dependency of the RISC-V crypto code with
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS, which implies RISCV_ISA_V as
well as vector unaligned accesses being efficient.

This is necessary because this code assumes that vector unaligned
accesses are supported and are efficient.  (It does so to avoid having
to use lots of extra vsetvli instructions to switch the element width
back and forth between 8 and either 32 or 64.)

This was omitted from the code originally just because the RISC-V kernel
support for detecting this feature didn't exist yet.  Support has now
been added, but it's fragmented into per-CPU runtime detection, a
command-line parameter, and a kconfig option.  The kconfig option is the
only reasonable way to do it, though, so let's just rely on that.

Fixes: eb24af5d7a05 ("crypto: riscv - add vector crypto accelerated AES-{ECB,CBC,CTR,XTS}")
Fixes: bb54668837a0 ("crypto: riscv - add vector crypto accelerated ChaCha20")
Fixes: 600a3853dfa0 ("crypto: riscv - add vector crypto accelerated GHASH")
Fixes: 8c8e40470ffe ("crypto: riscv - add vector crypto accelerated SHA-{256,224}")
Fixes: b3415925a08b ("crypto: riscv - add vector crypto accelerated SHA-{512,384}")
Fixes: 563a5255afa2 ("crypto: riscv - add vector crypto accelerated SM3")
Fixes: b8d06352bbf3 ("crypto: riscv - add vector crypto accelerated SM4")
Cc: stable@vger.kernel.org
Reported-by: Vivian Wang <wangruikang@iscas.ac.cn>
Closes: https://lore.kernel.org/r/b3cfcdac-0337-4db0-a611-258f2868855f@iscas.ac.cn/
Reviewed-by: Jerry Shih <jerry.shih@sifive.com>
Link: https://lore.kernel.org/r/20251206213750.81474-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-12-09 15:10:21 -08:00
Vivian Wang
43169328c7 lib/crypto: riscv/chacha: Avoid s0/fp register
In chacha_zvkb, avoid using the s0 register, which is the frame pointer,
by reallocating KEY0 to t5. This makes stack traces available if e.g. a
crash happens in chacha_zvkb.

No frame pointer maintenance is otherwise required since this is a leaf
function.

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
Fixes: bb54668837a0 ("crypto: riscv - add vector crypto accelerated ChaCha20")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20251202-riscv-chacha_zvkb-fp-v2-1-7bd00098c9dc@iscas.ac.cn
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
2025-12-09 15:10:20 -08:00
Mohamed Khalfella
59e25ef2b4 block: Use RCU in blk_mq_[un]quiesce_tagset() instead of set->tag_list_lock
blk_mq_{add,del}_queue_tag_set() functions add and remove queues from
tagset, the functions make sure that tagset and queues are marked as
shared when two or more queues are attached to the same tagset.
Initially a tagset starts as unshared and when the number of added
queues reaches two, blk_mq_add_queue_tag_set() marks it as shared along
with all the queues attached to it. When the number of attached queues
drops to 1 blk_mq_del_queue_tag_set() need to mark both the tagset and
the remaining queues as unshared.

Both functions need to freeze current queues in tagset before setting on
unsetting BLK_MQ_F_TAG_QUEUE_SHARED flag. While doing so, both functions
hold set->tag_list_lock mutex, which makes sense as we do not want
queues to be added or deleted in the process. This used to work fine
until commit 98d81f0df70c ("nvme: use blk_mq_[un]quiesce_tagset")
made the nvme driver quiesce tagset instead of quiscing individual
queues. blk_mq_quiesce_tagset() does the job and quiesce the queues in
set->tag_list while holding set->tag_list_lock also.

This results in deadlock between two threads with these stacktraces:

  __schedule+0x47c/0xbb0
  ? timerqueue_add+0x66/0xb0
  schedule+0x1c/0xa0
  schedule_preempt_disabled+0xa/0x10
  __mutex_lock.constprop.0+0x271/0x600
  blk_mq_quiesce_tagset+0x25/0xc0
  nvme_dev_disable+0x9c/0x250
  nvme_timeout+0x1fc/0x520
  blk_mq_handle_expired+0x5c/0x90
  bt_iter+0x7e/0x90
  blk_mq_queue_tag_busy_iter+0x27e/0x550
  ? __blk_mq_complete_request_remote+0x10/0x10
  ? __blk_mq_complete_request_remote+0x10/0x10
  ? __call_rcu_common.constprop.0+0x1c0/0x210
  blk_mq_timeout_work+0x12d/0x170
  process_one_work+0x12e/0x2d0
  worker_thread+0x288/0x3a0
  ? rescuer_thread+0x480/0x480
  kthread+0xb8/0xe0
  ? kthread_park+0x80/0x80
  ret_from_fork+0x2d/0x50
  ? kthread_park+0x80/0x80
  ret_from_fork_asm+0x11/0x20

  __schedule+0x47c/0xbb0
  ? xas_find+0x161/0x1a0
  schedule+0x1c/0xa0
  blk_mq_freeze_queue_wait+0x3d/0x70
  ? destroy_sched_domains_rcu+0x30/0x30
  blk_mq_update_tag_set_shared+0x44/0x80
  blk_mq_exit_queue+0x141/0x150
  del_gendisk+0x25a/0x2d0
  nvme_ns_remove+0xc9/0x170
  nvme_remove_namespaces+0xc7/0x100
  nvme_remove+0x62/0x150
  pci_device_remove+0x23/0x60
  device_release_driver_internal+0x159/0x200
  unbind_store+0x99/0xa0
  kernfs_fop_write_iter+0x112/0x1e0
  vfs_write+0x2b1/0x3d0
  ksys_write+0x4e/0xb0
  do_syscall_64+0x5b/0x160
  entry_SYSCALL_64_after_hwframe+0x4b/0x53

The top stacktrace is showing nvme_timeout() called to handle nvme
command timeout. timeout handler is trying to disable the controller and
as a first step, it needs to blk_mq_quiesce_tagset() to tell blk-mq not
to call queue callback handlers. The thread is stuck waiting for
set->tag_list_lock as it tries to walk the queues in set->tag_list.

The lock is held by the second thread in the bottom stack which is
waiting for one of queues to be frozen. The queue usage counter will
drop to zero after nvme_timeout() finishes, and this will not happen
because the thread will wait for this mutex forever.

Given that [un]quiescing queue is an operation that does not need to
sleep, update blk_mq_[un]quiesce_tagset() to use RCU instead of taking
set->tag_list_lock, update blk_mq_{add,del}_queue_tag_set() to use RCU
safe list operations. Also, delete INIT_LIST_HEAD(&q->tag_set_list)
in blk_mq_del_queue_tag_set() because we can not re-initialize it while
the list is being traversed under RCU. The deleted queue will not be
added/deleted to/from a tagset and it will be freed in blk_free_queue()
after the end of RCU grace period.

Signed-off-by: Mohamed Khalfella <mkhalfella@purestorage.com>
Fixes: 98d81f0df70c ("nvme: use blk_mq_[un]quiesce_tagset")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-09 10:24:55 -07:00
Caleb Sander Mateos
db339b4067 ublk: don't mutate struct bio_vec in iteration
__bio_for_each_segment() uses the returned struct bio_vec's bv_len field
to advance the struct bvec_iter at the end of each loop iteration. So
it's incorrect to modify it during the loop. Don't assign to bv_len (or
bv_offset, for that matter) in ublk_copy_user_pages().

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: e87d66ab27ac ("ublk: use rq_for_each_segment() for user copy")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-09 10:20:18 -07:00
Shida Zhang
cfdeb588ae block: prohibit calls to bio_chain_endio
Now that all potential callers of bio_chain_endio have been
eliminated, completely prohibit any future calls to this function.

Suggested-by: Ming Lei <ming.lei@redhat.com>
Suggested-by: Andreas Gruenbacher <agruenba@redhat.com>
Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-09 10:20:03 -07:00
Shida Zhang
53280e3984 bcache: fix improper use of bi_end_io
Don't call bio->bi_end_io() directly. Use the bio_endio() helper
function instead, which handles completion more safely and uniformly.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-09 10:20:03 -07:00
Caleb Sander Mateos
87213b0d84 ublk: allow non-blocking ctrl cmds in IO_URING_F_NONBLOCK issue
Handling most of the ublksrv_ctrl_cmd opcodes require locking a mutex,
so ublk_ctrl_uring_cmd() bails out with EAGAIN when called with the
IO_URING_F_NONBLOCK issue flag. However, several opcodes can be handled
without blocking:
- UBLK_CMD_GET_QUEUE_AFFINITY
- UBLK_CMD_GET_DEV_INFO
- UBLK_CMD_GET_DEV_INFO2
- UBLK_U_CMD_GET_FEATURES

Handle these opcodes synchronously instead of returning EAGAIN so
io_uring doesn't need to issue the command via the worker thread pool.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-12-08 13:32:30 -07:00
Trond Myklebust
bd3b04b46c NFSv4: Handle NFS4ERR_NOTSUPP errors for directory delegations
The error NFS4ERR_NOTSUPP will be returned for operations that are
legal, but not supported by the server.

Fixes: 156b09482933 ("NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-12-05 19:34:29 -05:00
Mike Snitzer
0b873de2c0 nfs/localio: remove 61 byte hole from needless ____cacheline_aligned
struct nfs_local_kiocb used ____cacheline_aligned on its iters[] array
and as the structure evolved it caused a 61 byte hole to form.  Fix
this by removing ____cacheline_aligned and reordering iters[] before
iter_is_dio_aligned[].

Fixes: 6a218b9c3183 ("nfs/localio: do not issue misaligned DIO out-of-order")
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-12-05 19:34:29 -05:00
Mike Snitzer
f50d0328d0 nfs/localio: remove alignment size checking in nfs_is_local_dio_possible
This check to ensure dio_offset_align isn't larger than PAGE_SIZE is
no longer relevant (older iterations of NFS Direct was allocating
misaligned head and tail pages but no longer does, so this check isn't
needed).

Fixes: c817248fc831 ("nfs/localio: add proper O_DIRECT support for READ and WRITE")
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-12-05 19:34:29 -05:00
Trond Myklebust
a2a8fc27dd NFS: Fix up the automount fs_context to use the correct cred
When automounting, the fs_context should be fixed up to use the cred
from the parent filesystem, since the operation is just extending the
namespace. Authorisation to enter that namespace will already have been
provided by the preceding lookup.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-29 17:23:03 -05:00
Trond Myklebust
2b092175f5 NFS: Fix inheritance of the block sizes when automounting
Only inherit the block sizes that were actually specified as mount
parameters for the parent mount.

Fixes: 62a55d088cd8 ("NFS: Additional refactoring for fs_context conversion")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-29 17:23:03 -05:00
Trond Myklebust
8675c69816 NFS: Automounted filesystems should inherit ro,noexec,nodev,sync flags
When a filesystem is being automounted, it needs to preserve the
user-set superblock mount options, such as the "ro" flag.

Reported-by: Li Lingfeng <lilingfeng3@huawei.com>
Link: https://lore.kernel.org/all/20240604112636.236517-3-lilingfeng@huaweicloud.com/
Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-29 17:22:48 -05:00
Trond Myklebust
d4a26d34f1 Revert "nfs: ignore SB_RDONLY when mounting nfs"
This reverts commit 52cb7f8f177878b4f22397b9c4d2c8f743766be3.

Silently ignoring the "ro" and "rw" mount options causes user confusion,
and regressions.

Reported-by: Alkis Georgopoulos<alkisg@gmail.com>
Cc: Li Lingfeng <lilingfeng3@huawei.com>
Fixes: 52cb7f8f1778 ("nfs: ignore SB_RDONLY when mounting nfs")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-29 17:22:39 -05:00
Trond Myklebust
d216b698d4 Revert "nfs: clear SB_RDONLY before getting superblock"
This reverts commit 8cd9b785943c57a136536250da80ba1eb6f8eb18.

Silently ignoring the "ro" and "rw" mount options causes user confusion,
and regressions.

Reported-by: Alkis Georgopoulos<alkisg@gmail.com>
Cc: Li Lingfeng <lilingfeng3@huawei.com>
Fixes: 8cd9b785943c ("nfs: clear SB_RDONLY before getting superblock")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-29 17:22:32 -05:00
Trond Myklebust
400fa37afb Revert "nfs: ignore SB_RDONLY when remounting nfs"
This reverts commit 80c4de6ab44c14e910117a02f2f8241ffc6ec54a.

Silently ignoring the "ro" and "rw" mount options causes user confusion,
and regressions.

Reported-by: Alkis Georgopoulos<alkisg@gmail.com>
Cc: Li Lingfeng <lilingfeng3@huawei.com>
Fixes: 80c4de6ab44c ("nfs: ignore SB_RDONLY when remounting nfs")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-29 17:19:01 -05:00
Anna Schumaker
b6d2a520f4 NFS: Add a module option to disable directory delegations
When this option is disabled then the client will not request directory
delegations or check if we have one during the revalidation paths.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 16:01:47 -05:00
Anna Schumaker
669c0580ac NFS: Shortcut lookup revalidations if we have a directory delegation
Holding a directory delegation means we know that nobody else has
modified the directory on the server, so we can take a few revalidation
shortcuts.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 16:01:47 -05:00
Anna Schumaker
2da2116707 NFS: Request a directory delegation during RENAME
If we notice that we're renaming a file within a directory then we take
that as a sign that the user is working with the current directory and
may want a delegation to avoid extra revalidations when possible.

The nfs_request_directory_delegation() function exists within the NFS v4
module, so I add an extra flag to rename_setup() to indicate if a dentry
is being renamed within the same parent directory.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 16:01:47 -05:00
Anna Schumaker
156b094829 NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK
This patch adds a new flag: NFS_INO_REQ_DIR_DELEG to signal that a
directory wants to request a directory delegation the next time it does
a GETATTR. I have the client request a directory delegation when doing
an access, create, or unlink call since these calls indicate that a user
is working with a directory.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 16:01:47 -05:00
Anna Schumaker
130ae65c01 NFS: Add support for sending GDD_GETATTR
I add this to the existing GETATTR compound as an option extra step that
we can send if the "dir_deleg" flag is set to 'true'. Actually enabling
this value will happen in a later patch.

Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 16:01:46 -05:00
Jonathan Curley
e0f8058f2c NFSv4/pNFS: Clear NFS_INO_LAYOUTCOMMIT in pnfs_mark_layout_stateid_invalid
Fixes a crash when layout is null during this call stack:

write_inode
    -> nfs4_write_inode
        -> pnfs_layoutcommit_inode

pnfs_set_layoutcommit relies on the lseg refcount to keep the layout
around. Need to clear NFS_INO_LAYOUTCOMMIT otherwise we might attempt
to reference a null layout.

Fixes: fe1cf9469d7bc ("pNFS: Clear all layout segment state in pnfs_mark_layout_stateid_invalid")
Signed-off-by: Jonathan Curley <jcurley@purestorage.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 15:33:33 -05:00
Olga Kornievskaia
9e9fdd0ad0 NFSv4.1: protect destroying and nullifying bc_serv structure
When we are shutting down the client, we free the callback
server structure and then at a later pointer we free the
transport used by the client. Yet, it's possible that after
the callback server is freed, the transport receives a
backchannel request at which point we can dereferene freed
memory. Instead, do the freeing the bc server and nullying
bc_serv under the lock.

Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 15:30:12 -05:00
Olga Kornievskaia
6f8b26c90a SUNRPC: new helper function for stopping backchannel server
Create a new backchannel function to stop the backchannel server
and clear the bc_serv in transport protected under the bc_pa_lock.

Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 15:30:12 -05:00
Olga Kornievskaia
441244d427 SUNRPC: cleanup common code in backchannel request
Create a helper function for common code between rdma
and tcp backchannel handling of the backchannel request.
Make sure that access is protected by the bc_pa_lock
lock.

Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 15:30:12 -05:00
Olga Kornievskaia
8936ff4736 NFSv4.1: pass transport for callback shutdown
When we are setting up the 4.1 callback server, we pass in
the appropriate rpc_xprt transport pointer with which to associate
the callback server structure. Similarly, pass in the rpc_xprt
pointer for when we are shutting down the callback. This will be
used to make sure that we free the server structure and then clear
the rpc_xprt's bc_server pointer in a safe manner.

Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 15:30:12 -05:00
Scott Mayhew
2e47c3cc64 NFSv4: ensure the open stateid seqid doesn't go backwards
We have observed an NFSv4 client receiving a LOCK reply with a status of
NFS4ERR_OLD_STATEID and subsequently retrying the LOCK request with an
earlier seqid value in the stateid.  As this was for a new lockowner,
that would imply that nfs_set_open_stateid_locked() had updated the open
stateid seqid with an earlier value.

Looking at nfs_set_open_stateid_locked(), if the incoming seqid is out
of sequence, the task will sleep on the state->waitq for up to 5
seconds.  If the task waits for the full 5 seconds, then after finishing
the wait it'll update the open stateid seqid with whatever value the
incoming seqid has.  If there are multiple waiters in this scenario,
then the last one to perform said update may not be the one with the
highest seqid.

Add a check to ensure that the seqid can only be incremented, and add a
tracepoint to indicate when old seqids are skipped.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Reviewed-by: Benjamin Coddington <bcodding@hammerspace.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-23 15:10:08 -05:00
Trond Myklebust
0f900f1100 NFS: Initialise verifiers for visible dentries in _nfs4_open_and_get_state
Ensure that the verifiers are initialised before calling
d_splice_alias() in _nfs4_open_and_get_state().

Reported-by: Michael Stoler <michael.stoler@vastdata.com>
Fixes: cf5b4059ba71 ("NFSv4: Fix races between open and dentry revalidation")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-19 11:46:50 -05:00
Trond Myklebust
518c32a1bc NFS: Initialise verifiers for visible dentries in nfs_atomic_open()
Ensure that the verifiers are initialised before calling
d_splice_alias() in nfs_atomic_open().

Reported-by: Michael Stoler <michael.stoler@vastdata.com>
Fixes: 809fd143de88 ("NFSv4: Ensure nfs_atomic_open set the dentry verifier on ENOENT")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-19 08:46:21 -05:00
Trond Myklebust
9bd545539b NFS: Initialise verifiers for visible dentries in readdir and lookup
Ensure that the verifiers are initialised before calling
d_splice_alias() in both nfs_prime_dcache() and nfs_lookup().

Reported-by: Michael Stoler <michael.stoler@vastdata.com>
Fixes: a1147b8281bd ("NFS: Fix up directory verifier races")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-19 08:45:53 -05:00
Trond Myklebust
bd4928ec79 NFS: Avoid changing nlink when file removes and attribute updates race
If a file removal races with another operation that updates its
attributes, then skip the change to nlink, and just mark the attributes
as being stale.

Reported-by: Aiden Lambert <alambert48@gatech.edu>
Fixes: 59a707b0d42e ("NFS: Ensure we revalidate the inode correctly after remove or rename")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
2025-11-17 17:31:32 -05:00
51 changed files with 1153 additions and 1422 deletions

View File

@ -549,38 +549,37 @@ static int __maybe_unused xts_encrypt(struct skcipher_request *req)
tail = 0;
}
for (first = 1; walk.nbytes >= AES_BLOCK_SIZE; first = 0) {
int nbytes = walk.nbytes;
scoped_ksimd() {
for (first = 1; walk.nbytes >= AES_BLOCK_SIZE; first = 0) {
int nbytes = walk.nbytes;
if (walk.nbytes < walk.total)
nbytes &= ~(AES_BLOCK_SIZE - 1);
if (walk.nbytes < walk.total)
nbytes &= ~(AES_BLOCK_SIZE - 1);
scoped_ksimd()
aes_xts_encrypt(walk.dst.virt.addr, walk.src.virt.addr,
ctx->key1.key_enc, rounds, nbytes,
ctx->key2.key_enc, walk.iv, first);
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
}
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
}
if (err || likely(!tail))
return err;
if (err || likely(!tail))
return err;
dst = src = scatterwalk_ffwd(sg_src, req->src, req->cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, req->cryptlen);
dst = src = scatterwalk_ffwd(sg_src, req->src, req->cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, req->cryptlen);
skcipher_request_set_crypt(req, src, dst, AES_BLOCK_SIZE + tail,
req->iv);
skcipher_request_set_crypt(req, src, dst, AES_BLOCK_SIZE + tail,
req->iv);
err = skcipher_walk_virt(&walk, &subreq, false);
if (err)
return err;
err = skcipher_walk_virt(&walk, &subreq, false);
if (err)
return err;
scoped_ksimd()
aes_xts_encrypt(walk.dst.virt.addr, walk.src.virt.addr,
ctx->key1.key_enc, rounds, walk.nbytes,
ctx->key2.key_enc, walk.iv, first);
}
return skcipher_walk_done(&walk, 0);
}
@ -619,39 +618,37 @@ static int __maybe_unused xts_decrypt(struct skcipher_request *req)
tail = 0;
}
for (first = 1; walk.nbytes >= AES_BLOCK_SIZE; first = 0) {
int nbytes = walk.nbytes;
scoped_ksimd() {
for (first = 1; walk.nbytes >= AES_BLOCK_SIZE; first = 0) {
int nbytes = walk.nbytes;
if (walk.nbytes < walk.total)
nbytes &= ~(AES_BLOCK_SIZE - 1);
if (walk.nbytes < walk.total)
nbytes &= ~(AES_BLOCK_SIZE - 1);
scoped_ksimd()
aes_xts_decrypt(walk.dst.virt.addr, walk.src.virt.addr,
ctx->key1.key_dec, rounds, nbytes,
ctx->key2.key_enc, walk.iv, first);
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
}
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
}
if (err || likely(!tail))
return err;
if (err || likely(!tail))
return err;
dst = src = scatterwalk_ffwd(sg_src, req->src, req->cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, req->cryptlen);
dst = src = scatterwalk_ffwd(sg_src, req->src, req->cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, req->cryptlen);
skcipher_request_set_crypt(req, src, dst, AES_BLOCK_SIZE + tail,
req->iv);
skcipher_request_set_crypt(req, src, dst, AES_BLOCK_SIZE + tail,
req->iv);
err = skcipher_walk_virt(&walk, &subreq, false);
if (err)
return err;
err = skcipher_walk_virt(&walk, &subreq, false);
if (err)
return err;
scoped_ksimd()
aes_xts_decrypt(walk.dst.virt.addr, walk.src.virt.addr,
ctx->key1.key_dec, rounds, walk.nbytes,
ctx->key2.key_enc, walk.iv, first);
}
return skcipher_walk_done(&walk, 0);
}

View File

@ -312,13 +312,13 @@ static int __xts_crypt(struct skcipher_request *req, bool encrypt,
if (err)
return err;
while (walk.nbytes >= AES_BLOCK_SIZE) {
int blocks = (walk.nbytes / AES_BLOCK_SIZE) & ~7;
out = walk.dst.virt.addr;
in = walk.src.virt.addr;
nbytes = walk.nbytes;
scoped_ksimd() {
while (walk.nbytes >= AES_BLOCK_SIZE) {
int blocks = (walk.nbytes / AES_BLOCK_SIZE) & ~7;
out = walk.dst.virt.addr;
in = walk.src.virt.addr;
nbytes = walk.nbytes;
scoped_ksimd() {
if (blocks >= 8) {
if (first == 1)
neon_aes_ecb_encrypt(walk.iv, walk.iv,
@ -344,30 +344,28 @@ static int __xts_crypt(struct skcipher_request *req, bool encrypt,
ctx->twkey, walk.iv, first);
nbytes = first = 0;
}
err = skcipher_walk_done(&walk, nbytes);
}
err = skcipher_walk_done(&walk, nbytes);
}
if (err || likely(!tail))
return err;
if (err || likely(!tail))
return err;
/* handle ciphertext stealing */
dst = src = scatterwalk_ffwd(sg_src, req->src, req->cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, req->cryptlen);
/* handle ciphertext stealing */
dst = src = scatterwalk_ffwd(sg_src, req->src, req->cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, req->cryptlen);
skcipher_request_set_crypt(req, src, dst, AES_BLOCK_SIZE + tail,
req->iv);
skcipher_request_set_crypt(req, src, dst, AES_BLOCK_SIZE + tail,
req->iv);
err = skcipher_walk_virt(&walk, req, false);
if (err)
return err;
err = skcipher_walk_virt(&walk, req, false);
if (err)
return err;
out = walk.dst.virt.addr;
in = walk.src.virt.addr;
nbytes = walk.nbytes;
out = walk.dst.virt.addr;
in = walk.src.virt.addr;
nbytes = walk.nbytes;
scoped_ksimd() {
if (encrypt)
neon_aes_xts_encrypt(out, in, ctx->cts.key_enc,
ctx->key.rounds, nbytes, ctx->twkey,

View File

@ -133,7 +133,7 @@ static int ghash_finup(struct shash_desc *desc, const u8 *src,
u8 buf[GHASH_BLOCK_SIZE] = {};
memcpy(buf, src, len);
ghash_do_simd_update(1, ctx->digest, src, key, NULL,
ghash_do_simd_update(1, ctx->digest, buf, key, NULL,
pmull_ghash_update_p8);
memzero_explicit(buf, sizeof(buf));
}

View File

@ -346,11 +346,11 @@ static int sm4_xts_crypt(struct skcipher_request *req, bool encrypt)
tail = 0;
}
while ((nbytes = walk.nbytes) >= SM4_BLOCK_SIZE) {
if (nbytes < walk.total)
nbytes &= ~(SM4_BLOCK_SIZE - 1);
scoped_ksimd() {
while ((nbytes = walk.nbytes) >= SM4_BLOCK_SIZE) {
if (nbytes < walk.total)
nbytes &= ~(SM4_BLOCK_SIZE - 1);
scoped_ksimd() {
if (encrypt)
sm4_ce_xts_enc(ctx->key1.rkey_enc, walk.dst.virt.addr,
walk.src.virt.addr, walk.iv, nbytes,
@ -359,32 +359,30 @@ static int sm4_xts_crypt(struct skcipher_request *req, bool encrypt)
sm4_ce_xts_dec(ctx->key1.rkey_dec, walk.dst.virt.addr,
walk.src.virt.addr, walk.iv, nbytes,
rkey2_enc);
rkey2_enc = NULL;
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
if (err)
return err;
}
rkey2_enc = NULL;
if (likely(tail == 0))
return 0;
err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
/* handle ciphertext stealing */
dst = src = scatterwalk_ffwd(sg_src, req->src, subreq.cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, subreq.cryptlen);
skcipher_request_set_crypt(&subreq, src, dst,
SM4_BLOCK_SIZE + tail, req->iv);
err = skcipher_walk_virt(&walk, &subreq, false);
if (err)
return err;
}
if (likely(tail == 0))
return 0;
/* handle ciphertext stealing */
dst = src = scatterwalk_ffwd(sg_src, req->src, subreq.cryptlen);
if (req->dst != req->src)
dst = scatterwalk_ffwd(sg_dst, req->dst, subreq.cryptlen);
skcipher_request_set_crypt(&subreq, src, dst, SM4_BLOCK_SIZE + tail,
req->iv);
err = skcipher_walk_virt(&walk, &subreq, false);
if (err)
return err;
scoped_ksimd() {
if (encrypt)
sm4_ce_xts_enc(ctx->key1.rkey_enc, walk.dst.virt.addr,
walk.src.virt.addr, walk.iv, walk.nbytes,

View File

@ -4,7 +4,8 @@ menu "Accelerated Cryptographic Algorithms for CPU (riscv)"
config CRYPTO_AES_RISCV64
tristate "Ciphers: AES, modes: ECB, CBC, CTS, CTR, XTS"
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
depends on 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
select CRYPTO_ALGAPI
select CRYPTO_LIB_AES
select CRYPTO_SKCIPHER
@ -20,7 +21,8 @@ config CRYPTO_AES_RISCV64
config CRYPTO_GHASH_RISCV64
tristate "Hash functions: GHASH"
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
depends on 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
select CRYPTO_GCM
help
GCM GHASH function (NIST SP 800-38D)
@ -30,7 +32,8 @@ config CRYPTO_GHASH_RISCV64
config CRYPTO_SM3_RISCV64
tristate "Hash functions: SM3 (ShangMi 3)"
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
depends on 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
select CRYPTO_HASH
select CRYPTO_LIB_SM3
help
@ -42,7 +45,8 @@ config CRYPTO_SM3_RISCV64
config CRYPTO_SM4_RISCV64
tristate "Ciphers: SM4 (ShangMi 4)"
depends on 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
depends on 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
select CRYPTO_ALGAPI
select CRYPTO_SM4
help

View File

@ -321,9 +321,13 @@ static struct bio *__bio_chain_endio(struct bio *bio)
return parent;
}
/*
* This function should only be used as a flag and must never be called.
* If execution reaches here, it indicates a serious programming error.
*/
static void bio_chain_endio(struct bio *bio)
{
bio_endio(__bio_chain_endio(bio));
BUG();
}
/**

View File

@ -199,6 +199,7 @@ static bool blk_dma_map_iter_start(struct request *req, struct device *dma_dev,
if (blk_can_dma_map_iova(req, dma_dev) &&
dma_iova_try_alloc(dma_dev, state, vec.paddr, total_len))
return blk_rq_dma_map_iova(req, dma_dev, state, iter, &vec);
memset(state, 0, sizeof(*state));
return blk_dma_map_direct(req, dma_dev, iter, &vec);
}

View File

@ -336,12 +336,12 @@ void blk_mq_quiesce_tagset(struct blk_mq_tag_set *set)
{
struct request_queue *q;
mutex_lock(&set->tag_list_lock);
list_for_each_entry(q, &set->tag_list, tag_set_list) {
rcu_read_lock();
list_for_each_entry_rcu(q, &set->tag_list, tag_set_list) {
if (!blk_queue_skip_tagset_quiesce(q))
blk_mq_quiesce_queue_nowait(q);
}
mutex_unlock(&set->tag_list_lock);
rcu_read_unlock();
blk_mq_wait_quiesce_done(set);
}
@ -351,12 +351,12 @@ void blk_mq_unquiesce_tagset(struct blk_mq_tag_set *set)
{
struct request_queue *q;
mutex_lock(&set->tag_list_lock);
list_for_each_entry(q, &set->tag_list, tag_set_list) {
rcu_read_lock();
list_for_each_entry_rcu(q, &set->tag_list, tag_set_list) {
if (!blk_queue_skip_tagset_quiesce(q))
blk_mq_unquiesce_queue(q);
}
mutex_unlock(&set->tag_list_lock);
rcu_read_unlock();
}
EXPORT_SYMBOL_GPL(blk_mq_unquiesce_tagset);
@ -4311,7 +4311,7 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
struct blk_mq_tag_set *set = q->tag_set;
mutex_lock(&set->tag_list_lock);
list_del(&q->tag_set_list);
list_del_rcu(&q->tag_set_list);
if (list_is_singular(&set->tag_list)) {
/* just transitioned to unshared */
set->flags &= ~BLK_MQ_F_TAG_QUEUE_SHARED;
@ -4319,7 +4319,6 @@ static void blk_mq_del_queue_tag_set(struct request_queue *q)
blk_mq_update_tag_set_shared(set, false);
}
mutex_unlock(&set->tag_list_lock);
INIT_LIST_HEAD(&q->tag_set_list);
}
static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
@ -4338,7 +4337,7 @@ static void blk_mq_add_queue_tag_set(struct blk_mq_tag_set *set,
}
if (set->flags & BLK_MQ_F_TAG_QUEUE_SHARED)
queue_set_hctx_shared(q, true);
list_add_tail(&q->tag_set_list, &set->tag_list);
list_add_tail_rcu(&q->tag_set_list, &set->tag_list);
mutex_unlock(&set->tag_list_lock);
}
@ -5193,27 +5192,19 @@ EXPORT_SYMBOL_GPL(blk_mq_update_nr_hw_queues);
static int blk_hctx_poll(struct request_queue *q, struct blk_mq_hw_ctx *hctx,
struct io_comp_batch *iob, unsigned int flags)
{
long state = get_current_state();
int ret;
do {
ret = q->mq_ops->poll(hctx, iob);
if (ret > 0) {
__set_current_state(TASK_RUNNING);
if (ret > 0)
return ret;
}
if (signal_pending_state(state, current))
__set_current_state(TASK_RUNNING);
if (task_is_running(current))
if (task_sigpending(current))
return 1;
if (ret < 0 || (flags & BLK_POLL_ONESHOT))
break;
cpu_relax();
} while (!need_resched());
__set_current_state(TASK_RUNNING);
return 0;
}

View File

@ -2100,7 +2100,7 @@ static int blk_revalidate_seq_zone(struct blk_zone *zone, unsigned int idx,
* we have a zone write plug for such zone if the device has a zone
* write plug hash table.
*/
if (!queue_emulates_zone_append(disk->queue) || !disk->zone_wplugs_hash)
if (!disk->zone_wplugs_hash)
return 0;
wp_offset = disk_zone_wplug_sync_wp_offset(disk, zone);

View File

@ -926,6 +926,7 @@ static size_t ublk_copy_user_pages(const struct request *req,
size_t done = 0;
rq_for_each_segment(bv, req, iter) {
unsigned len;
void *bv_buf;
size_t copied;
@ -934,18 +935,17 @@ static size_t ublk_copy_user_pages(const struct request *req,
continue;
}
bv.bv_offset += offset;
bv.bv_len -= offset;
bv_buf = bvec_kmap_local(&bv);
len = bv.bv_len - offset;
bv_buf = kmap_local_page(bv.bv_page) + bv.bv_offset + offset;
if (dir == ITER_DEST)
copied = copy_to_iter(bv_buf, bv.bv_len, uiter);
copied = copy_to_iter(bv_buf, len, uiter);
else
copied = copy_from_iter(bv_buf, bv.bv_len, uiter);
copied = copy_from_iter(bv_buf, len, uiter);
kunmap_local(bv_buf);
done += copied;
if (copied < bv.bv_len)
if (copied < len)
break;
offset = 0;
@ -3673,6 +3673,19 @@ exit:
return ret;
}
static bool ublk_ctrl_uring_cmd_may_sleep(u32 cmd_op)
{
switch (_IOC_NR(cmd_op)) {
case UBLK_CMD_GET_QUEUE_AFFINITY:
case UBLK_CMD_GET_DEV_INFO:
case UBLK_CMD_GET_DEV_INFO2:
case _IOC_NR(UBLK_U_CMD_GET_FEATURES):
return false;
default:
return true;
}
}
static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,
unsigned int issue_flags)
{
@ -3681,7 +3694,8 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,
u32 cmd_op = cmd->cmd_op;
int ret = -EINVAL;
if (issue_flags & IO_URING_F_NONBLOCK)
if (ublk_ctrl_uring_cmd_may_sleep(cmd_op) &&
issue_flags & IO_URING_F_NONBLOCK)
return -EAGAIN;
ublk_ctrl_cmd_dump(cmd);

View File

@ -1104,7 +1104,7 @@ static void detached_dev_end_io(struct bio *bio)
}
kfree(ddip);
bio->bi_end_io(bio);
bio_endio(bio);
}
static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
@ -1121,7 +1121,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
ddip = kzalloc(sizeof(struct detached_dev_io_private), GFP_NOIO);
if (!ddip) {
bio->bi_status = BLK_STS_RESOURCE;
bio->bi_end_io(bio);
bio_endio(bio);
return;
}
@ -1136,7 +1136,7 @@ static void detached_dev_do_request(struct bcache_device *d, struct bio *bio,
if ((bio_op(bio) == REQ_OP_DISCARD) &&
!bdev_max_discard_sectors(dc->bdev))
bio->bi_end_io(bio);
detached_dev_end_io(bio);
else
submit_bio_noacct(bio);
}

View File

@ -258,7 +258,7 @@ err_start:
/*
* Kill the callback thread if it's no longer being used.
*/
void nfs_callback_down(int minorversion, struct net *net)
void nfs_callback_down(int minorversion, struct net *net, struct rpc_xprt *xprt)
{
struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
struct svc_serv *serv;
@ -270,7 +270,7 @@ void nfs_callback_down(int minorversion, struct net *net)
if (cb_info->users == 0) {
svc_set_num_threads(serv, NULL, 0);
dprintk("nfs_callback_down: service destroyed\n");
svc_destroy(&cb_info->serv);
xprt_svc_destroy_nullify_bc(xprt, &cb_info->serv);
}
mutex_unlock(&nfs_callback_mutex);
}

View File

@ -188,7 +188,8 @@ extern __be32 nfs4_callback_recall(void *argp, void *resp,
struct cb_process_state *cps);
#if IS_ENABLED(CONFIG_NFS_V4)
extern int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt);
extern void nfs_callback_down(int minorversion, struct net *net);
extern void nfs_callback_down(int minorversion, struct net *net,
struct rpc_xprt *xprt);
#endif /* CONFIG_NFS_V4 */
/*
* nfs41: Callbacks are expected to not cause substantial latency,

View File

@ -784,10 +784,18 @@ static int nfs_init_server(struct nfs_server *server,
server->fattr_valid = NFS_ATTR_FATTR_V4;
}
if (ctx->rsize)
if (ctx->bsize) {
server->bsize = ctx->bsize;
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_BSIZE;
}
if (ctx->rsize) {
server->rsize = nfs_io_size(ctx->rsize, clp->cl_proto);
if (ctx->wsize)
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_RSIZE;
}
if (ctx->wsize) {
server->wsize = nfs_io_size(ctx->wsize, clp->cl_proto);
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_WSIZE;
}
server->acregmin = ctx->acregmin * HZ;
server->acregmax = ctx->acregmax * HZ;
@ -977,8 +985,13 @@ EXPORT_SYMBOL_GPL(nfs_probe_server);
void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
{
target->flags = source->flags;
target->rsize = source->rsize;
target->wsize = source->wsize;
target->automount_inherit = source->automount_inherit;
if (source->automount_inherit & NFS_AUTOMOUNT_INHERIT_BSIZE)
target->bsize = source->bsize;
if (source->automount_inherit & NFS_AUTOMOUNT_INHERIT_RSIZE)
target->rsize = source->rsize;
if (source->automount_inherit & NFS_AUTOMOUNT_INHERIT_WSIZE)
target->wsize = source->wsize;
target->acregmin = source->acregmin;
target->acregmax = source->acregmax;
target->acdirmin = source->acdirmin;

View File

@ -30,6 +30,11 @@
static unsigned nfs_delegation_watermark = NFS_DEFAULT_DELEGATION_WATERMARK;
module_param_named(delegation_watermark, nfs_delegation_watermark, uint, 0644);
bool directory_delegations = true;
module_param(directory_delegations, bool, 0644);
MODULE_PARM_DESC(directory_delegations,
"Enable the use of directory delegations, defaults to on.");
static struct hlist_head *nfs_delegation_hash(struct nfs_server *server,
const struct nfs_fh *fhandle)
{
@ -143,6 +148,8 @@ static int nfs4_do_check_delegation(struct inode *inode, fmode_t type,
*/
int nfs4_have_delegation(struct inode *inode, fmode_t type, int flags)
{
if (S_ISDIR(inode->i_mode) && !directory_delegations)
nfs_inode_evict_delegation(inode);
return nfs4_do_check_delegation(inode, type, flags, true);
}
@ -379,6 +386,7 @@ nfs_detach_delegation_locked(struct nfs_inode *nfsi,
delegation->inode = NULL;
rcu_assign_pointer(nfsi->delegation, NULL);
spin_unlock(&delegation->lock);
clear_bit(NFS_INO_REQ_DIR_DELEG, &nfsi->flags);
return delegation;
}

View File

@ -124,6 +124,19 @@ static inline int nfs_have_delegated_mtime(struct inode *inode)
NFS_DELEGATION_FLAG_TIME);
}
extern bool directory_delegations;
static inline void nfs_request_directory_delegation(struct inode *inode)
{
if (S_ISDIR(inode->i_mode))
set_bit(NFS_INO_REQ_DIR_DELEG, &NFS_I(inode)->flags);
}
static inline bool nfs_have_directory_delegation(struct inode *inode)
{
return S_ISDIR(inode->i_mode) && nfs_have_delegated_attributes(inode);
}
int nfs4_delegation_hash_alloc(struct nfs_server *server);
#endif

View File

@ -789,16 +789,17 @@ again:
goto out;
}
nfs_set_verifier(dentry, dir_verifier);
inode = nfs_fhget(dentry->d_sb, entry->fh, entry->fattr);
alias = d_splice_alias(inode, dentry);
d_lookup_done(dentry);
if (alias) {
if (IS_ERR(alias))
goto out;
nfs_set_verifier(alias, dir_verifier);
dput(dentry);
dentry = alias;
}
nfs_set_verifier(dentry, dir_verifier);
trace_nfs_readdir_lookup(d_inode(parent), dentry, 0);
out:
dput(dentry);
@ -1514,6 +1515,15 @@ static int nfs_check_verifier(struct inode *dir, struct dentry *dentry,
return 0;
if (!nfs_dentry_verify_change(dir, dentry))
return 0;
/*
* If we have a directory delegation then we don't need to revalidate
* the directory. The delegation will either get recalled or we will
* receive a notification when it changes.
*/
if (nfs_have_directory_delegation(dir))
return 0;
/* Revalidate nfsi->cache_change_attribute before we declare a match */
if (nfs_mapping_need_revalidate_inode(dir)) {
if (rcu_walk)
@ -1894,13 +1904,15 @@ static int nfs_dentry_delete(const struct dentry *dentry)
}
/* Ensure that we revalidate inode->i_nlink */
static void nfs_drop_nlink(struct inode *inode)
static void nfs_drop_nlink(struct inode *inode, unsigned long gencount)
{
struct nfs_inode *nfsi = NFS_I(inode);
spin_lock(&inode->i_lock);
/* drop the inode if we're reasonably sure this is the last link */
if (inode->i_nlink > 0)
if (inode->i_nlink > 0 && gencount == nfsi->attr_gencount)
drop_nlink(inode);
NFS_I(inode)->attr_gencount = nfs_inc_attr_generation_counter();
nfsi->attr_gencount = nfs_inc_attr_generation_counter();
nfs_set_cache_invalid(
inode, NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_CTIME |
NFS_INO_INVALID_NLINK);
@ -1914,8 +1926,9 @@ static void nfs_drop_nlink(struct inode *inode)
static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
{
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
unsigned long gencount = READ_ONCE(NFS_I(inode)->attr_gencount);
nfs_complete_unlink(dentry, inode);
nfs_drop_nlink(inode);
nfs_drop_nlink(inode, gencount);
}
iput(inode);
}
@ -1991,13 +2004,14 @@ struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned in
nfs_lookup_advise_force_readdirplus(dir, flags);
no_entry:
nfs_set_verifier(dentry, dir_verifier);
res = d_splice_alias(inode, dentry);
if (res != NULL) {
if (IS_ERR(res))
goto out;
nfs_set_verifier(res, dir_verifier);
dentry = res;
}
nfs_set_verifier(dentry, dir_verifier);
out:
trace_nfs_lookup_exit(dir, dentry, flags, PTR_ERR_OR_ZERO(res));
nfs_free_fattr(fattr);
@ -2139,12 +2153,12 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
d_drop(dentry);
switch (err) {
case -ENOENT:
d_splice_alias(NULL, dentry);
if (nfs_server_capable(dir, NFS_CAP_CASE_INSENSITIVE))
dir_verifier = inode_peek_iversion_raw(dir);
else
dir_verifier = nfs_save_change_attribute(dir);
nfs_set_verifier(dentry, dir_verifier);
d_splice_alias(NULL, dentry);
break;
case -EISDIR:
case -ENOTDIR:
@ -2202,6 +2216,13 @@ no_open:
}
EXPORT_SYMBOL_GPL(nfs_atomic_open);
static int
nfs_lookup_revalidate_delegated_parent(struct inode *dir, struct dentry *dentry,
struct inode *inode)
{
return nfs_lookup_revalidate_done(dir, dentry, inode, 1);
}
static int
nfs4_lookup_revalidate(struct inode *dir, const struct qstr *name,
struct dentry *dentry, unsigned int flags)
@ -2229,6 +2250,9 @@ nfs4_lookup_revalidate(struct inode *dir, const struct qstr *name,
if (nfs_verifier_is_delegated(dentry))
return nfs_lookup_revalidate_delegated(dir, dentry, inode);
if (nfs_have_directory_delegation(dir))
return nfs_lookup_revalidate_delegated_parent(dir, dentry, inode);
/* NFS only supports OPEN on regular files */
if (!S_ISREG(inode->i_mode))
goto full_reval;
@ -2507,9 +2531,11 @@ static int nfs_safe_remove(struct dentry *dentry)
trace_nfs_remove_enter(dir, dentry);
if (inode != NULL) {
unsigned long gencount = READ_ONCE(NFS_I(inode)->attr_gencount);
error = NFS_PROTO(dir)->remove(dir, dentry);
if (error == 0)
nfs_drop_nlink(inode);
nfs_drop_nlink(inode, gencount);
} else
error = NFS_PROTO(dir)->remove(dir, dentry);
if (error == -ENOENT)
@ -2709,6 +2735,7 @@ int nfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
{
struct inode *old_inode = d_inode(old_dentry);
struct inode *new_inode = d_inode(new_dentry);
unsigned long new_gencount = 0;
struct dentry *dentry = NULL;
struct rpc_task *task;
bool must_unblock = false;
@ -2761,6 +2788,7 @@ int nfs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
} else {
block_revalidate(new_dentry);
must_unblock = true;
new_gencount = NFS_I(new_inode)->attr_gencount;
spin_unlock(&new_dentry->d_lock);
}
@ -2800,7 +2828,7 @@ out:
new_dir, new_dentry, error);
if (!error) {
if (new_inode != NULL)
nfs_drop_nlink(new_inode);
nfs_drop_nlink(new_inode, new_gencount);
/*
* The d_move() should be here instead of in an async RPC completion
* handler because we need the proper locks to move the dentry. If

View File

@ -1389,6 +1389,9 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
status = pnfs_sync_inode(inode, false);
if (status)
goto out;
} else if (nfs_have_directory_delegation(inode)) {
status = 0;
goto out;
}
status = -ENOMEM;

View File

@ -13,7 +13,7 @@
#include <linux/nfslocalio.h>
#include <linux/wait_bit.h>
#define NFS_SB_MASK (SB_NOSUID|SB_NODEV|SB_NOEXEC|SB_SYNCHRONOUS)
#define NFS_SB_MASK (SB_RDONLY|SB_NOSUID|SB_NODEV|SB_NOEXEC|SB_SYNCHRONOUS)
extern const struct export_operations nfs_export_ops;
@ -152,7 +152,6 @@ struct nfs_fs_context {
struct super_block *sb;
struct dentry *dentry;
struct nfs_fattr *fattr;
unsigned int inherited_bsize;
} clone_data;
};

View File

@ -43,8 +43,8 @@ struct nfs_local_kiocb {
size_t end_len;
short int end_iter_index;
atomic_t n_iters;
struct iov_iter iters[NFSLOCAL_MAX_IOS];
bool iter_is_dio_aligned[NFSLOCAL_MAX_IOS];
struct iov_iter iters[NFSLOCAL_MAX_IOS] ____cacheline_aligned;
/* End mostly DIO-specific members */
};
@ -339,8 +339,6 @@ nfs_is_local_dio_possible(struct nfs_local_kiocb *iocb, int rw,
if (unlikely(!nf_dio_mem_align || !nf_dio_offset_align))
return false;
if (unlikely(nf_dio_offset_align > PAGE_SIZE))
return false;
if (unlikely(len < nf_dio_offset_align))
return false;

View File

@ -149,6 +149,7 @@ struct vfsmount *nfs_d_automount(struct path *path)
struct vfsmount *mnt = ERR_PTR(-ENOMEM);
struct nfs_server *server = NFS_SB(path->dentry->d_sb);
struct nfs_client *client = server->nfs_client;
unsigned long s_flags = path->dentry->d_sb->s_flags;
int timeout = READ_ONCE(nfs_mountpoint_expiry_timeout);
int ret;
@ -169,11 +170,21 @@ struct vfsmount *nfs_d_automount(struct path *path)
if (!ctx->clone_data.fattr)
goto out_fc;
if (fc->cred != server->cred) {
put_cred(fc->cred);
fc->cred = get_cred(server->cred);
}
if (fc->net_ns != client->cl_net) {
put_net(fc->net_ns);
fc->net_ns = get_net(client->cl_net);
}
/* Inherit the flags covered by NFS_SB_MASK */
fc->sb_flags_mask |= NFS_SB_MASK;
fc->sb_flags &= ~NFS_SB_MASK;
fc->sb_flags |= s_flags & NFS_SB_MASK;
/* for submounts we want the same server; referrals will reassign */
memcpy(&ctx->nfs_server._address, &client->cl_addr, client->cl_addrlen);
ctx->nfs_server.addrlen = client->cl_addrlen;
@ -184,6 +195,10 @@ struct vfsmount *nfs_d_automount(struct path *path)
ctx->nfs_mod = client->cl_nfs_mod;
get_nfs_version(ctx->nfs_mod);
/* Inherit block sizes if they were specified as mount parameters */
if (server->automount_inherit & NFS_AUTOMOUNT_INHERIT_BSIZE)
ctx->bsize = server->bsize;
ret = client->rpc_ops->submount(fc, server);
if (ret < 0) {
mnt = ERR_PTR(ret);
@ -283,7 +298,6 @@ int nfs_do_submount(struct fs_context *fc)
return -ENOMEM;
ctx->internal = true;
ctx->clone_data.inherited_bsize = ctx->clone_data.sb->s_blocksize_bits;
p = nfs_devname(dentry, buffer, 4096);
if (IS_ERR(p)) {

View File

@ -483,7 +483,8 @@ nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir)
static void
nfs3_proc_rename_setup(struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry)
struct dentry *new_dentry,
struct inode *same_parent)
{
msg->rpc_proc = &nfs3_procedures[NFS3PROC_RENAME];
}

View File

@ -281,8 +281,13 @@ error:
*/
static void nfs4_destroy_callback(struct nfs_client *clp)
{
if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
nfs_callback_down(clp->cl_mvops->minor_version, clp->cl_net);
if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) {
struct rpc_xprt *xprt;
xprt = rcu_dereference_raw(clp->cl_rpcclient->cl_xprt);
nfs_callback_down(clp->cl_mvops->minor_version, clp->cl_net,
xprt);
}
}
static void nfs4_shutdown_client(struct nfs_client *clp)
@ -1174,10 +1179,20 @@ static int nfs4_init_server(struct nfs_server *server, struct fs_context *fc)
if (error < 0)
return error;
if (ctx->rsize)
server->rsize = nfs_io_size(ctx->rsize, server->nfs_client->cl_proto);
if (ctx->wsize)
server->wsize = nfs_io_size(ctx->wsize, server->nfs_client->cl_proto);
if (ctx->bsize) {
server->bsize = ctx->bsize;
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_BSIZE;
}
if (ctx->rsize) {
server->rsize =
nfs_io_size(ctx->rsize, server->nfs_client->cl_proto);
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_RSIZE;
}
if (ctx->wsize) {
server->wsize =
nfs_io_size(ctx->wsize, server->nfs_client->cl_proto);
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_WSIZE;
}
server->acregmin = ctx->acregmin * HZ;
server->acregmax = ctx->acregmax * HZ;

View File

@ -1780,8 +1780,17 @@ static void nfs_set_open_stateid_locked(struct nfs4_state *state,
if (nfs_stateid_is_sequential(state, stateid))
break;
if (status)
break;
if (status) {
if (nfs4_stateid_match_other(stateid, &state->open_stateid) &&
!nfs4_stateid_is_newer(stateid, &state->open_stateid)) {
trace_nfs4_open_stateid_update_skip(state->inode,
stateid, status);
return;
} else {
break;
}
}
/* Rely on seqids for serialisation with NFSv4.0 */
if (!nfs4_has_session(NFS_SERVER(state->inode)->nfs_client))
break;
@ -3174,18 +3183,6 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
if (opendata->o_res.rflags & NFS4_OPEN_RESULT_PRESERVE_UNLINKED)
set_bit(NFS_INO_PRESERVE_UNLINKED, &NFS_I(state->inode)->flags);
dentry = opendata->dentry;
if (d_really_is_negative(dentry)) {
struct dentry *alias;
d_drop(dentry);
alias = d_splice_alias(igrab(state->inode), dentry);
/* d_splice_alias() can't fail here - it's a non-directory */
if (alias) {
dput(ctx->dentry);
ctx->dentry = dentry = alias;
}
}
switch(opendata->o_arg.claim) {
default:
break;
@ -3196,7 +3193,20 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
break;
if (opendata->o_res.delegation.type != 0)
dir_verifier = nfs_save_change_attribute(dir);
nfs_set_verifier(dentry, dir_verifier);
}
dentry = opendata->dentry;
nfs_set_verifier(dentry, dir_verifier);
if (d_really_is_negative(dentry)) {
struct dentry *alias;
d_drop(dentry);
alias = d_splice_alias(igrab(state->inode), dentry);
/* d_splice_alias() can't fail here - it's a non-directory */
if (alias) {
dput(ctx->dentry);
nfs_set_verifier(alias, dir_verifier);
ctx->dentry = dentry = alias;
}
}
/* Parse layoutget results before we check for access */
@ -4460,6 +4470,30 @@ out:
return status;
}
#if IS_ENABLED(CONFIG_NFS_V4_1)
static bool should_request_dir_deleg(struct inode *inode)
{
if (!directory_delegations)
return false;
if (!inode)
return false;
if (!S_ISDIR(inode->i_mode))
return false;
if (!nfs_server_capable(inode, NFS_CAP_DIR_DELEG))
return false;
if (!test_and_clear_bit(NFS_INO_REQ_DIR_DELEG, &(NFS_I(inode)->flags)))
return false;
if (nfs4_have_delegation(inode, FMODE_READ, 0))
return false;
return true;
}
#else
static bool should_request_dir_deleg(struct inode *inode)
{
return false;
}
#endif /* CONFIG_NFS_V4_1 */
static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
struct nfs_fattr *fattr, struct inode *inode)
{
@ -4477,7 +4511,9 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
.rpc_argp = &args,
.rpc_resp = &res,
};
struct nfs4_gdd_res gdd_res;
unsigned short task_flags = 0;
int status;
if (nfs4_has_session(server->nfs_client))
task_flags = RPC_TASK_MOVEABLE;
@ -4486,11 +4522,31 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
if (inode && (server->flags & NFS_MOUNT_SOFTREVAL))
task_flags |= RPC_TASK_TIMEOUT;
args.get_dir_deleg = should_request_dir_deleg(inode);
if (args.get_dir_deleg)
res.gdd_res = &gdd_res;
nfs4_bitmap_copy_adjust(bitmask, nfs4_bitmask(server, fattr->label), inode, 0);
nfs_fattr_init(fattr);
nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 0);
return nfs4_do_call_sync(server->client, server, &msg,
&args.seq_args, &res.seq_res, task_flags);
status = nfs4_do_call_sync(server->client, server, &msg,
&args.seq_args, &res.seq_res, task_flags);
if (args.get_dir_deleg) {
switch (status) {
case 0:
if (gdd_res.status != GDD4_OK)
break;
status = nfs_inode_set_delegation(
inode, current_cred(), FMODE_READ,
&gdd_res.deleg, 0, NFS4_OPEN_DELEGATE_READ);
break;
case -ENOTSUPP:
case -EOPNOTSUPP:
server->caps &= ~NFS_CAP_DIR_DELEG;
}
}
return status;
}
int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
@ -4503,8 +4559,14 @@ int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
do {
err = _nfs4_proc_getattr(server, fhandle, fattr, inode);
trace_nfs4_getattr(server, fhandle, fattr, err);
err = nfs4_handle_exception(server, err,
&exception);
switch (err) {
default:
err = nfs4_handle_exception(server, err, &exception);
break;
case -ENOTSUPP:
case -EOPNOTSUPP:
exception.retry = true;
}
} while (exception.retry);
return err;
}
@ -4768,6 +4830,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry
int status = 0;
if (!nfs4_have_delegation(inode, FMODE_READ, 0)) {
nfs_request_directory_delegation(inode);
res.fattr = nfs_alloc_fattr();
if (res.fattr == NULL)
return -ENOMEM;
@ -4875,6 +4938,8 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
ilabel = nfs4_label_init_security(dir, dentry, sattr, &l);
nfs_request_directory_delegation(dir);
if (!(server->attr_bitmask[2] & FATTR4_WORD2_MODE_UMASK))
sattr->ia_mode &= ~current_umask();
state = nfs4_do_open(dir, ctx, flags, sattr, ilabel, NULL);
@ -4971,6 +5036,7 @@ static void nfs4_proc_unlink_setup(struct rpc_message *msg,
nfs4_init_sequence(&args->seq_args, &res->seq_res, 1, 0);
nfs_fattr_init(res->dir_attr);
nfs_request_directory_delegation(d_inode(dentry->d_parent));
if (inode) {
nfs4_inode_return_delegation(inode);
@ -5005,7 +5071,8 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
static void nfs4_proc_rename_setup(struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry)
struct dentry *new_dentry,
struct inode *same_parent)
{
struct nfs_renameargs *arg = msg->rpc_argp;
struct nfs_renameres *res = msg->rpc_resp;
@ -5016,6 +5083,8 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg,
nfs4_inode_make_writeable(old_inode);
if (new_inode)
nfs4_inode_return_delegation(new_inode);
if (same_parent)
nfs_request_directory_delegation(same_parent);
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME];
res->server = NFS_SB(old_dentry->d_sb);
nfs4_init_sequence(&arg->seq_args, &res->seq_res, 1, 0);
@ -10822,6 +10891,7 @@ static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
.minor_version = 1,
.init_caps = NFS_CAP_READDIRPLUS
| NFS_CAP_ATOMIC_OPEN
| NFS_CAP_DIR_DELEG
| NFS_CAP_POSIX_LOCK
| NFS_CAP_STATEID_NFSV41
| NFS_CAP_ATOMIC_OPEN_V1
@ -10848,6 +10918,7 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = {
.minor_version = 2,
.init_caps = NFS_CAP_READDIRPLUS
| NFS_CAP_ATOMIC_OPEN
| NFS_CAP_DIR_DELEG
| NFS_CAP_POSIX_LOCK
| NFS_CAP_STATEID_NFSV41
| NFS_CAP_ATOMIC_OPEN_V1

View File

@ -1353,6 +1353,7 @@ DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_skip);
DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
DECLARE_EVENT_CLASS(nfs4_getattr_event,

View File

@ -393,6 +393,20 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5)
#define encode_reclaim_complete_maxsz (op_encode_hdr_maxsz + 4)
#define decode_reclaim_complete_maxsz (op_decode_hdr_maxsz + 4)
#define encode_get_dir_deleg_maxsz (op_encode_hdr_maxsz + \
4 /* gdda_signal_deleg_avail */ + \
8 /* gdda_notification_types */ + \
nfstime4_maxsz /* gdda_child_attr_delay */ + \
nfstime4_maxsz /* gdda_dir_attr_delay */ + \
nfs4_fattr_bitmap_maxsz /* gdda_child_attributes */ + \
nfs4_fattr_bitmap_maxsz /* gdda_dir_attributes */)
#define decode_get_dir_deleg_maxsz (op_decode_hdr_maxsz + \
4 /* gddrnf_status */ + \
encode_verifier_maxsz /* gddr_cookieverf */ + \
encode_stateid_maxsz /* gddr_stateid */ + \
8 /* gddr_notification */ + \
nfs4_fattr_maxsz /* gddr_child_attributes */ + \
nfs4_fattr_maxsz /* gddr_dir_attributes */)
#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + \
XDR_QUADLEN(NFS4_DEVICEID4_SIZE) + \
1 /* layout type */ + \
@ -444,6 +458,8 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
#else /* CONFIG_NFS_V4_1 */
#define encode_sequence_maxsz 0
#define decode_sequence_maxsz 0
#define encode_get_dir_deleg_maxsz 0
#define decode_get_dir_deleg_maxsz 0
#define encode_layoutreturn_maxsz 0
#define decode_layoutreturn_maxsz 0
#define encode_layoutget_maxsz 0
@ -631,11 +647,13 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
#define NFS4_enc_getattr_sz (compound_encode_hdr_maxsz + \
encode_sequence_maxsz + \
encode_putfh_maxsz + \
encode_get_dir_deleg_maxsz + \
encode_getattr_maxsz + \
encode_renew_maxsz)
#define NFS4_dec_getattr_sz (compound_decode_hdr_maxsz + \
decode_sequence_maxsz + \
decode_putfh_maxsz + \
decode_get_dir_deleg_maxsz + \
decode_getattr_maxsz + \
decode_renew_maxsz)
#define NFS4_enc_lookup_sz (compound_encode_hdr_maxsz + \
@ -2007,6 +2025,33 @@ static void encode_sequence(struct xdr_stream *xdr,
}
#ifdef CONFIG_NFS_V4_1
static void
encode_get_dir_delegation(struct xdr_stream *xdr, struct compound_hdr *hdr)
{
struct timespec64 ts = { 0, 0 };
u32 notifications[1] = { 0 };
u32 attributes[1] = { 0 };
__be32 *p;
encode_op_hdr(xdr, OP_GET_DIR_DELEGATION, decode_get_dir_deleg_maxsz, hdr);
/* We don't handle CB_RECALLABLE_OBJ_AVAIL yet. */
xdr_stream_encode_bool(xdr, false);
xdr_encode_bitmap4(xdr, notifications, ARRAY_SIZE(notifications));
/* Request no delay on attribute updates */
p = reserve_space(xdr, 12 + 12);
p = xdr_encode_nfstime4(p, &ts);
xdr_encode_nfstime4(p, &ts);
/* Requested child attributes */
xdr_encode_bitmap4(xdr, attributes, ARRAY_SIZE(attributes));
/* Requested dir attributes */
xdr_encode_bitmap4(xdr, attributes, ARRAY_SIZE(attributes));
}
static void
encode_getdeviceinfo(struct xdr_stream *xdr,
const struct nfs4_getdeviceinfo_args *args,
@ -2142,6 +2187,11 @@ static void encode_free_stateid(struct xdr_stream *xdr,
encode_nfs4_stateid(xdr, &args->stateid);
}
#else
static inline void
encode_get_dir_delegation(struct xdr_stream *xdr, struct compound_hdr *hdr)
{
}
static inline void
encode_layoutreturn(struct xdr_stream *xdr,
const struct nfs4_layoutreturn_args *args,
@ -2356,6 +2406,8 @@ static void nfs4_xdr_enc_getattr(struct rpc_rqst *req, struct xdr_stream *xdr,
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
if (args->get_dir_deleg)
encode_get_dir_delegation(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
}
@ -5994,6 +6046,49 @@ static int decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
return decode_stateid(xdr, stateid);
}
static int decode_get_dir_delegation(struct xdr_stream *xdr,
struct nfs4_getattr_res *res)
{
struct nfs4_gdd_res *gdd_res = res->gdd_res;
nfs4_verifier cookieverf;
u32 bitmap[1];
int status;
status = decode_op_hdr(xdr, OP_GET_DIR_DELEGATION);
if (status)
return status;
if (xdr_stream_decode_u32(xdr, &gdd_res->status))
return -EIO;
if (gdd_res->status == GDD4_UNAVAIL)
return xdr_inline_decode(xdr, 4) ? 0 : -EIO;
status = decode_verifier(xdr, &cookieverf);
if (status)
return status;
status = decode_delegation_stateid(xdr, &gdd_res->deleg);
if (status)
return status;
/* Decode supported notification types. */
status = decode_bitmap4(xdr, bitmap, ARRAY_SIZE(bitmap));
if (status < 0)
return status;
/* Decode supported child attributes. */
status = decode_bitmap4(xdr, bitmap, ARRAY_SIZE(bitmap));
if (status < 0)
return status;
/* Decode supported attributes. */
status = decode_bitmap4(xdr, bitmap, ARRAY_SIZE(bitmap));
if (status < 0)
return status;
return 0;
}
static int decode_getdeviceinfo(struct xdr_stream *xdr,
struct nfs4_getdeviceinfo_res *res)
{
@ -6208,6 +6303,12 @@ static int decode_free_stateid(struct xdr_stream *xdr,
return res->status;
}
#else
static int decode_get_dir_delegation(struct xdr_stream *xdr,
struct nfs4_getattr_res *res)
{
return 0;
}
static inline
int decode_layoutreturn(struct xdr_stream *xdr,
struct nfs4_layoutreturn_res *res)
@ -6525,6 +6626,11 @@ static int nfs4_xdr_dec_getattr(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
status = decode_putfh(xdr);
if (status)
goto out;
if (res->gdd_res) {
status = decode_get_dir_delegation(xdr, res);
if (status)
goto out;
}
status = decode_getfattr(xdr, res->fattr, res->server);
out:
return status;

View File

@ -464,6 +464,7 @@ pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
struct pnfs_layout_segment *lseg, *next;
set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags);
clear_bit(NFS_INO_LAYOUTCOMMIT, &NFS_I(lo->plh_inode)->flags);
list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
pnfs_clear_lseg_state(lseg, lseg_list);
pnfs_clear_layoutreturn_info(lo);

View File

@ -353,7 +353,8 @@ static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir)
static void
nfs_proc_rename_setup(struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry)
struct dentry *new_dentry,
struct inode *same_parent)
{
msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME];
}

View File

@ -1051,16 +1051,6 @@ int nfs_reconfigure(struct fs_context *fc)
sync_filesystem(sb);
/*
* The SB_RDONLY flag has been removed from the superblock during
* mounts to prevent interference between different filesystems.
* Similarly, it is also necessary to ignore the SB_RDONLY flag
* during reconfiguration; otherwise, it may also result in the
* creation of redundant superblocks when mounting a directory with
* different rw and ro flags multiple times.
*/
fc->sb_flags_mask &= ~SB_RDONLY;
/*
* Userspace mount programs that send binary options generally send
* them populated with default values. We have no way to know which
@ -1101,8 +1091,9 @@ static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
sb->s_blocksize = 0;
sb->s_xattr = server->nfs_client->cl_nfs_mod->xattr;
sb->s_op = server->nfs_client->cl_nfs_mod->sops;
if (ctx->bsize)
sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits);
if (server->bsize)
sb->s_blocksize =
nfs_block_size(server->bsize, &sb->s_blocksize_bits);
switch (server->nfs_client->rpc_ops->version) {
case 2:
@ -1318,26 +1309,13 @@ int nfs_get_tree_common(struct fs_context *fc)
if (IS_ERR(server))
return PTR_ERR(server);
/*
* When NFS_MOUNT_UNSHARED is not set, NFS forces the sharing of a
* superblock among each filesystem that mounts sub-directories
* belonging to a single exported root path.
* To prevent interference between different filesystems, the
* SB_RDONLY flag should be removed from the superblock.
*/
if (server->flags & NFS_MOUNT_UNSHARED)
compare_super = NULL;
else
fc->sb_flags &= ~SB_RDONLY;
/* -o noac implies -o sync */
if (server->flags & NFS_MOUNT_NOAC)
fc->sb_flags |= SB_SYNCHRONOUS;
if (ctx->clone_data.sb)
if (ctx->clone_data.sb->s_flags & SB_SYNCHRONOUS)
fc->sb_flags |= SB_SYNCHRONOUS;
/* Get a superblock - note that we may end up sharing one that already exists */
fc->s_fs_info = server;
s = sget_fc(fc, compare_super, nfs_set_super);
@ -1361,13 +1339,8 @@ int nfs_get_tree_common(struct fs_context *fc)
}
if (!s->s_root) {
unsigned bsize = ctx->clone_data.inherited_bsize;
/* initial superblock/root creation */
nfs_fill_super(s, ctx);
if (bsize) {
s->s_blocksize_bits = bsize;
s->s_blocksize = 1U << bsize;
}
error = nfs_get_cache_cookie(s, ctx);
if (error < 0)
goto error_splat_super;

View File

@ -390,7 +390,8 @@ nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
nfs_sb_active(old_dir->i_sb);
NFS_PROTO(data->old_dir)->rename_setup(&msg, old_dentry, new_dentry);
NFS_PROTO(data->old_dir)->rename_setup(&msg, old_dentry, new_dentry,
old_dir == new_dir ? old_dir : NULL);
return rpc_run_task(&task_setup_data);
}

View File

@ -1357,37 +1357,6 @@ typedef struct smb_com_transaction_change_notify_rsp {
__u16 ByteCount;
/* __u8 Pad[3]; */
} __packed TRANSACT_CHANGE_NOTIFY_RSP;
/* Completion Filter flags for Notify */
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
#define FILE_NOTIFY_CHANGE_NAME 0x00000003
#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
#define FILE_NOTIFY_CHANGE_EA 0x00000080
#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
#define FILE_ACTION_ADDED 0x00000001
#define FILE_ACTION_REMOVED 0x00000002
#define FILE_ACTION_MODIFIED 0x00000003
#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
#define FILE_ACTION_ADDED_STREAM 0x00000006
#define FILE_ACTION_REMOVED_STREAM 0x00000007
#define FILE_ACTION_MODIFIED_STREAM 0x00000008
/* response contains array of the following structures */
struct file_notify_information {
__le32 NextEntryOffset;
__le32 Action;
__le32 FileNameLength;
__u8 FileName[];
} __packed;
struct cifs_quota_data {
__u32 rsrvd1; /* 0 */
@ -2034,40 +2003,6 @@ typedef struct {
#define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */
/* DeviceType Flags */
#define FILE_DEVICE_CD_ROM 0x00000002
#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
#define FILE_DEVICE_DFS 0x00000006
#define FILE_DEVICE_DISK 0x00000007
#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
#define FILE_DEVICE_FILE_SYSTEM 0x00000009
#define FILE_DEVICE_NAMED_PIPE 0x00000011
#define FILE_DEVICE_NETWORK 0x00000012
#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
#define FILE_DEVICE_NULL 0x00000015
#define FILE_DEVICE_PARALLEL_PORT 0x00000016
#define FILE_DEVICE_PRINTER 0x00000018
#define FILE_DEVICE_SERIAL_PORT 0x0000001b
#define FILE_DEVICE_STREAMS 0x0000001e
#define FILE_DEVICE_TAPE 0x0000001f
#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
#define FILE_DEVICE_VIRTUAL_DISK 0x00000024
#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
/* Device Characteristics */
#define FILE_REMOVABLE_MEDIA 0x00000001
#define FILE_READ_ONLY_DEVICE 0x00000002
#define FILE_FLOPPY_DISKETTE 0x00000004
#define FILE_WRITE_ONCE_MEDIA 0x00000008
#define FILE_REMOTE_DEVICE 0x00000010
#define FILE_DEVICE_IS_MOUNTED 0x00000020
#define FILE_VIRTUAL_VOLUME 0x00000040
#define FILE_DEVICE_SECURE_OPEN 0x00000100
#define FILE_CHARACTERISTIC_TS_DEVICE 0x00001000
#define FILE_CHARACTERISTIC_WEBDAV_DEVICE 0x00002000
#define FILE_PORTABLE_DEVICE 0x00004000
#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
/******************************************************************************/
/* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */
/******************************************************************************/

View File

@ -13,6 +13,7 @@
const struct nt_err_code_struct nt_errs[] = {
{"NT_STATUS_OK", NT_STATUS_OK},
{"NT_STATUS_PENDING", NT_STATUS_PENDING},
{"NT_STATUS_MEDIA_CHANGED", NT_STATUS_MEDIA_CHANGED},
{"NT_STATUS_END_OF_MEDIA", NT_STATUS_END_OF_MEDIA},
{"NT_STATUS_MEDIA_CHECK", NT_STATUS_MEDIA_CHECK},
@ -544,6 +545,7 @@ const struct nt_err_code_struct nt_errs[] = {
{"NT_STATUS_DOMAIN_TRUST_INCONSISTENT",
NT_STATUS_DOMAIN_TRUST_INCONSISTENT},
{"NT_STATUS_FS_DRIVER_REQUIRED", NT_STATUS_FS_DRIVER_REQUIRED},
{"NT_STATUS_INVALID_LOCK_RANGE", NT_STATUS_INVALID_LOCK_RANGE},
{"NT_STATUS_NO_USER_SESSION_KEY", NT_STATUS_NO_USER_SESSION_KEY},
{"NT_STATUS_USER_SESSION_DELETED", NT_STATUS_USER_SESSION_DELETED},
{"NT_STATUS_RESOURCE_LANG_NOT_FOUND",
@ -675,9 +677,12 @@ const struct nt_err_code_struct nt_errs[] = {
NT_STATUS_QUOTA_LIST_INCONSISTENT},
{"NT_STATUS_FILE_IS_OFFLINE", NT_STATUS_FILE_IS_OFFLINE},
{"NT_STATUS_NOT_A_REPARSE_POINT", NT_STATUS_NOT_A_REPARSE_POINT},
{"NT_STATUS_NETWORK_SESSION_EXPIRED", NT_STATUS_NETWORK_SESSION_EXPIRED},
{"NT_STATUS_NO_MORE_ENTRIES", NT_STATUS_NO_MORE_ENTRIES},
{"NT_STATUS_MORE_ENTRIES", NT_STATUS_MORE_ENTRIES},
{"NT_STATUS_SOME_UNMAPPED", NT_STATUS_SOME_UNMAPPED},
{"NT_STATUS_NO_SUCH_JOB", NT_STATUS_NO_SUCH_JOB},
{"NT_STATUS_NO_PREAUTH_INTEGRITY_HASH_OVERLAP",
NT_STATUS_NO_PREAUTH_INTEGRITY_HASH_OVERLAP},
{NULL, 0}
};

File diff suppressed because it is too large Load Diff

View File

@ -144,6 +144,62 @@ typedef struct {
__le32 DeviceCharacteristics;
} __packed FILE_SYSTEM_DEVICE_INFO; /* device info level 0x104 */
/*
* File Attributes
* See MS-FSCC 2.6
*/
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
#define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
#define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
#define FILE_ATTRIBUTE_MASK (FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN | \
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY | \
FILE_ATTRIBUTE_ARCHIVE | FILE_ATTRIBUTE_NORMAL | \
FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_SPARSE_FILE | \
FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_COMPRESSED | \
FILE_ATTRIBUTE_OFFLINE | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | \
FILE_ATTRIBUTE_ENCRYPTED | FILE_ATTRIBUTE_INTEGRITY_STREAM | \
FILE_ATTRIBUTE_NO_SCRUB_DATA)
#define FILE_ATTRIBUTE_READONLY_LE cpu_to_le32(FILE_ATTRIBUTE_READONLY)
#define FILE_ATTRIBUTE_HIDDEN_LE cpu_to_le32(FILE_ATTRIBUTE_HIDDEN)
#define FILE_ATTRIBUTE_SYSTEM_LE cpu_to_le32(FILE_ATTRIBUTE_SYSTEM)
#define FILE_ATTRIBUTE_DIRECTORY_LE cpu_to_le32(FILE_ATTRIBUTE_DIRECTORY)
#define FILE_ATTRIBUTE_ARCHIVE_LE cpu_to_le32(FILE_ATTRIBUTE_ARCHIVE)
#define FILE_ATTRIBUTE_NORMAL_LE cpu_to_le32(FILE_ATTRIBUTE_NORMAL)
#define FILE_ATTRIBUTE_TEMPORARY_LE cpu_to_le32(FILE_ATTRIBUTE_TEMPORARY)
#define FILE_ATTRIBUTE_SPARSE_FILE_LE cpu_to_le32(FILE_ATTRIBUTE_SPARSE_FILE)
#define FILE_ATTRIBUTE_REPARSE_POINT_LE cpu_to_le32(FILE_ATTRIBUTE_REPARSE_POINT)
#define FILE_ATTRIBUTE_COMPRESSED_LE cpu_to_le32(FILE_ATTRIBUTE_COMPRESSED)
#define FILE_ATTRIBUTE_OFFLINE_LE cpu_to_le32(FILE_ATTRIBUTE_OFFLINE)
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED_LE cpu_to_le32(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)
#define FILE_ATTRIBUTE_ENCRYPTED_LE cpu_to_le32(FILE_ATTRIBUTE_ENCRYPTED)
#define FILE_ATTRIBUTE_INTEGRITY_STREAM_LE cpu_to_le32(FILE_ATTRIBUTE_INTEGRITY_STREAM)
#define FILE_ATTRIBUTE_NO_SCRUB_DATA_LE cpu_to_le32(FILE_ATTRIBUTE_NO_SCRUB_DATA)
#define FILE_ATTRIBUTE_MASK_LE cpu_to_le32(FILE_ATTRIBUTE_MASK)
/*
* Response contains array of the following structures
* See MS-FSCC 2.7.1
*/
struct file_notify_information {
__le32 NextEntryOffset;
__le32 Action;
__le32 FileNameLength;
__u8 FileName[];
} __packed;
/*
* See POSIX Extensions to MS-FSCC 2.3.2.1
* Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/fscc_posix_extensions.md

View File

@ -991,6 +991,7 @@ struct smb2_set_info_rsp {
/* notify completion filter flags. See MS-FSCC 2.6 and MS-SMB2 2.2.35 */
#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
#define FILE_NOTIFY_CHANGE_NAME 0x00000003
#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
@ -1002,7 +1003,10 @@ struct smb2_set_info_rsp {
#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
/* SMB2 Notify Action Flags */
/*
* SMB2 Notify Action Flags
* See MS-FSCC 2.7.1
*/
#define FILE_ACTION_ADDED 0x00000001
#define FILE_ACTION_REMOVED 0x00000002
#define FILE_ACTION_MODIFIED 0x00000003
@ -1012,7 +1016,10 @@ struct smb2_set_info_rsp {
#define FILE_ACTION_REMOVED_STREAM 0x00000007
#define FILE_ACTION_MODIFIED_STREAM 0x00000008
#define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
#define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
#define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
/* See MS-SMB2 2.2.35 */
struct smb2_change_notify_req {
struct smb2_hdr hdr;
__le16 StructureSize;
@ -1024,6 +1031,7 @@ struct smb2_change_notify_req {
__u32 Reserved;
} __packed;
/* See MS-SMB2 2.2.36 */
struct smb2_change_notify_rsp {
struct smb2_hdr hdr;
__le16 StructureSize; /* Must be 9 */
@ -1064,41 +1072,6 @@ struct smb2_server_client_notification {
#define IL_IMPERSONATION cpu_to_le32(0x00000002)
#define IL_DELEGATE cpu_to_le32(0x00000003)
/* File Attributes */
#define FILE_ATTRIBUTE_READONLY 0x00000001
#define FILE_ATTRIBUTE_HIDDEN 0x00000002
#define FILE_ATTRIBUTE_SYSTEM 0x00000004
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
#define FILE_ATTRIBUTE_OFFLINE 0x00001000
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
#define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000
#define FILE_ATTRIBUTE_NO_SCRUB_DATA 0x00020000
#define FILE_ATTRIBUTE__MASK 0x00007FB7
#define FILE_ATTRIBUTE_READONLY_LE cpu_to_le32(0x00000001)
#define FILE_ATTRIBUTE_HIDDEN_LE cpu_to_le32(0x00000002)
#define FILE_ATTRIBUTE_SYSTEM_LE cpu_to_le32(0x00000004)
#define FILE_ATTRIBUTE_DIRECTORY_LE cpu_to_le32(0x00000010)
#define FILE_ATTRIBUTE_ARCHIVE_LE cpu_to_le32(0x00000020)
#define FILE_ATTRIBUTE_NORMAL_LE cpu_to_le32(0x00000080)
#define FILE_ATTRIBUTE_TEMPORARY_LE cpu_to_le32(0x00000100)
#define FILE_ATTRIBUTE_SPARSE_FILE_LE cpu_to_le32(0x00000200)
#define FILE_ATTRIBUTE_REPARSE_POINT_LE cpu_to_le32(0x00000400)
#define FILE_ATTRIBUTE_COMPRESSED_LE cpu_to_le32(0x00000800)
#define FILE_ATTRIBUTE_OFFLINE_LE cpu_to_le32(0x00001000)
#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED_LE cpu_to_le32(0x00002000)
#define FILE_ATTRIBUTE_ENCRYPTED_LE cpu_to_le32(0x00004000)
#define FILE_ATTRIBUTE_INTEGRITY_STREAM_LE cpu_to_le32(0x00008000)
#define FILE_ATTRIBUTE_NO_SCRUB_DATA_LE cpu_to_le32(0x00020000)
#define FILE_ATTRIBUTE_MASK_LE cpu_to_le32(0x00007FB7)
/* Desired Access Flags */
#define FILE_READ_DATA_LE cpu_to_le32(0x00000001)
#define FILE_LIST_DIRECTORY_LE cpu_to_le32(0x00000001)
@ -1537,9 +1510,10 @@ struct duplicate_extents_to_file {
__le64 ByteCount; /* Bytes to be copied */
} __packed;
/* See MS-FSCC 2.3.8 */
/* See MS-FSCC 2.3.9 */
#define DUPLICATE_EXTENTS_DATA_EX_SOURCE_ATOMIC 0x00000001
struct duplicate_extents_to_file_ex {
__le64 StructureSize; /* MUST be set to 0x30 */
__u64 PersistentFileHandle; /* source file handle, opaque endianness */
__u64 VolatileFileHandle;
__le64 SourceFileOffset;

View File

@ -1,543 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Unix SMB/Netbios implementation.
* Version 1.9.
* NT error code constants
* Copyright (C) Andrew Tridgell 1992-2000
* Copyright (C) John H Terpstra 1996-2000
* Copyright (C) Luke Kenneth Casson Leighton 1996-2000
* Copyright (C) Paul Ashton 1998-2000
*/
#ifndef _NTERR_H
#define _NTERR_H
/* Win32 Status codes. */
#define NT_STATUS_MORE_ENTRIES 0x0105
#define NT_ERROR_INVALID_PARAMETER 0x0057
#define NT_ERROR_INSUFFICIENT_BUFFER 0x007a
#define NT_STATUS_1804 0x070c
#define NT_STATUS_NOTIFY_ENUM_DIR 0x010c
#define NT_STATUS_INVALID_LOCK_RANGE (0xC0000000 | 0x01a1)
/*
* Win32 Error codes extracted using a loop in smbclient then printing a netmon
* sniff to a file.
*/
#define NT_STATUS_OK 0x0000
#define NT_STATUS_SOME_UNMAPPED 0x0107
#define NT_STATUS_BUFFER_OVERFLOW 0x80000005
#define NT_STATUS_NO_MORE_ENTRIES 0x8000001a
#define NT_STATUS_MEDIA_CHANGED 0x8000001c
#define NT_STATUS_END_OF_MEDIA 0x8000001e
#define NT_STATUS_MEDIA_CHECK 0x80000020
#define NT_STATUS_NO_DATA_DETECTED 0x8000001c
#define NT_STATUS_STOPPED_ON_SYMLINK 0x8000002d
#define NT_STATUS_DEVICE_REQUIRES_CLEANING 0x80000288
#define NT_STATUS_DEVICE_DOOR_OPEN 0x80000288
#define NT_STATUS_UNSUCCESSFUL (0xC0000000 | 0x0001)
#define NT_STATUS_NOT_IMPLEMENTED (0xC0000000 | 0x0002)
#define NT_STATUS_INVALID_INFO_CLASS (0xC0000000 | 0x0003)
#define NT_STATUS_INFO_LENGTH_MISMATCH (0xC0000000 | 0x0004)
#define NT_STATUS_ACCESS_VIOLATION (0xC0000000 | 0x0005)
#define NT_STATUS_IN_PAGE_ERROR (0xC0000000 | 0x0006)
#define NT_STATUS_PAGEFILE_QUOTA (0xC0000000 | 0x0007)
#define NT_STATUS_INVALID_HANDLE (0xC0000000 | 0x0008)
#define NT_STATUS_BAD_INITIAL_STACK (0xC0000000 | 0x0009)
#define NT_STATUS_BAD_INITIAL_PC (0xC0000000 | 0x000a)
#define NT_STATUS_INVALID_CID (0xC0000000 | 0x000b)
#define NT_STATUS_TIMER_NOT_CANCELED (0xC0000000 | 0x000c)
#define NT_STATUS_INVALID_PARAMETER (0xC0000000 | 0x000d)
#define NT_STATUS_NO_SUCH_DEVICE (0xC0000000 | 0x000e)
#define NT_STATUS_NO_SUCH_FILE (0xC0000000 | 0x000f)
#define NT_STATUS_INVALID_DEVICE_REQUEST (0xC0000000 | 0x0010)
#define NT_STATUS_END_OF_FILE (0xC0000000 | 0x0011)
#define NT_STATUS_WRONG_VOLUME (0xC0000000 | 0x0012)
#define NT_STATUS_NO_MEDIA_IN_DEVICE (0xC0000000 | 0x0013)
#define NT_STATUS_UNRECOGNIZED_MEDIA (0xC0000000 | 0x0014)
#define NT_STATUS_NONEXISTENT_SECTOR (0xC0000000 | 0x0015)
#define NT_STATUS_MORE_PROCESSING_REQUIRED (0xC0000000 | 0x0016)
#define NT_STATUS_NO_MEMORY (0xC0000000 | 0x0017)
#define NT_STATUS_CONFLICTING_ADDRESSES (0xC0000000 | 0x0018)
#define NT_STATUS_NOT_MAPPED_VIEW (0xC0000000 | 0x0019)
#define NT_STATUS_UNABLE_TO_FREE_VM (0x80000000 | 0x001a)
#define NT_STATUS_UNABLE_TO_DELETE_SECTION (0xC0000000 | 0x001b)
#define NT_STATUS_INVALID_SYSTEM_SERVICE (0xC0000000 | 0x001c)
#define NT_STATUS_ILLEGAL_INSTRUCTION (0xC0000000 | 0x001d)
#define NT_STATUS_INVALID_LOCK_SEQUENCE (0xC0000000 | 0x001e)
#define NT_STATUS_INVALID_VIEW_SIZE (0xC0000000 | 0x001f)
#define NT_STATUS_INVALID_FILE_FOR_SECTION (0xC0000000 | 0x0020)
#define NT_STATUS_ALREADY_COMMITTED (0xC0000000 | 0x0021)
#define NT_STATUS_ACCESS_DENIED (0xC0000000 | 0x0022)
#define NT_STATUS_BUFFER_TOO_SMALL (0xC0000000 | 0x0023)
#define NT_STATUS_OBJECT_TYPE_MISMATCH (0xC0000000 | 0x0024)
#define NT_STATUS_NONCONTINUABLE_EXCEPTION (0xC0000000 | 0x0025)
#define NT_STATUS_INVALID_DISPOSITION (0xC0000000 | 0x0026)
#define NT_STATUS_UNWIND (0xC0000000 | 0x0027)
#define NT_STATUS_BAD_STACK (0xC0000000 | 0x0028)
#define NT_STATUS_INVALID_UNWIND_TARGET (0xC0000000 | 0x0029)
#define NT_STATUS_NOT_LOCKED (0xC0000000 | 0x002a)
#define NT_STATUS_PARITY_ERROR (0xC0000000 | 0x002b)
#define NT_STATUS_UNABLE_TO_DECOMMIT_VM (0xC0000000 | 0x002c)
#define NT_STATUS_NOT_COMMITTED (0xC0000000 | 0x002d)
#define NT_STATUS_INVALID_PORT_ATTRIBUTES (0xC0000000 | 0x002e)
#define NT_STATUS_PORT_MESSAGE_TOO_LONG (0xC0000000 | 0x002f)
#define NT_STATUS_INVALID_PARAMETER_MIX (0xC0000000 | 0x0030)
#define NT_STATUS_INVALID_QUOTA_LOWER (0xC0000000 | 0x0031)
#define NT_STATUS_DISK_CORRUPT_ERROR (0xC0000000 | 0x0032)
#define NT_STATUS_OBJECT_NAME_INVALID (0xC0000000 | 0x0033)
#define NT_STATUS_OBJECT_NAME_NOT_FOUND (0xC0000000 | 0x0034)
#define NT_STATUS_OBJECT_NAME_COLLISION (0xC0000000 | 0x0035)
#define NT_STATUS_HANDLE_NOT_WAITABLE (0xC0000000 | 0x0036)
#define NT_STATUS_PORT_DISCONNECTED (0xC0000000 | 0x0037)
#define NT_STATUS_DEVICE_ALREADY_ATTACHED (0xC0000000 | 0x0038)
#define NT_STATUS_OBJECT_PATH_INVALID (0xC0000000 | 0x0039)
#define NT_STATUS_OBJECT_PATH_NOT_FOUND (0xC0000000 | 0x003a)
#define NT_STATUS_OBJECT_PATH_SYNTAX_BAD (0xC0000000 | 0x003b)
#define NT_STATUS_DATA_OVERRUN (0xC0000000 | 0x003c)
#define NT_STATUS_DATA_LATE_ERROR (0xC0000000 | 0x003d)
#define NT_STATUS_DATA_ERROR (0xC0000000 | 0x003e)
#define NT_STATUS_CRC_ERROR (0xC0000000 | 0x003f)
#define NT_STATUS_SECTION_TOO_BIG (0xC0000000 | 0x0040)
#define NT_STATUS_PORT_CONNECTION_REFUSED (0xC0000000 | 0x0041)
#define NT_STATUS_INVALID_PORT_HANDLE (0xC0000000 | 0x0042)
#define NT_STATUS_SHARING_VIOLATION (0xC0000000 | 0x0043)
#define NT_STATUS_QUOTA_EXCEEDED (0xC0000000 | 0x0044)
#define NT_STATUS_INVALID_PAGE_PROTECTION (0xC0000000 | 0x0045)
#define NT_STATUS_MUTANT_NOT_OWNED (0xC0000000 | 0x0046)
#define NT_STATUS_SEMAPHORE_LIMIT_EXCEEDED (0xC0000000 | 0x0047)
#define NT_STATUS_PORT_ALREADY_SET (0xC0000000 | 0x0048)
#define NT_STATUS_SECTION_NOT_IMAGE (0xC0000000 | 0x0049)
#define NT_STATUS_SUSPEND_COUNT_EXCEEDED (0xC0000000 | 0x004a)
#define NT_STATUS_THREAD_IS_TERMINATING (0xC0000000 | 0x004b)
#define NT_STATUS_BAD_WORKING_SET_LIMIT (0xC0000000 | 0x004c)
#define NT_STATUS_INCOMPATIBLE_FILE_MAP (0xC0000000 | 0x004d)
#define NT_STATUS_SECTION_PROTECTION (0xC0000000 | 0x004e)
#define NT_STATUS_EAS_NOT_SUPPORTED (0xC0000000 | 0x004f)
#define NT_STATUS_EA_TOO_LARGE (0xC0000000 | 0x0050)
#define NT_STATUS_NONEXISTENT_EA_ENTRY (0xC0000000 | 0x0051)
#define NT_STATUS_NO_EAS_ON_FILE (0xC0000000 | 0x0052)
#define NT_STATUS_EA_CORRUPT_ERROR (0xC0000000 | 0x0053)
#define NT_STATUS_FILE_LOCK_CONFLICT (0xC0000000 | 0x0054)
#define NT_STATUS_LOCK_NOT_GRANTED (0xC0000000 | 0x0055)
#define NT_STATUS_DELETE_PENDING (0xC0000000 | 0x0056)
#define NT_STATUS_CTL_FILE_NOT_SUPPORTED (0xC0000000 | 0x0057)
#define NT_STATUS_UNKNOWN_REVISION (0xC0000000 | 0x0058)
#define NT_STATUS_REVISION_MISMATCH (0xC0000000 | 0x0059)
#define NT_STATUS_INVALID_OWNER (0xC0000000 | 0x005a)
#define NT_STATUS_INVALID_PRIMARY_GROUP (0xC0000000 | 0x005b)
#define NT_STATUS_NO_IMPERSONATION_TOKEN (0xC0000000 | 0x005c)
#define NT_STATUS_CANT_DISABLE_MANDATORY (0xC0000000 | 0x005d)
#define NT_STATUS_NO_LOGON_SERVERS (0xC0000000 | 0x005e)
#define NT_STATUS_NO_SUCH_LOGON_SESSION (0xC0000000 | 0x005f)
#define NT_STATUS_NO_SUCH_PRIVILEGE (0xC0000000 | 0x0060)
#define NT_STATUS_PRIVILEGE_NOT_HELD (0xC0000000 | 0x0061)
#define NT_STATUS_INVALID_ACCOUNT_NAME (0xC0000000 | 0x0062)
#define NT_STATUS_USER_EXISTS (0xC0000000 | 0x0063)
#define NT_STATUS_NO_SUCH_USER (0xC0000000 | 0x0064)
#define NT_STATUS_GROUP_EXISTS (0xC0000000 | 0x0065)
#define NT_STATUS_NO_SUCH_GROUP (0xC0000000 | 0x0066)
#define NT_STATUS_MEMBER_IN_GROUP (0xC0000000 | 0x0067)
#define NT_STATUS_MEMBER_NOT_IN_GROUP (0xC0000000 | 0x0068)
#define NT_STATUS_LAST_ADMIN (0xC0000000 | 0x0069)
#define NT_STATUS_WRONG_PASSWORD (0xC0000000 | 0x006a)
#define NT_STATUS_ILL_FORMED_PASSWORD (0xC0000000 | 0x006b)
#define NT_STATUS_PASSWORD_RESTRICTION (0xC0000000 | 0x006c)
#define NT_STATUS_LOGON_FAILURE (0xC0000000 | 0x006d)
#define NT_STATUS_ACCOUNT_RESTRICTION (0xC0000000 | 0x006e)
#define NT_STATUS_INVALID_LOGON_HOURS (0xC0000000 | 0x006f)
#define NT_STATUS_INVALID_WORKSTATION (0xC0000000 | 0x0070)
#define NT_STATUS_PASSWORD_EXPIRED (0xC0000000 | 0x0071)
#define NT_STATUS_ACCOUNT_DISABLED (0xC0000000 | 0x0072)
#define NT_STATUS_NONE_MAPPED (0xC0000000 | 0x0073)
#define NT_STATUS_TOO_MANY_LUIDS_REQUESTED (0xC0000000 | 0x0074)
#define NT_STATUS_LUIDS_EXHAUSTED (0xC0000000 | 0x0075)
#define NT_STATUS_INVALID_SUB_AUTHORITY (0xC0000000 | 0x0076)
#define NT_STATUS_INVALID_ACL (0xC0000000 | 0x0077)
#define NT_STATUS_INVALID_SID (0xC0000000 | 0x0078)
#define NT_STATUS_INVALID_SECURITY_DESCR (0xC0000000 | 0x0079)
#define NT_STATUS_PROCEDURE_NOT_FOUND (0xC0000000 | 0x007a)
#define NT_STATUS_INVALID_IMAGE_FORMAT (0xC0000000 | 0x007b)
#define NT_STATUS_NO_TOKEN (0xC0000000 | 0x007c)
#define NT_STATUS_BAD_INHERITANCE_ACL (0xC0000000 | 0x007d)
#define NT_STATUS_RANGE_NOT_LOCKED (0xC0000000 | 0x007e)
#define NT_STATUS_DISK_FULL (0xC0000000 | 0x007f)
#define NT_STATUS_SERVER_DISABLED (0xC0000000 | 0x0080)
#define NT_STATUS_SERVER_NOT_DISABLED (0xC0000000 | 0x0081)
#define NT_STATUS_TOO_MANY_GUIDS_REQUESTED (0xC0000000 | 0x0082)
#define NT_STATUS_GUIDS_EXHAUSTED (0xC0000000 | 0x0083)
#define NT_STATUS_INVALID_ID_AUTHORITY (0xC0000000 | 0x0084)
#define NT_STATUS_AGENTS_EXHAUSTED (0xC0000000 | 0x0085)
#define NT_STATUS_INVALID_VOLUME_LABEL (0xC0000000 | 0x0086)
#define NT_STATUS_SECTION_NOT_EXTENDED (0xC0000000 | 0x0087)
#define NT_STATUS_NOT_MAPPED_DATA (0xC0000000 | 0x0088)
#define NT_STATUS_RESOURCE_DATA_NOT_FOUND (0xC0000000 | 0x0089)
#define NT_STATUS_RESOURCE_TYPE_NOT_FOUND (0xC0000000 | 0x008a)
#define NT_STATUS_RESOURCE_NAME_NOT_FOUND (0xC0000000 | 0x008b)
#define NT_STATUS_ARRAY_BOUNDS_EXCEEDED (0xC0000000 | 0x008c)
#define NT_STATUS_FLOAT_DENORMAL_OPERAND (0xC0000000 | 0x008d)
#define NT_STATUS_FLOAT_DIVIDE_BY_ZERO (0xC0000000 | 0x008e)
#define NT_STATUS_FLOAT_INEXACT_RESULT (0xC0000000 | 0x008f)
#define NT_STATUS_FLOAT_INVALID_OPERATION (0xC0000000 | 0x0090)
#define NT_STATUS_FLOAT_OVERFLOW (0xC0000000 | 0x0091)
#define NT_STATUS_FLOAT_STACK_CHECK (0xC0000000 | 0x0092)
#define NT_STATUS_FLOAT_UNDERFLOW (0xC0000000 | 0x0093)
#define NT_STATUS_INTEGER_DIVIDE_BY_ZERO (0xC0000000 | 0x0094)
#define NT_STATUS_INTEGER_OVERFLOW (0xC0000000 | 0x0095)
#define NT_STATUS_PRIVILEGED_INSTRUCTION (0xC0000000 | 0x0096)
#define NT_STATUS_TOO_MANY_PAGING_FILES (0xC0000000 | 0x0097)
#define NT_STATUS_FILE_INVALID (0xC0000000 | 0x0098)
#define NT_STATUS_ALLOTTED_SPACE_EXCEEDED (0xC0000000 | 0x0099)
#define NT_STATUS_INSUFFICIENT_RESOURCES (0xC0000000 | 0x009a)
#define NT_STATUS_DFS_EXIT_PATH_FOUND (0xC0000000 | 0x009b)
#define NT_STATUS_DEVICE_DATA_ERROR (0xC0000000 | 0x009c)
#define NT_STATUS_DEVICE_NOT_CONNECTED (0xC0000000 | 0x009d)
#define NT_STATUS_DEVICE_POWER_FAILURE (0xC0000000 | 0x009e)
#define NT_STATUS_FREE_VM_NOT_AT_BASE (0xC0000000 | 0x009f)
#define NT_STATUS_MEMORY_NOT_ALLOCATED (0xC0000000 | 0x00a0)
#define NT_STATUS_WORKING_SET_QUOTA (0xC0000000 | 0x00a1)
#define NT_STATUS_MEDIA_WRITE_PROTECTED (0xC0000000 | 0x00a2)
#define NT_STATUS_DEVICE_NOT_READY (0xC0000000 | 0x00a3)
#define NT_STATUS_INVALID_GROUP_ATTRIBUTES (0xC0000000 | 0x00a4)
#define NT_STATUS_BAD_IMPERSONATION_LEVEL (0xC0000000 | 0x00a5)
#define NT_STATUS_CANT_OPEN_ANONYMOUS (0xC0000000 | 0x00a6)
#define NT_STATUS_BAD_VALIDATION_CLASS (0xC0000000 | 0x00a7)
#define NT_STATUS_BAD_TOKEN_TYPE (0xC0000000 | 0x00a8)
#define NT_STATUS_BAD_MASTER_BOOT_RECORD (0xC0000000 | 0x00a9)
#define NT_STATUS_INSTRUCTION_MISALIGNMENT (0xC0000000 | 0x00aa)
#define NT_STATUS_INSTANCE_NOT_AVAILABLE (0xC0000000 | 0x00ab)
#define NT_STATUS_PIPE_NOT_AVAILABLE (0xC0000000 | 0x00ac)
#define NT_STATUS_INVALID_PIPE_STATE (0xC0000000 | 0x00ad)
#define NT_STATUS_PIPE_BUSY (0xC0000000 | 0x00ae)
#define NT_STATUS_ILLEGAL_FUNCTION (0xC0000000 | 0x00af)
#define NT_STATUS_PIPE_DISCONNECTED (0xC0000000 | 0x00b0)
#define NT_STATUS_PIPE_CLOSING (0xC0000000 | 0x00b1)
#define NT_STATUS_PIPE_CONNECTED (0xC0000000 | 0x00b2)
#define NT_STATUS_PIPE_LISTENING (0xC0000000 | 0x00b3)
#define NT_STATUS_INVALID_READ_MODE (0xC0000000 | 0x00b4)
#define NT_STATUS_IO_TIMEOUT (0xC0000000 | 0x00b5)
#define NT_STATUS_FILE_FORCED_CLOSED (0xC0000000 | 0x00b6)
#define NT_STATUS_PROFILING_NOT_STARTED (0xC0000000 | 0x00b7)
#define NT_STATUS_PROFILING_NOT_STOPPED (0xC0000000 | 0x00b8)
#define NT_STATUS_COULD_NOT_INTERPRET (0xC0000000 | 0x00b9)
#define NT_STATUS_FILE_IS_A_DIRECTORY (0xC0000000 | 0x00ba)
#define NT_STATUS_NOT_SUPPORTED (0xC0000000 | 0x00bb)
#define NT_STATUS_REMOTE_NOT_LISTENING (0xC0000000 | 0x00bc)
#define NT_STATUS_DUPLICATE_NAME (0xC0000000 | 0x00bd)
#define NT_STATUS_BAD_NETWORK_PATH (0xC0000000 | 0x00be)
#define NT_STATUS_NETWORK_BUSY (0xC0000000 | 0x00bf)
#define NT_STATUS_DEVICE_DOES_NOT_EXIST (0xC0000000 | 0x00c0)
#define NT_STATUS_TOO_MANY_COMMANDS (0xC0000000 | 0x00c1)
#define NT_STATUS_ADAPTER_HARDWARE_ERROR (0xC0000000 | 0x00c2)
#define NT_STATUS_INVALID_NETWORK_RESPONSE (0xC0000000 | 0x00c3)
#define NT_STATUS_UNEXPECTED_NETWORK_ERROR (0xC0000000 | 0x00c4)
#define NT_STATUS_BAD_REMOTE_ADAPTER (0xC0000000 | 0x00c5)
#define NT_STATUS_PRINT_QUEUE_FULL (0xC0000000 | 0x00c6)
#define NT_STATUS_NO_SPOOL_SPACE (0xC0000000 | 0x00c7)
#define NT_STATUS_PRINT_CANCELLED (0xC0000000 | 0x00c8)
#define NT_STATUS_NETWORK_NAME_DELETED (0xC0000000 | 0x00c9)
#define NT_STATUS_NETWORK_ACCESS_DENIED (0xC0000000 | 0x00ca)
#define NT_STATUS_BAD_DEVICE_TYPE (0xC0000000 | 0x00cb)
#define NT_STATUS_BAD_NETWORK_NAME (0xC0000000 | 0x00cc)
#define NT_STATUS_TOO_MANY_NAMES (0xC0000000 | 0x00cd)
#define NT_STATUS_TOO_MANY_SESSIONS (0xC0000000 | 0x00ce)
#define NT_STATUS_SHARING_PAUSED (0xC0000000 | 0x00cf)
#define NT_STATUS_REQUEST_NOT_ACCEPTED (0xC0000000 | 0x00d0)
#define NT_STATUS_REDIRECTOR_PAUSED (0xC0000000 | 0x00d1)
#define NT_STATUS_NET_WRITE_FAULT (0xC0000000 | 0x00d2)
#define NT_STATUS_PROFILING_AT_LIMIT (0xC0000000 | 0x00d3)
#define NT_STATUS_NOT_SAME_DEVICE (0xC0000000 | 0x00d4)
#define NT_STATUS_FILE_RENAMED (0xC0000000 | 0x00d5)
#define NT_STATUS_VIRTUAL_CIRCUIT_CLOSED (0xC0000000 | 0x00d6)
#define NT_STATUS_NO_SECURITY_ON_OBJECT (0xC0000000 | 0x00d7)
#define NT_STATUS_CANT_WAIT (0xC0000000 | 0x00d8)
#define NT_STATUS_PIPE_EMPTY (0xC0000000 | 0x00d9)
#define NT_STATUS_CANT_ACCESS_DOMAIN_INFO (0xC0000000 | 0x00da)
#define NT_STATUS_CANT_TERMINATE_SELF (0xC0000000 | 0x00db)
#define NT_STATUS_INVALID_SERVER_STATE (0xC0000000 | 0x00dc)
#define NT_STATUS_INVALID_DOMAIN_STATE (0xC0000000 | 0x00dd)
#define NT_STATUS_INVALID_DOMAIN_ROLE (0xC0000000 | 0x00de)
#define NT_STATUS_NO_SUCH_DOMAIN (0xC0000000 | 0x00df)
#define NT_STATUS_DOMAIN_EXISTS (0xC0000000 | 0x00e0)
#define NT_STATUS_DOMAIN_LIMIT_EXCEEDED (0xC0000000 | 0x00e1)
#define NT_STATUS_OPLOCK_NOT_GRANTED (0xC0000000 | 0x00e2)
#define NT_STATUS_INVALID_OPLOCK_PROTOCOL (0xC0000000 | 0x00e3)
#define NT_STATUS_INTERNAL_DB_CORRUPTION (0xC0000000 | 0x00e4)
#define NT_STATUS_INTERNAL_ERROR (0xC0000000 | 0x00e5)
#define NT_STATUS_GENERIC_NOT_MAPPED (0xC0000000 | 0x00e6)
#define NT_STATUS_BAD_DESCRIPTOR_FORMAT (0xC0000000 | 0x00e7)
#define NT_STATUS_INVALID_USER_BUFFER (0xC0000000 | 0x00e8)
#define NT_STATUS_UNEXPECTED_IO_ERROR (0xC0000000 | 0x00e9)
#define NT_STATUS_UNEXPECTED_MM_CREATE_ERR (0xC0000000 | 0x00ea)
#define NT_STATUS_UNEXPECTED_MM_MAP_ERROR (0xC0000000 | 0x00eb)
#define NT_STATUS_UNEXPECTED_MM_EXTEND_ERR (0xC0000000 | 0x00ec)
#define NT_STATUS_NOT_LOGON_PROCESS (0xC0000000 | 0x00ed)
#define NT_STATUS_LOGON_SESSION_EXISTS (0xC0000000 | 0x00ee)
#define NT_STATUS_INVALID_PARAMETER_1 (0xC0000000 | 0x00ef)
#define NT_STATUS_INVALID_PARAMETER_2 (0xC0000000 | 0x00f0)
#define NT_STATUS_INVALID_PARAMETER_3 (0xC0000000 | 0x00f1)
#define NT_STATUS_INVALID_PARAMETER_4 (0xC0000000 | 0x00f2)
#define NT_STATUS_INVALID_PARAMETER_5 (0xC0000000 | 0x00f3)
#define NT_STATUS_INVALID_PARAMETER_6 (0xC0000000 | 0x00f4)
#define NT_STATUS_INVALID_PARAMETER_7 (0xC0000000 | 0x00f5)
#define NT_STATUS_INVALID_PARAMETER_8 (0xC0000000 | 0x00f6)
#define NT_STATUS_INVALID_PARAMETER_9 (0xC0000000 | 0x00f7)
#define NT_STATUS_INVALID_PARAMETER_10 (0xC0000000 | 0x00f8)
#define NT_STATUS_INVALID_PARAMETER_11 (0xC0000000 | 0x00f9)
#define NT_STATUS_INVALID_PARAMETER_12 (0xC0000000 | 0x00fa)
#define NT_STATUS_REDIRECTOR_NOT_STARTED (0xC0000000 | 0x00fb)
#define NT_STATUS_REDIRECTOR_STARTED (0xC0000000 | 0x00fc)
#define NT_STATUS_STACK_OVERFLOW (0xC0000000 | 0x00fd)
#define NT_STATUS_NO_SUCH_PACKAGE (0xC0000000 | 0x00fe)
#define NT_STATUS_BAD_FUNCTION_TABLE (0xC0000000 | 0x00ff)
#define NT_STATUS_DIRECTORY_NOT_EMPTY (0xC0000000 | 0x0101)
#define NT_STATUS_FILE_CORRUPT_ERROR (0xC0000000 | 0x0102)
#define NT_STATUS_NOT_A_DIRECTORY (0xC0000000 | 0x0103)
#define NT_STATUS_BAD_LOGON_SESSION_STATE (0xC0000000 | 0x0104)
#define NT_STATUS_LOGON_SESSION_COLLISION (0xC0000000 | 0x0105)
#define NT_STATUS_NAME_TOO_LONG (0xC0000000 | 0x0106)
#define NT_STATUS_FILES_OPEN (0xC0000000 | 0x0107)
#define NT_STATUS_CONNECTION_IN_USE (0xC0000000 | 0x0108)
#define NT_STATUS_MESSAGE_NOT_FOUND (0xC0000000 | 0x0109)
#define NT_STATUS_PROCESS_IS_TERMINATING (0xC0000000 | 0x010a)
#define NT_STATUS_INVALID_LOGON_TYPE (0xC0000000 | 0x010b)
#define NT_STATUS_NO_GUID_TRANSLATION (0xC0000000 | 0x010c)
#define NT_STATUS_CANNOT_IMPERSONATE (0xC0000000 | 0x010d)
#define NT_STATUS_IMAGE_ALREADY_LOADED (0xC0000000 | 0x010e)
#define NT_STATUS_ABIOS_NOT_PRESENT (0xC0000000 | 0x010f)
#define NT_STATUS_ABIOS_LID_NOT_EXIST (0xC0000000 | 0x0110)
#define NT_STATUS_ABIOS_LID_ALREADY_OWNED (0xC0000000 | 0x0111)
#define NT_STATUS_ABIOS_NOT_LID_OWNER (0xC0000000 | 0x0112)
#define NT_STATUS_ABIOS_INVALID_COMMAND (0xC0000000 | 0x0113)
#define NT_STATUS_ABIOS_INVALID_LID (0xC0000000 | 0x0114)
#define NT_STATUS_ABIOS_SELECTOR_NOT_AVAILABLE (0xC0000000 | 0x0115)
#define NT_STATUS_ABIOS_INVALID_SELECTOR (0xC0000000 | 0x0116)
#define NT_STATUS_NO_LDT (0xC0000000 | 0x0117)
#define NT_STATUS_INVALID_LDT_SIZE (0xC0000000 | 0x0118)
#define NT_STATUS_INVALID_LDT_OFFSET (0xC0000000 | 0x0119)
#define NT_STATUS_INVALID_LDT_DESCRIPTOR (0xC0000000 | 0x011a)
#define NT_STATUS_INVALID_IMAGE_NE_FORMAT (0xC0000000 | 0x011b)
#define NT_STATUS_RXACT_INVALID_STATE (0xC0000000 | 0x011c)
#define NT_STATUS_RXACT_COMMIT_FAILURE (0xC0000000 | 0x011d)
#define NT_STATUS_MAPPED_FILE_SIZE_ZERO (0xC0000000 | 0x011e)
#define NT_STATUS_TOO_MANY_OPENED_FILES (0xC0000000 | 0x011f)
#define NT_STATUS_CANCELLED (0xC0000000 | 0x0120)
#define NT_STATUS_CANNOT_DELETE (0xC0000000 | 0x0121)
#define NT_STATUS_INVALID_COMPUTER_NAME (0xC0000000 | 0x0122)
#define NT_STATUS_FILE_DELETED (0xC0000000 | 0x0123)
#define NT_STATUS_SPECIAL_ACCOUNT (0xC0000000 | 0x0124)
#define NT_STATUS_SPECIAL_GROUP (0xC0000000 | 0x0125)
#define NT_STATUS_SPECIAL_USER (0xC0000000 | 0x0126)
#define NT_STATUS_MEMBERS_PRIMARY_GROUP (0xC0000000 | 0x0127)
#define NT_STATUS_FILE_CLOSED (0xC0000000 | 0x0128)
#define NT_STATUS_TOO_MANY_THREADS (0xC0000000 | 0x0129)
#define NT_STATUS_THREAD_NOT_IN_PROCESS (0xC0000000 | 0x012a)
#define NT_STATUS_TOKEN_ALREADY_IN_USE (0xC0000000 | 0x012b)
#define NT_STATUS_PAGEFILE_QUOTA_EXCEEDED (0xC0000000 | 0x012c)
#define NT_STATUS_COMMITMENT_LIMIT (0xC0000000 | 0x012d)
#define NT_STATUS_INVALID_IMAGE_LE_FORMAT (0xC0000000 | 0x012e)
#define NT_STATUS_INVALID_IMAGE_NOT_MZ (0xC0000000 | 0x012f)
#define NT_STATUS_INVALID_IMAGE_PROTECT (0xC0000000 | 0x0130)
#define NT_STATUS_INVALID_IMAGE_WIN_16 (0xC0000000 | 0x0131)
#define NT_STATUS_LOGON_SERVER_CONFLICT (0xC0000000 | 0x0132)
#define NT_STATUS_TIME_DIFFERENCE_AT_DC (0xC0000000 | 0x0133)
#define NT_STATUS_SYNCHRONIZATION_REQUIRED (0xC0000000 | 0x0134)
#define NT_STATUS_DLL_NOT_FOUND (0xC0000000 | 0x0135)
#define NT_STATUS_OPEN_FAILED (0xC0000000 | 0x0136)
#define NT_STATUS_IO_PRIVILEGE_FAILED (0xC0000000 | 0x0137)
#define NT_STATUS_ORDINAL_NOT_FOUND (0xC0000000 | 0x0138)
#define NT_STATUS_ENTRYPOINT_NOT_FOUND (0xC0000000 | 0x0139)
#define NT_STATUS_CONTROL_C_EXIT (0xC0000000 | 0x013a)
#define NT_STATUS_LOCAL_DISCONNECT (0xC0000000 | 0x013b)
#define NT_STATUS_REMOTE_DISCONNECT (0xC0000000 | 0x013c)
#define NT_STATUS_REMOTE_RESOURCES (0xC0000000 | 0x013d)
#define NT_STATUS_LINK_FAILED (0xC0000000 | 0x013e)
#define NT_STATUS_LINK_TIMEOUT (0xC0000000 | 0x013f)
#define NT_STATUS_INVALID_CONNECTION (0xC0000000 | 0x0140)
#define NT_STATUS_INVALID_ADDRESS (0xC0000000 | 0x0141)
#define NT_STATUS_DLL_INIT_FAILED (0xC0000000 | 0x0142)
#define NT_STATUS_MISSING_SYSTEMFILE (0xC0000000 | 0x0143)
#define NT_STATUS_UNHANDLED_EXCEPTION (0xC0000000 | 0x0144)
#define NT_STATUS_APP_INIT_FAILURE (0xC0000000 | 0x0145)
#define NT_STATUS_PAGEFILE_CREATE_FAILED (0xC0000000 | 0x0146)
#define NT_STATUS_NO_PAGEFILE (0xC0000000 | 0x0147)
#define NT_STATUS_INVALID_LEVEL (0xC0000000 | 0x0148)
#define NT_STATUS_WRONG_PASSWORD_CORE (0xC0000000 | 0x0149)
#define NT_STATUS_ILLEGAL_FLOAT_CONTEXT (0xC0000000 | 0x014a)
#define NT_STATUS_PIPE_BROKEN (0xC0000000 | 0x014b)
#define NT_STATUS_REGISTRY_CORRUPT (0xC0000000 | 0x014c)
#define NT_STATUS_REGISTRY_IO_FAILED (0xC0000000 | 0x014d)
#define NT_STATUS_NO_EVENT_PAIR (0xC0000000 | 0x014e)
#define NT_STATUS_UNRECOGNIZED_VOLUME (0xC0000000 | 0x014f)
#define NT_STATUS_SERIAL_NO_DEVICE_INITED (0xC0000000 | 0x0150)
#define NT_STATUS_NO_SUCH_ALIAS (0xC0000000 | 0x0151)
#define NT_STATUS_MEMBER_NOT_IN_ALIAS (0xC0000000 | 0x0152)
#define NT_STATUS_MEMBER_IN_ALIAS (0xC0000000 | 0x0153)
#define NT_STATUS_ALIAS_EXISTS (0xC0000000 | 0x0154)
#define NT_STATUS_LOGON_NOT_GRANTED (0xC0000000 | 0x0155)
#define NT_STATUS_TOO_MANY_SECRETS (0xC0000000 | 0x0156)
#define NT_STATUS_SECRET_TOO_LONG (0xC0000000 | 0x0157)
#define NT_STATUS_INTERNAL_DB_ERROR (0xC0000000 | 0x0158)
#define NT_STATUS_FULLSCREEN_MODE (0xC0000000 | 0x0159)
#define NT_STATUS_TOO_MANY_CONTEXT_IDS (0xC0000000 | 0x015a)
#define NT_STATUS_LOGON_TYPE_NOT_GRANTED (0xC0000000 | 0x015b)
#define NT_STATUS_NOT_REGISTRY_FILE (0xC0000000 | 0x015c)
#define NT_STATUS_NT_CROSS_ENCRYPTION_REQUIRED (0xC0000000 | 0x015d)
#define NT_STATUS_DOMAIN_CTRLR_CONFIG_ERROR (0xC0000000 | 0x015e)
#define NT_STATUS_FT_MISSING_MEMBER (0xC0000000 | 0x015f)
#define NT_STATUS_ILL_FORMED_SERVICE_ENTRY (0xC0000000 | 0x0160)
#define NT_STATUS_ILLEGAL_CHARACTER (0xC0000000 | 0x0161)
#define NT_STATUS_UNMAPPABLE_CHARACTER (0xC0000000 | 0x0162)
#define NT_STATUS_UNDEFINED_CHARACTER (0xC0000000 | 0x0163)
#define NT_STATUS_FLOPPY_VOLUME (0xC0000000 | 0x0164)
#define NT_STATUS_FLOPPY_ID_MARK_NOT_FOUND (0xC0000000 | 0x0165)
#define NT_STATUS_FLOPPY_WRONG_CYLINDER (0xC0000000 | 0x0166)
#define NT_STATUS_FLOPPY_UNKNOWN_ERROR (0xC0000000 | 0x0167)
#define NT_STATUS_FLOPPY_BAD_REGISTERS (0xC0000000 | 0x0168)
#define NT_STATUS_DISK_RECALIBRATE_FAILED (0xC0000000 | 0x0169)
#define NT_STATUS_DISK_OPERATION_FAILED (0xC0000000 | 0x016a)
#define NT_STATUS_DISK_RESET_FAILED (0xC0000000 | 0x016b)
#define NT_STATUS_SHARED_IRQ_BUSY (0xC0000000 | 0x016c)
#define NT_STATUS_FT_ORPHANING (0xC0000000 | 0x016d)
#define NT_STATUS_PARTITION_FAILURE (0xC0000000 | 0x0172)
#define NT_STATUS_INVALID_BLOCK_LENGTH (0xC0000000 | 0x0173)
#define NT_STATUS_DEVICE_NOT_PARTITIONED (0xC0000000 | 0x0174)
#define NT_STATUS_UNABLE_TO_LOCK_MEDIA (0xC0000000 | 0x0175)
#define NT_STATUS_UNABLE_TO_UNLOAD_MEDIA (0xC0000000 | 0x0176)
#define NT_STATUS_EOM_OVERFLOW (0xC0000000 | 0x0177)
#define NT_STATUS_NO_MEDIA (0xC0000000 | 0x0178)
#define NT_STATUS_NO_SUCH_MEMBER (0xC0000000 | 0x017a)
#define NT_STATUS_INVALID_MEMBER (0xC0000000 | 0x017b)
#define NT_STATUS_KEY_DELETED (0xC0000000 | 0x017c)
#define NT_STATUS_NO_LOG_SPACE (0xC0000000 | 0x017d)
#define NT_STATUS_TOO_MANY_SIDS (0xC0000000 | 0x017e)
#define NT_STATUS_LM_CROSS_ENCRYPTION_REQUIRED (0xC0000000 | 0x017f)
#define NT_STATUS_KEY_HAS_CHILDREN (0xC0000000 | 0x0180)
#define NT_STATUS_CHILD_MUST_BE_VOLATILE (0xC0000000 | 0x0181)
#define NT_STATUS_DEVICE_CONFIGURATION_ERROR (0xC0000000 | 0x0182)
#define NT_STATUS_DRIVER_INTERNAL_ERROR (0xC0000000 | 0x0183)
#define NT_STATUS_INVALID_DEVICE_STATE (0xC0000000 | 0x0184)
#define NT_STATUS_IO_DEVICE_ERROR (0xC0000000 | 0x0185)
#define NT_STATUS_DEVICE_PROTOCOL_ERROR (0xC0000000 | 0x0186)
#define NT_STATUS_BACKUP_CONTROLLER (0xC0000000 | 0x0187)
#define NT_STATUS_LOG_FILE_FULL (0xC0000000 | 0x0188)
#define NT_STATUS_TOO_LATE (0xC0000000 | 0x0189)
#define NT_STATUS_NO_TRUST_LSA_SECRET (0xC0000000 | 0x018a)
#define NT_STATUS_NO_TRUST_SAM_ACCOUNT (0xC0000000 | 0x018b)
#define NT_STATUS_TRUSTED_DOMAIN_FAILURE (0xC0000000 | 0x018c)
#define NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE (0xC0000000 | 0x018d)
#define NT_STATUS_EVENTLOG_FILE_CORRUPT (0xC0000000 | 0x018e)
#define NT_STATUS_EVENTLOG_CANT_START (0xC0000000 | 0x018f)
#define NT_STATUS_TRUST_FAILURE (0xC0000000 | 0x0190)
#define NT_STATUS_MUTANT_LIMIT_EXCEEDED (0xC0000000 | 0x0191)
#define NT_STATUS_NETLOGON_NOT_STARTED (0xC0000000 | 0x0192)
#define NT_STATUS_ACCOUNT_EXPIRED (0xC0000000 | 0x0193)
#define NT_STATUS_POSSIBLE_DEADLOCK (0xC0000000 | 0x0194)
#define NT_STATUS_NETWORK_CREDENTIAL_CONFLICT (0xC0000000 | 0x0195)
#define NT_STATUS_REMOTE_SESSION_LIMIT (0xC0000000 | 0x0196)
#define NT_STATUS_EVENTLOG_FILE_CHANGED (0xC0000000 | 0x0197)
#define NT_STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT (0xC0000000 | 0x0198)
#define NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT (0xC0000000 | 0x0199)
#define NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT (0xC0000000 | 0x019a)
#define NT_STATUS_DOMAIN_TRUST_INCONSISTENT (0xC0000000 | 0x019b)
#define NT_STATUS_FS_DRIVER_REQUIRED (0xC0000000 | 0x019c)
#define NT_STATUS_NO_USER_SESSION_KEY (0xC0000000 | 0x0202)
#define NT_STATUS_USER_SESSION_DELETED (0xC0000000 | 0x0203)
#define NT_STATUS_RESOURCE_LANG_NOT_FOUND (0xC0000000 | 0x0204)
#define NT_STATUS_INSUFF_SERVER_RESOURCES (0xC0000000 | 0x0205)
#define NT_STATUS_INVALID_BUFFER_SIZE (0xC0000000 | 0x0206)
#define NT_STATUS_INVALID_ADDRESS_COMPONENT (0xC0000000 | 0x0207)
#define NT_STATUS_INVALID_ADDRESS_WILDCARD (0xC0000000 | 0x0208)
#define NT_STATUS_TOO_MANY_ADDRESSES (0xC0000000 | 0x0209)
#define NT_STATUS_ADDRESS_ALREADY_EXISTS (0xC0000000 | 0x020a)
#define NT_STATUS_ADDRESS_CLOSED (0xC0000000 | 0x020b)
#define NT_STATUS_CONNECTION_DISCONNECTED (0xC0000000 | 0x020c)
#define NT_STATUS_CONNECTION_RESET (0xC0000000 | 0x020d)
#define NT_STATUS_TOO_MANY_NODES (0xC0000000 | 0x020e)
#define NT_STATUS_TRANSACTION_ABORTED (0xC0000000 | 0x020f)
#define NT_STATUS_TRANSACTION_TIMED_OUT (0xC0000000 | 0x0210)
#define NT_STATUS_TRANSACTION_NO_RELEASE (0xC0000000 | 0x0211)
#define NT_STATUS_TRANSACTION_NO_MATCH (0xC0000000 | 0x0212)
#define NT_STATUS_TRANSACTION_RESPONDED (0xC0000000 | 0x0213)
#define NT_STATUS_TRANSACTION_INVALID_ID (0xC0000000 | 0x0214)
#define NT_STATUS_TRANSACTION_INVALID_TYPE (0xC0000000 | 0x0215)
#define NT_STATUS_NOT_SERVER_SESSION (0xC0000000 | 0x0216)
#define NT_STATUS_NOT_CLIENT_SESSION (0xC0000000 | 0x0217)
#define NT_STATUS_CANNOT_LOAD_REGISTRY_FILE (0xC0000000 | 0x0218)
#define NT_STATUS_DEBUG_ATTACH_FAILED (0xC0000000 | 0x0219)
#define NT_STATUS_SYSTEM_PROCESS_TERMINATED (0xC0000000 | 0x021a)
#define NT_STATUS_DATA_NOT_ACCEPTED (0xC0000000 | 0x021b)
#define NT_STATUS_NO_BROWSER_SERVERS_FOUND (0xC0000000 | 0x021c)
#define NT_STATUS_VDM_HARD_ERROR (0xC0000000 | 0x021d)
#define NT_STATUS_DRIVER_CANCEL_TIMEOUT (0xC0000000 | 0x021e)
#define NT_STATUS_REPLY_MESSAGE_MISMATCH (0xC0000000 | 0x021f)
#define NT_STATUS_MAPPED_ALIGNMENT (0xC0000000 | 0x0220)
#define NT_STATUS_IMAGE_CHECKSUM_MISMATCH (0xC0000000 | 0x0221)
#define NT_STATUS_LOST_WRITEBEHIND_DATA (0xC0000000 | 0x0222)
#define NT_STATUS_CLIENT_SERVER_PARAMETERS_INVALID (0xC0000000 | 0x0223)
#define NT_STATUS_PASSWORD_MUST_CHANGE (0xC0000000 | 0x0224)
#define NT_STATUS_NOT_FOUND (0xC0000000 | 0x0225)
#define NT_STATUS_NOT_TINY_STREAM (0xC0000000 | 0x0226)
#define NT_STATUS_RECOVERY_FAILURE (0xC0000000 | 0x0227)
#define NT_STATUS_STACK_OVERFLOW_READ (0xC0000000 | 0x0228)
#define NT_STATUS_FAIL_CHECK (0xC0000000 | 0x0229)
#define NT_STATUS_DUPLICATE_OBJECTID (0xC0000000 | 0x022a)
#define NT_STATUS_OBJECTID_EXISTS (0xC0000000 | 0x022b)
#define NT_STATUS_CONVERT_TO_LARGE (0xC0000000 | 0x022c)
#define NT_STATUS_RETRY (0xC0000000 | 0x022d)
#define NT_STATUS_FOUND_OUT_OF_SCOPE (0xC0000000 | 0x022e)
#define NT_STATUS_ALLOCATE_BUCKET (0xC0000000 | 0x022f)
#define NT_STATUS_PROPSET_NOT_FOUND (0xC0000000 | 0x0230)
#define NT_STATUS_MARSHALL_OVERFLOW (0xC0000000 | 0x0231)
#define NT_STATUS_INVALID_VARIANT (0xC0000000 | 0x0232)
#define NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND (0xC0000000 | 0x0233)
#define NT_STATUS_ACCOUNT_LOCKED_OUT (0xC0000000 | 0x0234)
#define NT_STATUS_HANDLE_NOT_CLOSABLE (0xC0000000 | 0x0235)
#define NT_STATUS_CONNECTION_REFUSED (0xC0000000 | 0x0236)
#define NT_STATUS_GRACEFUL_DISCONNECT (0xC0000000 | 0x0237)
#define NT_STATUS_ADDRESS_ALREADY_ASSOCIATED (0xC0000000 | 0x0238)
#define NT_STATUS_ADDRESS_NOT_ASSOCIATED (0xC0000000 | 0x0239)
#define NT_STATUS_CONNECTION_INVALID (0xC0000000 | 0x023a)
#define NT_STATUS_CONNECTION_ACTIVE (0xC0000000 | 0x023b)
#define NT_STATUS_NETWORK_UNREACHABLE (0xC0000000 | 0x023c)
#define NT_STATUS_HOST_UNREACHABLE (0xC0000000 | 0x023d)
#define NT_STATUS_PROTOCOL_UNREACHABLE (0xC0000000 | 0x023e)
#define NT_STATUS_PORT_UNREACHABLE (0xC0000000 | 0x023f)
#define NT_STATUS_REQUEST_ABORTED (0xC0000000 | 0x0240)
#define NT_STATUS_CONNECTION_ABORTED (0xC0000000 | 0x0241)
#define NT_STATUS_BAD_COMPRESSION_BUFFER (0xC0000000 | 0x0242)
#define NT_STATUS_USER_MAPPED_FILE (0xC0000000 | 0x0243)
#define NT_STATUS_AUDIT_FAILED (0xC0000000 | 0x0244)
#define NT_STATUS_TIMER_RESOLUTION_NOT_SET (0xC0000000 | 0x0245)
#define NT_STATUS_CONNECTION_COUNT_LIMIT (0xC0000000 | 0x0246)
#define NT_STATUS_LOGIN_TIME_RESTRICTION (0xC0000000 | 0x0247)
#define NT_STATUS_LOGIN_WKSTA_RESTRICTION (0xC0000000 | 0x0248)
#define NT_STATUS_IMAGE_MP_UP_MISMATCH (0xC0000000 | 0x0249)
#define NT_STATUS_INSUFFICIENT_LOGON_INFO (0xC0000000 | 0x0250)
#define NT_STATUS_BAD_DLL_ENTRYPOINT (0xC0000000 | 0x0251)
#define NT_STATUS_BAD_SERVICE_ENTRYPOINT (0xC0000000 | 0x0252)
#define NT_STATUS_LPC_REPLY_LOST (0xC0000000 | 0x0253)
#define NT_STATUS_IP_ADDRESS_CONFLICT1 (0xC0000000 | 0x0254)
#define NT_STATUS_IP_ADDRESS_CONFLICT2 (0xC0000000 | 0x0255)
#define NT_STATUS_REGISTRY_QUOTA_LIMIT (0xC0000000 | 0x0256)
#define NT_STATUS_PATH_NOT_COVERED (0xC0000000 | 0x0257)
#define NT_STATUS_NO_CALLBACK_ACTIVE (0xC0000000 | 0x0258)
#define NT_STATUS_LICENSE_QUOTA_EXCEEDED (0xC0000000 | 0x0259)
#define NT_STATUS_PWD_TOO_SHORT (0xC0000000 | 0x025a)
#define NT_STATUS_PWD_TOO_RECENT (0xC0000000 | 0x025b)
#define NT_STATUS_PWD_HISTORY_CONFLICT (0xC0000000 | 0x025c)
#define NT_STATUS_PLUGPLAY_NO_DEVICE (0xC0000000 | 0x025e)
#define NT_STATUS_UNSUPPORTED_COMPRESSION (0xC0000000 | 0x025f)
#define NT_STATUS_INVALID_HW_PROFILE (0xC0000000 | 0x0260)
#define NT_STATUS_INVALID_PLUGPLAY_DEVICE_PATH (0xC0000000 | 0x0261)
#define NT_STATUS_DRIVER_ORDINAL_NOT_FOUND (0xC0000000 | 0x0262)
#define NT_STATUS_DRIVER_ENTRYPOINT_NOT_FOUND (0xC0000000 | 0x0263)
#define NT_STATUS_RESOURCE_NOT_OWNED (0xC0000000 | 0x0264)
#define NT_STATUS_TOO_MANY_LINKS (0xC0000000 | 0x0265)
#define NT_STATUS_QUOTA_LIST_INCONSISTENT (0xC0000000 | 0x0266)
#define NT_STATUS_FILE_IS_OFFLINE (0xC0000000 | 0x0267)
#define NT_STATUS_NETWORK_SESSION_EXPIRED (0xC0000000 | 0x035c)
#define NT_STATUS_NO_SUCH_JOB (0xC0000000 | 0xEDE) /* scheduler */
#define NT_STATUS_NO_PREAUTH_INTEGRITY_HASH_OVERLAP (0xC0000000 | 0x5D0000)
#define NT_STATUS_PENDING 0x00000103
#endif /* _NTERR_H */

View File

@ -5,7 +5,6 @@
*/
#include "glob.h"
#include "nterr.h"
#include "smb_common.h"
#include "../common/smb2status.h"
#include "mgmt/user_session.h"

View File

@ -5497,6 +5497,13 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
info->Attributes |= cpu_to_le32(FILE_NAMED_STREAMS);
info->MaxPathNameComponentLength = cpu_to_le32(stfs.f_namelen);
/*
* some application(potableapp) can not run on ksmbd share
* because only NTFS handle security setting on windows.
* So Although local fs(EXT4 or F2fs, etc) is not NTFS,
* ksmbd should show share as NTFS. Later, If needed, we can add
* fs type(s) parameter to change fs type user wanted.
*/
len = smbConvertToUTF16((__le16 *)info->FileSystemName,
"NTFS", PATH_MAX, conn->local_nls, 0);
len = len * 2;

View File

@ -3,13 +3,12 @@
* Copyright (C) 2018 Samsung Electronics Co., Ltd.
*/
#ifndef __SMB_COMMON_H__
#define __SMB_COMMON_H__
#ifndef __SMB_SERVER_COMMON_H__
#define __SMB_SERVER_COMMON_H__
#include <linux/kernel.h>
#include "glob.h"
#include "nterr.h"
#include "../common/smbglob.h"
#include "../common/smb2pdu.h"
#include "../common/fscc.h"
@ -203,4 +202,4 @@ unsigned int ksmbd_server_side_copy_max_chunk_size(void);
unsigned int ksmbd_server_side_copy_max_total_size(void);
bool is_asterisk(char *p);
__le32 smb_map_generic_desired_access(__le32 daccess);
#endif /* __SMB_COMMON_H__ */
#endif /* __SMB_SERVER_COMMON_H__ */

View File

@ -344,6 +344,7 @@ struct nfs4_copy_state {
#define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */
#define NFS_INO_LAYOUTSTATS (11) /* layoutstats inflight */
#define NFS_INO_ODIRECT (12) /* I/O setting is O_DIRECT */
#define NFS_INO_REQ_DIR_DELEG (13) /* Request a directory delegation */
static inline struct nfs_inode *NFS_I(const struct inode *inode)
{

View File

@ -172,6 +172,11 @@ struct nfs_server {
#define NFS_MOUNT_FORCE_RDIRPLUS 0x20000000
#define NFS_MOUNT_NETUNREACH_FATAL 0x40000000
unsigned int automount_inherit; /* Properties inherited by automount */
#define NFS_AUTOMOUNT_INHERIT_BSIZE 0x0001
#define NFS_AUTOMOUNT_INHERIT_RSIZE 0x0002
#define NFS_AUTOMOUNT_INHERIT_WSIZE 0x0004
unsigned int caps; /* server capabilities */
__u64 fattr_valid; /* Valid attributes */
unsigned int rsize; /* read size */
@ -305,6 +310,7 @@ struct nfs_server {
#define NFS_CAP_REBOOT_LAYOUTRETURN (1U << 8)
#define NFS_CAP_OFFLOAD_STATUS (1U << 9)
#define NFS_CAP_ZERO_RANGE (1U << 10)
#define NFS_CAP_DIR_DELEG (1U << 11)
#define NFS_CAP_OPEN_XOR (1U << 12)
#define NFS_CAP_DELEGTIME (1U << 13)
#define NFS_CAP_POSIX_LOCK (1U << 14)

View File

@ -1092,12 +1092,19 @@ struct nfs4_getattr_arg {
struct nfs4_sequence_args seq_args;
const struct nfs_fh * fh;
const u32 * bitmask;
bool get_dir_deleg;
};
struct nfs4_gdd_res {
u32 status;
nfs4_stateid deleg;
};
struct nfs4_getattr_res {
struct nfs4_sequence_res seq_res;
const struct nfs_server * server;
struct nfs_fattr * fattr;
struct nfs4_gdd_res * gdd_res;
};
struct nfs4_link_arg {
@ -1801,7 +1808,8 @@ struct nfs_rpc_ops {
int (*unlink_done) (struct rpc_task *, struct inode *);
void (*rename_setup) (struct rpc_message *msg,
struct dentry *old_dentry,
struct dentry *new_dentry);
struct dentry *new_dentry,
struct inode *same_parent);
void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
int (*link) (struct inode *, struct inode *, const struct qstr *);

View File

@ -25,12 +25,14 @@ void xprt_init_bc_request(struct rpc_rqst *req, struct rpc_task *task,
void xprt_free_bc_request(struct rpc_rqst *req);
int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
void xprt_enqueue_bc_request(struct rpc_rqst *req);
/* Socket backchannel transport methods */
int xprt_setup_bc(struct rpc_xprt *xprt, unsigned int min_reqs);
void xprt_destroy_bc(struct rpc_xprt *xprt, unsigned int max_reqs);
void xprt_free_bc_rqst(struct rpc_rqst *req);
unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt);
void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv);
/*
* Determine if a shared backchannel is in use
@ -68,5 +70,10 @@ static inline void set_bc_enabled(struct svc_serv *serv)
static inline void xprt_free_bc_request(struct rpc_rqst *req)
{
}
static inline void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv)
{
svc_destroy(serv);
}
#endif /* CONFIG_SUNRPC_BACKCHANNEL */
#endif /* _LINUX_SUNRPC_BC_XPRT_H */

View File

@ -2536,6 +2536,9 @@ static enum hrtimer_restart io_cqring_min_timer_wakeup(struct hrtimer *timer)
goto out_wake;
}
/* any generated CQE posted past this time should wake us up */
iowq->cq_tail = iowq->cq_min_tail;
hrtimer_update_function(&iowq->t, io_cqring_timer_wakeup);
hrtimer_set_expires(timer, iowq->timeout);
return HRTIMER_RESTART;

View File

@ -61,7 +61,8 @@ config CRYPTO_LIB_CHACHA_ARCH
default y if ARM64 && KERNEL_MODE_NEON
default y if MIPS && CPU_MIPS32_R2
default y if PPC64 && CPU_LITTLE_ENDIAN && VSX
default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
default y if S390
default y if X86_64
@ -184,7 +185,8 @@ config CRYPTO_LIB_SHA256_ARCH
default y if ARM64
default y if MIPS && CPU_CAVIUM_OCTEON
default y if PPC && SPE
default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
default y if S390
default y if SPARC64
default y if X86_64
@ -202,7 +204,8 @@ config CRYPTO_LIB_SHA512_ARCH
default y if ARM && !CPU_V7M
default y if ARM64
default y if MIPS && CPU_CAVIUM_OCTEON
default y if RISCV && 64BIT && RISCV_ISA_V && TOOLCHAIN_HAS_VECTOR_CRYPTO
default y if RISCV && 64BIT && TOOLCHAIN_HAS_VECTOR_CRYPTO && \
RISCV_EFFICIENT_VECTOR_UNALIGNED_ACCESS
default y if S390
default y if SPARC64
default y if X86_64

View File

@ -33,7 +33,6 @@ obj-$(CONFIG_CRYPTO_LIB_GF128MUL) += gf128mul.o
obj-$(CONFIG_CRYPTO_LIB_BLAKE2B) += libblake2b.o
libblake2b-y := blake2b.o
CFLAGS_blake2b.o := -Wframe-larger-than=4096 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105930
ifeq ($(CONFIG_CRYPTO_LIB_BLAKE2B_ARCH),y)
CFLAGS_blake2b.o += -I$(src)/$(SRCARCH)
libblake2b-$(CONFIG_ARM) += arm/blake2b-neon-core.o

View File

@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/unroll.h>
#include <linux/types.h>
static const u8 blake2b_sigma[12][16] = {
@ -73,31 +74,26 @@ blake2b_compress_generic(struct blake2b_ctx *ctx,
b = ror64(b ^ c, 63); \
} while (0)
#define ROUND(r) do { \
G(r, 0, v[0], v[ 4], v[ 8], v[12]); \
G(r, 1, v[1], v[ 5], v[ 9], v[13]); \
G(r, 2, v[2], v[ 6], v[10], v[14]); \
G(r, 3, v[3], v[ 7], v[11], v[15]); \
G(r, 4, v[0], v[ 5], v[10], v[15]); \
G(r, 5, v[1], v[ 6], v[11], v[12]); \
G(r, 6, v[2], v[ 7], v[ 8], v[13]); \
G(r, 7, v[3], v[ 4], v[ 9], v[14]); \
} while (0)
ROUND(0);
ROUND(1);
ROUND(2);
ROUND(3);
ROUND(4);
ROUND(5);
ROUND(6);
ROUND(7);
ROUND(8);
ROUND(9);
ROUND(10);
ROUND(11);
#ifdef CONFIG_64BIT
/*
* Unroll the rounds loop to enable constant-folding of the
* blake2b_sigma values. Seems worthwhile on 64-bit kernels.
* Not worthwhile on 32-bit kernels because the code size is
* already so large there due to BLAKE2b using 64-bit words.
*/
unrolled_full
#endif
for (int r = 0; r < 12; r++) {
G(r, 0, v[0], v[4], v[8], v[12]);
G(r, 1, v[1], v[5], v[9], v[13]);
G(r, 2, v[2], v[6], v[10], v[14]);
G(r, 3, v[3], v[7], v[11], v[15]);
G(r, 4, v[0], v[5], v[10], v[15]);
G(r, 5, v[1], v[6], v[11], v[12]);
G(r, 6, v[2], v[7], v[8], v[13]);
G(r, 7, v[3], v[4], v[9], v[14]);
}
#undef G
#undef ROUND
for (i = 0; i < 8; ++i)
ctx->h[i] ^= v[i] ^ v[i + 8];

View File

@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/unroll.h>
#include <linux/types.h>
static const u8 blake2s_sigma[10][16] = {
@ -71,29 +72,22 @@ blake2s_compress_generic(struct blake2s_ctx *ctx,
b = ror32(b ^ c, 7); \
} while (0)
#define ROUND(r) do { \
G(r, 0, v[0], v[ 4], v[ 8], v[12]); \
G(r, 1, v[1], v[ 5], v[ 9], v[13]); \
G(r, 2, v[2], v[ 6], v[10], v[14]); \
G(r, 3, v[3], v[ 7], v[11], v[15]); \
G(r, 4, v[0], v[ 5], v[10], v[15]); \
G(r, 5, v[1], v[ 6], v[11], v[12]); \
G(r, 6, v[2], v[ 7], v[ 8], v[13]); \
G(r, 7, v[3], v[ 4], v[ 9], v[14]); \
} while (0)
ROUND(0);
ROUND(1);
ROUND(2);
ROUND(3);
ROUND(4);
ROUND(5);
ROUND(6);
ROUND(7);
ROUND(8);
ROUND(9);
/*
* Unroll the rounds loop to enable constant-folding of the
* blake2s_sigma values.
*/
unrolled_full
for (int r = 0; r < 10; r++) {
G(r, 0, v[0], v[4], v[8], v[12]);
G(r, 1, v[1], v[5], v[9], v[13]);
G(r, 2, v[2], v[6], v[10], v[14]);
G(r, 3, v[3], v[7], v[11], v[15]);
G(r, 4, v[0], v[5], v[10], v[15]);
G(r, 5, v[1], v[6], v[11], v[12]);
G(r, 6, v[2], v[7], v[8], v[13]);
G(r, 7, v[3], v[4], v[9], v[14]);
}
#undef G
#undef ROUND
for (i = 0; i < 8; ++i)
ctx->h[i] ^= v[i] ^ v[i + 8];

View File

@ -60,7 +60,8 @@
#define VL t2
#define STRIDE t3
#define ROUND_CTR t4
#define KEY0 s0
#define KEY0 t5
// Avoid s0/fp to allow for unwinding
#define KEY1 s1
#define KEY2 s2
#define KEY3 s3
@ -143,7 +144,6 @@
// The updated 32-bit counter is written back to state->x[12] before returning.
SYM_FUNC_START(chacha_zvkb)
addi sp, sp, -96
sd s0, 0(sp)
sd s1, 8(sp)
sd s2, 16(sp)
sd s3, 24(sp)
@ -280,7 +280,6 @@ SYM_FUNC_START(chacha_zvkb)
bnez NBLOCKS, .Lblock_loop
sw COUNTER, 48(STATEP)
ld s0, 0(sp)
ld s1, 8(sp)
ld s2, 16(sp)
ld s3, 24(sp)

View File

@ -24,6 +24,22 @@ unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt)
return BC_MAX_SLOTS;
}
/*
* Helper function to nullify backchannel server pointer in transport.
* We need to synchronize setting the pointer to NULL (done so after
* the backchannel server is shutdown) with the usage of that pointer
* by the backchannel request processing routines
* xprt_complete_bc_request() and rpcrdma_bc_receive_call().
*/
void xprt_svc_destroy_nullify_bc(struct rpc_xprt *xprt, struct svc_serv **serv)
{
spin_lock(&xprt->bc_pa_lock);
svc_destroy(serv);
xprt->bc_serv = NULL;
spin_unlock(&xprt->bc_pa_lock);
}
EXPORT_SYMBOL_GPL(xprt_svc_destroy_nullify_bc);
/*
* Helper routines that track the number of preallocation elements
* on the transport.
@ -354,7 +370,6 @@ found:
void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied)
{
struct rpc_xprt *xprt = req->rq_xprt;
struct svc_serv *bc_serv = xprt->bc_serv;
spin_lock(&xprt->bc_pa_lock);
list_del(&req->rq_bc_pa_list);
@ -365,7 +380,21 @@ void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied)
set_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
dprintk("RPC: add callback request to list\n");
xprt_get(xprt);
lwq_enqueue(&req->rq_bc_list, &bc_serv->sv_cb_list);
svc_pool_wake_idle_thread(&bc_serv->sv_pools[0]);
xprt_enqueue_bc_request(req);
}
void xprt_enqueue_bc_request(struct rpc_rqst *req)
{
struct rpc_xprt *xprt = req->rq_xprt;
struct svc_serv *bc_serv;
xprt_get(xprt);
spin_lock(&xprt->bc_pa_lock);
bc_serv = xprt->bc_serv;
if (bc_serv) {
lwq_enqueue(&req->rq_bc_list, &bc_serv->sv_cb_list);
svc_pool_wake_idle_thread(&bc_serv->sv_pools[0]);
}
spin_unlock(&xprt->bc_pa_lock);
}
EXPORT_SYMBOL_GPL(xprt_enqueue_bc_request);

View File

@ -9,6 +9,7 @@
#include <linux/sunrpc/svc.h>
#include <linux/sunrpc/svc_xprt.h>
#include <linux/sunrpc/svc_rdma.h>
#include <linux/sunrpc/bc_xprt.h>
#include "xprt_rdma.h"
#include <trace/events/rpcrdma.h>
@ -220,7 +221,6 @@ void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt,
struct rpcrdma_rep *rep)
{
struct rpc_xprt *xprt = &r_xprt->rx_xprt;
struct svc_serv *bc_serv;
struct rpcrdma_req *req;
struct rpc_rqst *rqst;
struct xdr_buf *buf;
@ -261,11 +261,7 @@ void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt,
trace_xprtrdma_cb_call(r_xprt, rqst);
/* Queue rqst for ULP's callback service */
bc_serv = xprt->bc_serv;
xprt_get(xprt);
lwq_enqueue(&rqst->rq_bc_list, &bc_serv->sv_cb_list);
svc_pool_wake_idle_thread(&bc_serv->sv_pools[0]);
xprt_enqueue_bc_request(rqst);
r_xprt->rx_stats.bcall_count++;
return;