linux/fs
Sergey Bashirov c33da548fb NFSD: Fix last write offset handling in layoutcommit
[ Upstream commit d68886bae7 ]

The data type of loca_last_write_offset is newoffset4 and is switched
on a boolean value, no_newoffset, that indicates if a previous write
occurred or not. If no_newoffset is FALSE, an offset is not given.
This means that client does not try to update the file size. Thus,
server should not try to calculate new file size and check if it fits
into the segment range. See RFC 8881, section 12.5.4.2.

Sometimes the current incorrect logic may cause clients to hang when
trying to sync an inode. If layoutcommit fails, the client marks the
inode as dirty again.

Fixes: 9cf514ccfa ("nfsd: implement pNFS operations")
Cc: stable@vger.kernel.org
Co-developed-by: Konstantin Evtushenko <koevtushenko@yandex.com>
Signed-off-by: Konstantin Evtushenko <koevtushenko@yandex.com>
Signed-off-by: Sergey Bashirov <sergeybashirov@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-10-23 16:20:41 +02:00
..
9p 9p: Add a migrate_folio method 2025-06-19 15:32:36 +02:00
adfs move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
affs affs: don't write overlarge OFS data block size fields 2025-04-10 14:39:29 +02:00
afs afs: Fix potential null pointer dereference in afs_put_server 2025-10-02 13:44:14 +02:00
autofs autofs: fix thinko in validate_dev_ioctl() 2024-10-28 13:16:56 +01:00
bcachefs add a string-to-qstr constructor 2025-07-10 16:05:08 +02:00
befs befs: Convert befs_symlink_read_folio() to use folio_end_read() 2024-05-31 12:31:39 +02:00
bfs fs: Convert aops->write_begin to take a folio 2024-08-07 11:33:21 +02:00
btrfs btrfs: do not assert we found block group item when creating free space tree 2025-10-23 16:20:20 +02:00
cachefiles cachefiles: Fix the incorrect return value in __cachefiles_write() 2025-07-24 08:56:30 +02:00
ceph ceph: fix race condition where r_parent becomes stale before sending message 2025-09-19 16:35:47 +02:00
coda coda: use param->file for FSCONFIG_SET_FD 2024-08-19 13:45:03 +02:00
configfs configfs: Do not override creating attribute file failure in populate_attrs() 2025-06-27 11:11:12 +01:00
cramfs cramfs: Verify inode mode when loading from disk 2025-10-19 16:34:06 +02:00
crypto fscrypt: Don't use problematic non-inline crypto engines 2025-08-20 18:30:15 +02:00
debugfs debugfs: fix mount options not being applied 2025-08-28 16:31:08 +02:00
devpts fs: Remove the now superfluous sentinel elements from ctl_table array 2023-12-28 04:57:57 -08:00
dlm dlm: make tcp still work in multi-link env 2025-05-29 11:02:14 +02:00
ecryptfs move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
efivarfs efivarfs: Fix slab-out-of-bounds in efivarfs_d_compare 2025-09-04 15:31:52 +02:00
efs efs: fix the efs new mount api implementation 2024-12-05 14:01:10 +01:00
erofs erofs: fix atomic context detection when !CONFIG_DEBUG_LOCK_ALLOC 2025-09-04 15:31:44 +02:00
exfat exfat: add cluster chain loop check for dir 2025-08-20 18:30:47 +02:00
exportfs fhandle: relax open_by_handle_at() permission checks 2024-05-28 15:57:23 +02:00
ext2 ext2: Handle fiemap on empty files to prevent EINVAL 2025-08-20 18:30:21 +02:00
ext4 ext4: detect invalid INLINE_DATA + EXTENTS flag combination 2025-10-23 16:20:19 +02:00
f2fs f2fs: fix wrong block mapping for multi-devices 2025-10-23 16:20:19 +02:00
fat fat: fix uninitialized variable 2024-10-17 00:28:06 -07:00
freevxfs freevxfs: Convert freevxfs to the new mount API. 2024-03-26 09:04:53 +01:00
fuse fuse: fix livelock in synchronous file put from fuseblk workers 2025-10-19 16:33:50 +02:00
gfs2 gfs2: Fix GLF_INVALIDATE_IN_PROGRESS flag clearing in do_xmote 2025-10-15 11:59:54 +02:00
hfs hfs: fix not erasing deleted b-tree node issue 2025-08-20 18:30:20 +02:00
hfsplus hfsplus: fix slab-out-of-bounds read in hfsplus_strcasecmp() 2025-10-23 16:20:38 +02:00
hostfs um: hostfs: avoid issues on inode number reuse by host 2025-04-10 14:39:25 +02:00
hpfs move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
hugetlbfs mm/hugetlb: fix folio is still mapped when deleted 2025-10-02 13:44:14 +02:00
iomap iomap: skip unnecessary ifs_block_is_uptodate check 2025-05-02 07:59:27 +02:00
isofs isofs: Verify inode mode when loading from disk 2025-07-24 08:56:25 +02:00
jbd2 jbd2: ensure that all ongoing I/O complete before freeing blocks 2025-10-23 16:20:19 +02:00
jffs2 jffs2: check jffs2_prealloc_raw_node_refs() result in few other places 2025-06-27 11:11:37 +01:00
jfs jfs: upper bound check of tree index in dbAllocAG 2025-08-20 18:30:42 +02:00
kernfs kernfs: Fix UAF in polling when open file is released 2025-09-19 16:35:47 +02:00
lockd move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
minix minixfs: Verify inode mode when loading from disk 2025-10-19 16:34:05 +02:00
netfs netfs: Prevent duplicate unlocking 2025-10-12 12:57:17 +02:00
nfs nfsd: don't use sv_nrthreads in connection limiting calculations. 2025-10-19 16:34:03 +02:00
nfs_common nfs: fix incorrect error handling in LOCALIO 2025-02-08 09:57:59 +01:00
nfsd NFSD: Fix last write offset handling in layoutcommit 2025-10-23 16:20:41 +02:00
nilfs2 nilfs2: fix CFI failure when accessing /sys/fs/nilfs2/features/* 2025-09-25 11:13:45 +02:00
nls move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
notify fanotify: sanitize handle_type values when reporting fid 2025-08-15 12:13:51 +02:00
ntfs3 fs/ntfs3: Fix a resource leak bug in wnd_extend() 2025-10-19 16:33:49 +02:00
ocfs2 ocfs2: fix double free in user_cluster_connect() 2025-10-15 12:00:18 +02:00
omfs fs: Convert aops->write_begin to take a folio 2024-08-07 11:33:21 +02:00
openpromfs openpromfs: add missing MODULE_DESCRIPTION() macro 2024-06-20 09:46:01 +02:00
orangefs fs/orangefs: use snprintf() instead of sprintf() 2025-08-20 18:30:41 +02:00
overlayfs ovl: use I_MUTEX_PARENT when locking parent in ovl_create_temp() 2025-08-28 16:31:10 +02:00
proc fs/proc/task_mmu: check p->vec_buf for NULL 2025-10-02 13:44:14 +02:00
pstore pstore: Change kmsg_bytes storage size to u32 2025-05-29 11:02:58 +02:00
qnx4 qnx4: add MODULE_DESCRIPTION() 2024-05-28 11:52:53 +02:00
qnx6 fs/qnx6: Fix building with GCC 15 2025-01-23 17:22:55 +01:00
quota fs: quota: create dedicated workqueue for quota_release_work 2025-10-19 16:33:49 +02:00
ramfs mm: switch mm->get_unmapped_area() to a flag 2024-04-25 20:56:25 -07:00
reiserfs move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
romfs romfs: fix romfs_read_folio() 2024-08-21 22:32:58 +02:00
smb ksmbd: fix recursive locking in RPC handle list access 2025-10-23 16:20:30 +02:00
squashfs Squashfs: reject negative file sizes in squashfs_read_inode() 2025-10-19 16:34:00 +02:00
sysfs Merge 6.9-rc5 into driver-core-next 2024-04-23 13:27:43 +02:00
sysv buffer: Convert __block_write_begin() to take a folio 2024-08-07 11:33:36 +02:00
tests execve: Move KUnit tests to tests/ subdirectory 2024-07-22 18:25:47 -07:00
tracefs tracefs: Add d_delete to remove negative dentries 2025-08-20 18:30:21 +02:00
ubifs ubifs: skip dumping tnc tree when zroot is null 2025-02-08 09:58:01 +01:00
udf fs: udf: fix OOB read in lengthAllocDescs handling 2025-10-15 12:00:21 +02:00
ufs ufs_rename(): fix bogus argument of folio_release_kmap() 2024-10-02 00:05:09 -04:00
unicode Revert "unicode: Don't special case ignorable code points" 2024-12-14 20:04:13 +01:00
vboxsf vboxsf: fix building with GCC 15 2025-03-22 12:54:15 -07:00
verity fsverity: expose verified fsverity built-in signatures to LSMs 2024-08-20 14:03:18 -04:00
xfs xfs: fix log CRC mismatches between i386 and other architectures 2025-10-23 16:20:38 +02:00
zonefs zonefs fixes for 6.12-rc2 2024-10-02 12:02:15 -07:00
aio.c fs/aio: Fix __percpu annotation of *cpu pointer in struct kioctx 2024-08-19 13:45:03 +02:00
anon_inodes.c fs: export anon_inode_make_secure_inode() and fix secretmem LSM bypass 2025-07-10 16:05:09 +02:00
attr.c nfsd-6.11 fixes: 2024-08-29 06:20:44 +12:00
backing-file.c fs: pass offset and result to backing_file end_write() callback 2024-10-16 13:17:45 +02:00
bad_inode.c fs: convert core infrastructure to new timestamp accessors 2023-10-18 13:26:15 +02:00
binfmt_elf.c binfmt_elf: Move brk for static PIE even if ASLR disabled 2025-05-22 14:29:35 +02:00
binfmt_elf_fdpic.c Revert "fs: don't block i_writecount during exec" 2024-12-05 14:02:50 +01:00
binfmt_flat.c binfmt_flat: Fix integer overflow bug on 32 bit systems 2025-02-17 10:05:04 +01:00
binfmt_misc.c Revert "fs: don't block i_writecount during exec" 2024-12-05 14:02:50 +01:00
binfmt_script.c fs: binfmt: add missing MODULE_DESCRIPTION() macros 2024-05-28 12:06:51 +02:00
bpf_fs_kfuncs.c bpf: Add kfunc bpf_get_dentry_xattr() to read xattr from dentry 2024-08-07 11:26:54 -07:00
buffer.c fs/buffer: fix use-after-free when call bh_read() helper 2025-08-28 16:31:08 +02:00
char_dev.c As usual, lots of singleton and doubleton patches all over the tree and 2023-11-02 20:53:31 -10:00
compat_binfmt_elf.c binfmt_elf: Introduce KUnit test 2022-03-03 20:38:56 -08:00
coredump.c coredump: hand a pidfd to the usermode coredump helper 2025-06-04 14:43:52 +02:00
d_path.c fs: d_path: include internal.h 2023-05-17 09:16:59 +02:00
dax.c dax: skip read lock assertion for read-only filesystems 2025-10-23 16:20:27 +02:00
dcache.c vfs-6.12.misc 2024-09-16 08:35:09 +02:00
direct-io.c fs/direct-io: Remove linux/prefetch.h include 2024-08-19 13:45:02 +02:00
drop_caches.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
eventfd.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
eventpoll.c eventpoll: Replace rwlock with spinlock 2025-10-19 16:33:49 +02:00
exec.c exec: fix the racy usage of fs_struct->in_exec 2025-04-10 14:39:40 +02:00
fcntl.c fcntl: make F_DUPFD_QUERY associative 2024-12-05 14:02:47 +01:00
fhandle.c fhandle: use more consistent rules for decoding file handle from userns 2025-09-19 16:35:41 +02:00
file.c fs: always return zero on success from replace_fd() 2025-10-19 16:33:33 +02:00
file_table.c add a string-to-qstr constructor 2025-07-10 16:05:08 +02:00
filesystems.c fs/filesystems: Fix potential unsigned integer underflow in fs_name() 2025-06-19 15:32:32 +02:00
fs-writeback.c writeback: Avoid excessively long inode switching times 2025-10-19 16:34:06 +02:00
fs_context.c fs: factor out vfs_parse_monolithic_sep() helper 2023-10-12 18:53:36 +03:00
fs_parser.c fs_parse: add uid & gid option option parsing helpers 2024-07-02 06:20:49 +02:00
fs_pin.c switch the remnants of releasing the mountpoint away from fs_pin 2019-07-16 22:52:37 -04:00
fs_struct.c kill do_each_thread() 2023-08-21 13:46:25 -07:00
fs_types.c fs: common implementation of file type 2019-01-21 17:48:13 +01:00
fsopen.c fscontext: do not consume log entries when returning -EMSGSIZE 2025-10-19 16:33:33 +02:00
init.c fs: add a new SB_I_NOUMASK flag 2023-10-19 11:02:47 +02:00
inode.c bcachefs: do not use PF_MEMALLOC_NORECLAIM 2024-10-09 12:47:18 -07:00
internal.h file: reclaim 24 bytes from f_owner 2024-08-28 13:05:39 +02:00
ioctl.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
Kconfig nfs: add missing selections of CONFIG_CRC32 2025-04-25 10:47:50 +02:00
Kconfig.binfmt exec: Add KUnit test for bprm_stack_limits() 2024-06-19 13:13:55 -07:00
kernel_read_file.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
libfs.c better lockdep annotations for simple_recursive_removal() 2025-08-20 18:30:20 +02:00
locks.c struct fd layout change (and conversion to accessor helpers) 2024-09-23 09:35:36 -07:00
Makefile bpf: introduce new VFS based BPF kfuncs 2024-08-06 09:01:41 -07:00
mbcache.c vfs: remove SLAB_MEM_SPREAD flag usage 2024-02-27 11:21:31 +01:00
mnt_idmapping.c fuse update for 6.12 2024-09-24 15:29:42 -07:00
mount.h fs: kill MNT_ONRB 2025-01-17 13:40:50 +01:00
mpage.c fs/writeback: convert wbc_account_cgroup_owner to take a folio 2025-01-17 13:40:33 +01:00
namei.c openat2: don't trigger automounts with RESOLVE_NO_XDEV 2025-10-19 16:33:51 +02:00
namespace.c mount: handle NULL values in mnt_ns_release() 2025-10-19 16:34:07 +02:00
nsfs.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
open.c openat2: explicitly return -E2BIG for (usize > PAGE_SIZE) 2024-10-10 12:09:03 +02:00
pidfs.c pidfs: raise SB_I_NODEV and SB_I_NOEXEC 2025-08-20 18:30:21 +02:00
pipe.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
pnode.c mounts: keep list of mounts in an rbtree 2023-11-18 14:56:16 +01:00
pnode.h fs: allow to mount beneath top mount 2023-05-19 04:30:22 +02:00
posix_acl.c fs: Use in_group_or_capable() helper to simplify the code 2024-08-30 08:22:37 +02:00
proc_namespace.c fs: rename show_mnt_opts -> show_vfsmnt_opts 2024-06-28 14:36:43 +02:00
read_write.c copy_file_range: limit size if in compat mode 2025-10-19 16:34:05 +02:00
readdir.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
remap_range.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
select.c select: Fix unbalanced user_access_end() 2025-02-08 09:56:53 +01:00
seq_file.c seq_file: Simplify __seq_puts() 2024-05-02 16:28:20 +02:00
signalfd.c struct fd layout change (and conversion to accessor helpers) 2024-09-23 09:35:36 -07:00
splice.c netfs: Fix unbuffered write error handling 2025-08-28 16:31:04 +02:00
stack.c fs: convert core infrastructure to new timestamp accessors 2023-10-18 13:26:15 +02:00
stat.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
statfs.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
super.c fs/super.c: introduce get_tree_bdev_flags() 2024-10-21 14:30:26 +02:00
sync.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
sysctls.c fs: Remove the now superfluous sentinel elements from ctl_table array 2023-12-28 04:57:57 -08:00
timerfd.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
userfaultfd.c mm/userfaultfd: fix uninitialized output field for -EAGAIN race 2025-05-18 08:24:52 +02:00
utimes.c introduce fd_file(), convert all accessors to it. 2024-08-12 22:00:43 -04:00
xattr.c fs/xattr.c: fix simple_xattr_list() 2025-06-27 11:11:36 +01:00