alistair23-linux/fs/btrfs
Filipe David Borba Manana 639eefc8af Btrfs: don't miss skinny extent items on delayed ref head contention
Currently extent-tree.c:btrfs_lookup_extent_info() can miss the lookup
of skinny extent items. This can happen when the execution flow is the
following:

* We do an extent tree lookup and fail to find a skinny extent item;

* As a result, we attempt to see if a non-skinny extent item exists,
  either by looking at previous item in the leaf or by doing another
  full extent tree search;

* We have a transaction and then we check for a matching delayed ref
  head in the transaction's delayed refs rbtree;

* We find such delayed ref head and then we try to lock it with a
  call to mutex_trylock();

* The lock was contended so we jump to the label "again", which repeats
  the extent tree search but for a non-skinny extent item, because we set
  previously metadata variable to 0 and the search key to look for a
  non-skinny extent-item;

* After the jump (and after releasing the transaction's delayed refs
  lock), a skinny extent item might have been added to the extent tree
  but we will miss it because metadata is set to 0 and the search key
  is set for a non-skinny extent-item.

The fix here is to not reset metadata to 0 and to jump to the initial search
key setup if the delayed ref head is contended, instead of jumping directly
to the extent tree search label ("again").

This issue was found while investigating the issue reported at Bugzilla 64961.

David Sterba suspected this function was missing extent items, and that
this could be caused by the last change to this function, which was made
in the following patch:

    [PATCH] Btrfs: optimize btrfs_lookup_extent_info()
    (commit 74be951087)

But in fact this issue already existed before, because after failing to find
a skinny extent item, the code set the search key for a non-skinny extent
item, and on contention of a matching delayed ref head it would not search
the extent tree for a skinny extent item anymore.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
2013-12-12 07:11:58 -08:00
..
tests Btrfs: add a sanity test for a vacant extent at the front of a file 2013-11-11 21:58:19 -05:00
acl.c Btrfs: fix incorrect inode acl reset 2013-11-11 22:02:51 -05:00
async-thread.c Btrfs: fix __btrfs_start_workers retval 2013-11-20 20:42:11 -05:00
async-thread.h Btrfs: eliminate races in worker stopping code 2013-10-04 16:02:13 -04:00
backref.c btrfs: Use WARN_ON()'s return value in place of WARN_ON(1) 2013-11-11 22:11:53 -05:00
backref.h Btrfs: allocate prelim_ref with a slab allocater 2013-09-01 08:16:27 -04:00
btrfs_inode.h Btrfs: improve inode hash function/inode lookup 2013-11-11 21:55:19 -05:00
check-integrity.c Btrfs: print bytenr instead of page pointer in check-int 2013-11-20 20:44:46 -05:00
check-integrity.h Btrfs: add optional integrity check code 2011-12-21 19:14:09 +01:00
compression.c btrfs: Fix checkpatch.pl warning of spacing issues 2013-11-11 22:12:31 -05:00
compression.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
ctree.c btrfs: Fix checkpatch.pl warning of spacing issues 2013-11-11 22:12:31 -05:00
ctree.h Btrfs: remove dead codes from ctree.h 2013-11-20 20:44:45 -05:00
delayed-inode.c btrfs: Replace kmalloc with kmalloc_array 2013-11-11 22:12:22 -05:00
delayed-inode.h [readdir] convert btrfs 2013-06-29 12:57:00 +04:00
delayed-ref.c Btrfs: get rid of sparse warnings 2013-09-01 08:15:50 -04:00
delayed-ref.h Btrfs: handle running extent ops with skinny metadata 2013-05-17 21:40:15 -04:00
dev-replace.c btrfs: fix typo in the log message 2013-11-20 20:44:47 -05:00
dev-replace.h Btrfs: add new sources for device replace code 2012-12-12 17:15:41 -05:00
dir-item.c Btrfs: fix verification of dir_item 2013-11-11 22:10:36 -05:00
disk-io.c Btrfs: avoid heavy operations in btrfs_commit_super 2013-11-20 20:42:16 -05:00
disk-io.h Btrfs: add a sanity test for btrfs_split_item 2013-11-11 21:51:02 -05:00
export.c btrfs: remove fs/btrfs/compat.h 2013-11-11 22:03:19 -05:00
export.h
extent-tree.c Btrfs: don't miss skinny extent items on delayed ref head contention 2013-12-12 07:11:58 -08:00
extent_io.c Btrfs: disable online raid-repair on ro mounts 2013-11-20 20:42:05 -05:00
extent_io.h Btrfs: Simplify the logic in alloc_extent_buffer() for existing extent buffer case 2013-11-11 21:59:11 -05:00
extent_map.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
extent_map.h btrfs: Enclose macros with complex values within parenthesis 2013-11-11 22:12:06 -05:00
file-item.c btrfs: Use WARN_ON()'s return value in place of WARN_ON(1) 2013-11-11 22:11:53 -05:00
file.c btrfs: Fix checkpatch.pl warning of spacing issues 2013-11-11 22:12:31 -05:00
free-space-cache.c btrfs: Fix checkpatch.pl warning of spacing issues 2013-11-11 22:12:31 -05:00
free-space-cache.h Btrfs: remove path arg from btrfs_truncate_free_space_cache 2013-11-11 21:51:33 -05:00
hash.h btrfs: extended inode refs 2012-10-09 09:14:45 -04:00
inode-item.c btrfs: drop unused parameter from btrfs_item_nr 2013-11-11 21:50:48 -05:00
inode-map.c btrfs: Use WARN_ON()'s return value in place of WARN_ON(1) 2013-11-11 22:11:53 -05:00
inode-map.h Btrfs: Support reading/writing on disk free ino cache 2011-04-25 16:46:11 +08:00
inode.c btrfs: Use trace condition for get_extent tracepoint 2013-11-20 20:44:47 -05:00
ioctl.c btrfs: call mnt_drop_write after interrupted subvol deletion 2013-12-12 07:11:38 -08:00
Kconfig btrfs: update kconfig help text 2013-11-20 20:49:09 -05:00
locking.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
locking.h Btrfs: remove btrfs_try_spin_lock 2013-03-14 14:57:10 -04:00
lzo.c Btrfs: return -1 when lzo compression makes data bigger 2013-09-01 07:57:19 -04:00
Makefile Btrfs: add tests for btrfs_get_extent 2013-11-11 21:57:30 -05:00
math.h Btrfs: cleanup duplicated division functions 2012-12-11 13:31:30 -05:00
ordered-data.c Btrfs: fix list delete warning when removing ordered root from the list 2013-11-20 20:44:46 -05:00
ordered-data.h Btrfs: don't wait for the completion of all the ordered extents 2013-11-11 22:13:44 -05:00
orphan.c btrfs: replace many BUG_ONs with proper error handling 2012-03-22 11:52:54 +01:00
print-tree.c btrfs: drop unused parameter from btrfs_item_nr 2013-11-11 21:50:48 -05:00
print-tree.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
qgroup.c Btrfs: Remove superfluous casts from u64 to unsigned long long 2013-09-01 08:16:08 -04:00
raid56.c btrfs: remove fs/btrfs/compat.h 2013-11-11 22:03:19 -05:00
raid56.h Btrfs: RAID5 and RAID6 2013-02-01 14:24:23 -05:00
rcu-string.h Btrfs: use rcu to protect device->name 2012-06-14 21:29:16 -04:00
reada.c Btrfs: fix reada debug code compilation 2013-05-06 15:54:55 -04:00
relocation.c Btrfs: rename btrfs_start_all_delalloc_inodes 2013-11-11 22:13:58 -05:00
root-tree.c Btrfs: insert orphan roots into fs radix tree 2013-10-10 21:30:53 -04:00
scrub.c Btrfs: do not inc uncorrectable_errors counter on ro scrubs 2013-11-20 20:41:38 -05:00
send.c Btrfs: check file extent type before anything else 2013-11-11 22:12:49 -05:00
send.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
struct-funcs.c Btrfs: rewrite BTRFS_SETGET_FUNCS 2012-07-23 16:28:06 -04:00
super.c Btrfs: don't clear the default compression type 2013-12-12 07:11:19 -08:00
sysfs.c btrfs: fixup/remove module.h usage as required 2013-03-01 15:01:01 -05:00
transaction.c Btrfs: fix lockdep error in async commit 2013-11-20 20:44:44 -05:00
transaction.h Btrfs: fix BUG_ON() casued by the reserved space migration 2013-11-11 21:54:28 -05:00
tree-defrag.c Btrfs: cleanup dead code of defragment 2013-11-11 21:59:45 -05:00
tree-log.c Btrfs: only drop modified extents if we logged the whole inode 2013-11-20 20:41:32 -05:00
tree-log.h btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
ulist.c Btrfs: fix crash regarding to ulist_add_merge 2013-07-02 11:50:59 -04:00
ulist.h Btrfs: add a rb_tree to improve performance of ulist search 2013-05-06 15:54:44 -04:00
uuid-tree.c Btrfs: remove unused max_key arg from btrfs_search_forward 2013-11-11 21:54:57 -05:00
volumes.c btrfs: fix bio_size_ok() for max_sectors > 0xffff 2013-11-20 20:48:44 -05:00
volumes.h btrfs: Pack struct btrfs_device 2013-11-11 22:11:26 -05:00
xattr.c btrfs: make static code static & remove dead code 2013-05-06 15:55:23 -04:00
xattr.h fs/vfs/security: pass last path component to LSM on inode creation 2011-02-01 11:12:29 -05:00
zlib.c btrfs: fix message printing 2012-10-09 09:19:57 -04:00