diff options
author | Filipe Manana <fdmanana@suse.com> | 2020-06-15 20:46:01 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2020-06-16 20:22:27 +0300 |
commit | f2cb2f39ccc30fa13d3ac078d461031a63960e5b (patch) | |
tree | 10e3e1bb30ead913de9ca2b878d0a775059110a1 /include/linux/compiler_attributes.h | |
parent | e7a79811d0db136dc2d336b56d54cf1b774ce972 (diff) | |
download | linux-f2cb2f39ccc30fa13d3ac078d461031a63960e5b.tar.xz |
btrfs: fix hang on snapshot creation after RWF_NOWAIT write
If we do a successful RWF_NOWAIT write we end up locking the snapshot lock
of the inode, through a call to check_can_nocow(), but we never unlock it.
This means the next attempt to create a snapshot on the subvolume will
hang forever.
Trivial reproducer:
$ mkfs.btrfs -f /dev/sdb
$ mount /dev/sdb /mnt
$ touch /mnt/foobar
$ chattr +C /mnt/foobar
$ xfs_io -d -c "pwrite -S 0xab 0 64K" /mnt/foobar
$ xfs_io -d -c "pwrite -N -V 1 -S 0xfe 0 64K" /mnt/foobar
$ btrfs subvolume snapshot -r /mnt /mnt/snap
--> hangs
Fix this by unlocking the snapshot lock if check_can_nocow() returned
success.
Fixes: edf064e7c6fec3 ("btrfs: nowait aio support")
CC: stable@vger.kernel.org # 4.14+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'include/linux/compiler_attributes.h')
0 files changed, 0 insertions, 0 deletions