]> www.infradead.org Git - users/jedix/linux-maple.git/commit
Btrfs: deal with duplciates during extent_map insertion in btrfs_get_extent
authorChris Mason <clm@fb.com>
Sat, 19 Sep 2015 18:28:25 +0000 (11:28 -0700)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 1 Feb 2018 23:32:46 +0000 (15:32 -0800)
commit54148c1a0db0cb5e2bb5fc6618baf9c5939db22c
treeafbca7a3d77959ee957ec79818e69fb934e33d64
parentb30d130c4e00d6fcb9a63e91e660d952f9cdf2c6
Btrfs: deal with duplciates during extent_map insertion in btrfs_get_extent

Orabug: 27446668

When dealing with inline extents, btrfs_get_extent will incorrectly try
to insert a duplicate extent_map.  The dup hits -EEXIST from
add_extent_map, but then we try to merge with the existing one and end
up trying to insert a zero length extent_map.

This actually works most of the time, except when there are extent maps
past the end of the inline extent.  rocksdb will trigger this sometimes
because it preallocates an extent and then truncates down.

Josef made a script to trigger with xfs_io:

#!/bin/bash

xfs_io -f -c "pwrite 0 1000" inline
xfs_io -c "falloc -k 4k 1M" inline
xfs_io -c "pread 0 1000" -c "fadvise -d 0 1000" -c "pread 0 1000" inline
xfs_io -c "fadvise -d 0 1000" inline
cat inline

You'll get EIOs trying to read inline after this because add_extent_map
is returning EEXIST

Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit 8dff9c85341032767d7b519217a79ea04cd676b0)
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
fs/btrfs/inode.c