diff options
author | Song Liu <songliubraving@fb.com> | 2017-08-03 19:03:17 +0200 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-08-08 16:42:37 +0200 |
commit | a9501d742127e613d744e29814e9532bacb147e8 (patch) | |
tree | 8f27f82c31b37030a5c15b1bd0227c9d7cb9131e /drivers/md/dm-uevent.h | |
parent | md/r5cache: call mddev_lock/unlock() in r5c_journal_mode_set (diff) | |
download | linux-a9501d742127e613d744e29814e9532bacb147e8.tar.xz linux-a9501d742127e613d744e29814e9532bacb147e8.zip |
md/r5cache: fix io_unit handling in r5l_log_endio()
In r5l_log_endio(), once log->io_list_lock is released, the io unit
may be accessed (or even freed) by other threads. Current code
doesn't handle the io_unit properly, which leads to potential race
conditions.
This patch solves this race condition by:
1. Add a pending_stripe count flush_payload. Multiple flush_payloads
are counted as only one pending_stripe. Flag has_flush_payload is
added to show whether the io unit has flush_payload;
2. In r5l_log_endio(), check flags has_null_flush and
has_flush_payload with log->io_list_lock held. After the lock
is released, this IO unit is only accessed when we know the
pending_stripe counter cannot be zeroed by other threads.
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/dm-uevent.h')
0 files changed, 0 insertions, 0 deletions