btrfs: release old extent maps during page release
authorFilipe Manana <fdmanana@suse.com>
Wed, 22 Jul 2020 11:28:52 +0000 (12:28 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 27 Jul 2020 10:55:48 +0000 (12:55 +0200)
commitfbc2bd7e7ab95704a96dade6a7d00ea99a68b015
tree2a0b0a7b98e485914c1e762eab854fdb3c509cd3
parent3d6448e631591756da36efb3ea6355ff6f383c3a
btrfs: release old extent maps during page release

When removing an extent map at try_release_extent_mapping(), called through
the page release callback (btrfs_releasepage()), we never release an extent
map that is in the list of modified extents. This is to prevent races with
a concurrent fsync using the fast path, which could lead to not logging an
extent created in the current transaction.

However we can safely remove an extent map created in a past transaction
that is still in the list of modified extents (because no one fsynced yet
the inode after that transaction got commited), because such extents are
skipped during an fsync as it is pointless to log them. This change does
that.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c