Filipe Manana
51a60253a5
Btrfs: send, fix incorrect ref access when using extrefs
When running send, if an inode only has extended reference items
associated to it and no regular references, send.c:get_first_ref()
was incorrectly assuming the reference it found was of type
BTRFS_INODE_REF_KEY due to use of the wrong key variable.
This caused weird behaviour when using the found item has a regular
reference, such as weird path string, and occasionally (when lucky)
a crash:
[ 190.600652] general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
[ 190.600994] Modules linked in: btrfs xor raid6_pq binfmt_misc nfsd auth_rpcgss oid_registry nfs_acl nfs lockd fscache sunrpc psmouse serio_raw evbug pcspkr i2c_piix4 e1000 floppy
[ 190.602565] CPU: 2 PID: 14520 Comm: btrfs Not tainted 3.13.0-fdm-btrfs-next-26+ #1
[ 190.602728] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 190.602868] task: ffff8800d447c920 ti: ffff8801fa79e000 task.ti: ffff8801fa79e000
[ 190.603030] RIP: 0010:[<ffffffff813266b4>] [<ffffffff813266b4>] memcpy+0x54/0x110
[ 190.603262] RSP: 0018:ffff8801fa79f880 EFLAGS: 00010202
[ 190.603395] RAX: ffff8800d4326e3f RBX: 000000000000036a RCX: ffff880000000000
[ 190.603553] RDX: 000000000000032a RSI: ffe708844042936a RDI: ffff8800d43271a9
[ 190.603710] RBP: ffff8801fa79f8c8 R08: 00000000003a4ef0 R09: 0000000000000000
[ 190.603867] R10: 793a4ef09f000000 R11: 9f0000000053726f R12: ffff8800d43271a9
[ 190.604020] R13: 0000160000000000 R14: ffff8802110134f0 R15: 000000000000036a
[ 190.604020] FS: 00007fb423d09b80(0000) GS:ffff880216200000(0000) knlGS:0000000000000000
[ 190.604020] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 190.604020] CR2: 00007fb4229d4b78 CR3: 00000001f5d76000 CR4: 00000000000006e0
[ 190.604020] Stack:
[ 190.604020] ffffffffa01f4d49 ffff8801fa79f8f0 00000000000009f9 ffff8801fa79f8c8
[ 190.604020] 00000000000009f9 ffff880211013260 000000000000f971 ffff88021147dba8
[ 190.604020] 00000000000009f9 ffff8801fa79f918 ffffffffa02367f5 ffff8801fa79f928
[ 190.604020] Call Trace:
[ 190.604020] [<ffffffffa01f4d49>] ? read_extent_buffer+0xb9/0x120 [btrfs]
[ 190.604020] [<ffffffffa02367f5>] fs_path_add_from_extent_buffer+0x45/0x60 [btrfs]
[ 190.604020] [<ffffffffa0238806>] get_first_ref+0x1f6/0x210 [btrfs]
[ 190.604020] [<ffffffffa0238994>] __get_cur_name_and_parent+0x174/0x3a0 [btrfs]
[ 190.604020] [<ffffffff8118df3d>] ? kmem_cache_alloc_trace+0x11d/0x1e0
[ 190.604020] [<ffffffffa0236674>] ? fs_path_alloc+0x24/0x60 [btrfs]
[ 190.604020] [<ffffffffa0238c91>] get_cur_path+0xd1/0x240 [btrfs]
(...)
Steps to reproduce (either crash or some weirdness like an odd path string):
mkfs.btrfs -f -O extref /dev/sdd
mount /dev/sdd /mnt
mkdir /mnt/testdir
touch /mnt/testdir/foobar
for i in `seq 1 2550`; do
ln /mnt/testdir/foobar /mnt/testdir/foobar_link_`printf "%04d" $i`
done
ln /mnt/testdir/foobar /mnt/testdir/final_foobar_name
rm -f /mnt/testdir/foobar
for i in `seq 1 2550`; do
rm -f /mnt/testdir/foobar_link_`printf "%04d" $i`
done
btrfs subvolume snapshot -r /mnt /mnt/mysnap
btrfs send /mnt/mysnap -f /tmp/mysnap.send
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Chris Mason <clm@fb.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
2014-05-20 10:18:26 -07:00
..
2014-01-28 13:20:05 -08:00
2014-01-28 13:19:50 -08:00
2014-04-07 10:41:52 -07:00
2014-03-20 17:15:28 -07:00
2014-04-06 17:39:30 -07:00
2013-09-01 08:16:27 -04:00
2014-03-10 15:16:42 -04:00
2014-02-03 09:01:27 -08:00
2013-11-24 16:33:41 -07:00
2014-02-08 17:57:15 -08:00
2013-05-06 15:55:23 -04:00
2014-04-07 09:08:39 -07:00
2014-04-24 16:43:32 -07:00
2014-03-10 15:17:16 -04:00
2014-01-28 13:20:09 -08:00
2014-03-20 17:15:28 -07:00
2014-01-28 13:20:25 -08:00
2014-03-10 15:17:27 -04:00
2012-12-12 17:15:41 -05:00
2014-01-28 13:20:05 -08:00
2014-04-24 16:43:32 -07:00
2013-11-11 21:51:02 -05:00
2013-11-11 22:03:19 -05:00
2008-09-25 11:04:06 -04:00
2014-04-07 09:08:47 -07:00
2014-04-06 17:34:37 -07:00
2014-03-10 15:16:57 -04:00
2014-03-10 15:16:57 -04:00
2014-04-24 16:43:33 -07:00
2014-01-28 13:20:05 -08:00
2014-04-24 16:43:32 -07:00
2014-01-28 13:20:05 -08:00
2013-11-11 21:51:33 -05:00
2014-01-28 13:20:31 -08:00
2014-01-28 13:20:31 -08:00
2014-01-28 13:19:39 -08:00
2014-04-24 16:43:33 -07:00
2011-04-25 16:46:11 +08:00
2014-04-07 09:08:50 -07:00
2014-05-20 10:17:48 -07:00
2014-01-28 13:20:31 -08:00
2013-05-06 15:55:23 -04:00
2013-03-14 14:57:10 -04:00
2014-01-28 13:20:05 -08:00
2014-01-28 13:20:31 -08:00
2012-12-11 13:31:30 -05:00
2014-03-10 15:17:28 -04:00
2014-03-10 15:17:16 -04:00
2014-01-28 13:19:37 -08:00
2014-01-29 07:06:29 -08:00
2013-05-06 15:55:23 -04:00
2014-01-28 13:20:24 -08:00
2014-01-28 13:20:24 -08:00
2014-03-10 15:17:16 -04:00
2014-03-10 15:17:16 -04:00
2013-02-01 14:24:23 -05:00
2012-06-14 21:29:16 -04:00
2014-03-10 15:17:16 -04:00
2014-04-06 17:34:35 -07:00
2014-03-10 15:16:51 -04:00
2014-04-11 06:35:50 -07:00
2014-05-20 10:18:26 -07:00
2013-05-06 15:55:23 -04:00
2012-07-23 16:28:06 -04:00
2014-04-24 16:43:32 -07:00
2014-03-10 15:15:51 -04:00
2014-03-10 15:15:51 -04:00
2014-04-06 17:39:30 -07:00
2014-04-06 17:39:30 -07:00
2013-11-11 21:59:45 -05:00
2014-03-10 15:16:44 -04:00
2014-03-10 15:16:43 -04:00
2014-01-29 07:06:27 -08:00
2014-01-29 07:06:27 -08:00
2014-01-28 13:20:05 -08:00
2014-04-07 09:08:41 -07:00
2014-03-10 15:17:16 -04:00
2014-01-28 13:20:24 -08:00
2011-02-01 11:12:29 -05:00
2014-01-28 13:20:05 -08:00