Home
last modified time | relevance | path

Searched hist:a9501d742127e613d744e29814e9532bacb147e8 (Results 1 – 1 of 1) sorted by relevance

/linux/drivers/md/
H A Draid5-cache.cdiff a9501d742127e613d744e29814e9532bacb147e8 Thu Aug 03 19:03:17 CEST 2017 Song Liu <songliubraving@fb.com> 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>