mbox series

[0/14,v3] BTRFS DIO inode locking/D_SYNC fix

Message ID 20200924163922.2547-1-rgoldwyn@suse.de (mailing list archive)
Headers show
Series BTRFS DIO inode locking/D_SYNC fix | expand

Message

Goldwyn Rodrigues Sept. 24, 2020, 4:39 p.m. UTC
This series attempts to arrange inode locking and unlocking to be more
aligned to ext4 and xfs handling of things, and makes it simpler in
logic. The main goal is to have shared inode lock for direct reads and
direct writes within EOF to make sure we do not race with truncate.

I have merged two series here:
(1) Using inode_lock_shared for <EOF DIO writes
(2) Fix O_DSYNC | O_DIRECT

Both require inode locking to be pushed closer to I/O calls and thought
was relevant. (2) requires changes in iomap code.

Tested xfstests on btrfs, ext4 and xfs

Git: https://github.com/goldwynr/linux/tree/btrfs-inode-lock

Changes since v1:

 - Changed fix for deadlock due to O_DSYNC (iomap patches added)
 - btrfs_inode_lock() shifted to inode.c
 - Reinstated lockdep_assert_held() in iomap_dio_rw()

Changes since v2:
 - Review comments incorporated:
   - comments got BTRFS_SUPER_FLAG_ERROR deleted
   - Function comments for btrfs_inode_lock()/unlock()
   - Unsetting current->backing_dev_info
 - Corrected ret from __iomap_dio_rw()
 - Removed unused err in btrfs_file_write_iter()

--
Goldwyn