nfs: add 'noalignwrite' option for lock-less 'lost writes' prevention
authorDan Aloni <dan.aloni@vastdata.com>
Wed, 24 Jul 2024 11:07:12 +0000 (14:07 +0300)
committerAnna Schumaker <anna.schumaker@oracle.com>
Mon, 23 Sep 2024 19:03:13 +0000 (15:03 -0400)
commitdfb07e990a0d019d7ae9b78dd4260620ce32e79a
tree8463cc6c4b39ca3a466e55fd8cc051cec41d9304
parent6d26c5e4d83cd39006bfd2ecbc97fbfac34aaefa
nfs: add 'noalignwrite' option for lock-less 'lost writes' prevention

There are some applications that write to predefined non-overlapping
file offsets from multiple clients and therefore don't need to rely on
file locking. However, if these applications want non-aligned offsets
and sizes they need to either use locks or risk data corruption, as the
NFS client defaults to extending writes to whole pages.

This commit adds a new mount option `noalignwrite`, which allows to turn
that off and avoid the need of locking, as long as these applications
don't overlap on offsets.

Signed-off-by: Dan Aloni <dan.aloni@vastdata.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
fs/nfs/fs_context.c
fs/nfs/super.c
fs/nfs/write.c
include/linux/nfs_fs_sb.h