On Thu, Aug 29, 2024 at 07:22:19AM -0700, Darrick J. Wong wrote: > On Thu, Aug 29, 2024 at 05:46:26AM +0200, Christoph Hellwig wrote: > > On Wed, Aug 28, 2024 at 09:13:38AM -0700, Darrick J. Wong wrote: > > > Though we might have to revisit this for filesystems that don't take > > > i_rwsem exclusively when writing -- is that a problem? I guess if you > > > had two threads both writing and punching the pagecache they could get > > > into trouble, but that might be a case of "if it hurts don't do that". > > > > No i_rwsem for buffered writes? You can't really do that without hell > > breaking lose. At least not without another exclusive lock. > > Well, i_rwsem in shared mode. ISTR ext4 does inode_lock_shared and > serializes on the folio lock, at least for non extending writes. ext4 uses plain inode lock/unlock which is an exclusive i_rwsem. Given that Posix requires the entire write to synchronized vs other writes applications would break otherwise.