]> www.infradead.org Git - users/jedix/linux-maple.git/commit
netfs: Downgrade i_rwsem for a buffered write
authorDavid Howells <dhowells@redhat.com>
Wed, 16 Oct 2024 16:28:33 +0000 (17:28 +0100)
committerChristian Brauner <brauner@kernel.org>
Thu, 17 Oct 2024 13:33:42 +0000 (15:33 +0200)
commitd6a77668a708f0b5ca6713b39c178c9d9563c35b
treee52f1914eb0aa35b4ed7266988cb6b9511d0b5ab
parent6ed469df0bfbef3e4b44fca954a781919db9f7ab
netfs: Downgrade i_rwsem for a buffered write

In the I/O locking code borrowed from NFS into netfslib, i_rwsem is held
locked across a buffered write - but this causes a performance regression
in cifs as it excludes buffered reads for the duration (cifs didn't use any
locking for buffered reads).

Mitigate this somewhat by downgrading the i_rwsem to a read lock across the
buffered write.  This at least allows parallel reads to occur whilst
excluding other writes, DIO, truncate and setattr.

Note that this shouldn't be a problem for a buffered write as a read
through an mmap can circumvent i_rwsem anyway.

Also note that we might want to make this change in NFS also.

Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/1317958.1729096113@warthog.procyon.org.uk
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.com>
cc: Trond Myklebust <trondmy@kernel.org>
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-cifs@vger.kernel.org
cc: linux-nfs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/netfs/locking.c