]> git.hungrycats.org Git - linux/commit
Btrfs, raid56: fix use-after-free problem in the final device replace procedure on...
authorMiao Xie <miaox@cn.fujitsu.com>
Tue, 25 Nov 2014 08:39:28 +0000 (16:39 +0800)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Sun, 14 Dec 2014 03:36:08 +0000 (22:36 -0500)
commit0322be44aba7bd20aaf8395420bd9f8be2fe0846
treed574c16433520206e0a07f47f734ef8dad38f02c
parentf7481407c58e3e854d65a94f237f8ec8e14cfa0a
Btrfs, raid56: fix use-after-free problem in the final device replace procedure on raid56

The commit c404e0dc (Btrfs: fix use-after-free in the finishing
procedure of the device replace) fixed a use-after-free problem
which happened when removing the source device at the end of device
replace, but at that time, btrfs didn't support device replace
on raid56, so we didn't fix the problem on the raid56 profile.
Currently, we implemented device replace for raid56, so we need
kick that problem out before we enable that function for raid56.

The fix method is very simple, we just increase the bio per-cpu
counter before we submit a raid56 io, and decrease the counter
when the raid56 io ends.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
(cherry picked from commit 4245215d6a8dba1a51c50533b6667919687c0b89)
fs/btrfs/ctree.h
fs/btrfs/dev-replace.c
fs/btrfs/raid56.c
fs/btrfs/raid56.h
fs/btrfs/scrub.c
fs/btrfs/volumes.c