diff options
author | Song Liu <songliubraving@fb.com> | 2017-08-03 10:03:17 -0700 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-08-08 07:42:37 -0700 |
commit | a9501d742127e613d744e29814e9532bacb147e8 (patch) | |
tree | 8f27f82c31b37030a5c15b1bd0227c9d7cb9131e /drivers/md/md.c | |
parent | b44886c54a999771060371c3a05d5fedfc7e2102 (diff) |
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/md.c')
0 files changed, 0 insertions, 0 deletions