Re: [dm-devel] [PATCH -next v2 2/6] md: refactor action_store() for 'idle' and 'frozen'

From
Xiao Ni <hidden>
Date
2023-06-13 14:15:37
Also in
dm-devel, lkml
Reply to
Yu Kuai, 2023-06-13
在 2023/6/13 下午8:44, Yu Kuai 写道:
Hi,

在 2023/06/13 20:25, Xiao Ni 写道:
quoted
On Tue, Jun 13, 2023 at 8:00 PM Yu Kuai [off-list ref] wrote:
quoted
Hi,

在 2023/06/13 16:02, Xiao Ni 写道:
quoted
在 2023/5/29 下午9:20, Yu Kuai 写道:
quoted
From: Yu Kuai <redacted>

Prepare to handle 'idle' and 'frozen' differently to fix a deadlock,
there
are no functional changes except that MD_RECOVERY_RUNNING is checked
again after 'reconfig_mutex' is held.

Can you explain more about why it needs to check MD_RECOVERY_RUNNING
again here?
As I explain in the following comment:
Hi

Who can clear the flag before the lock is held?
Basically every where that can clear the flag...

// This context     // Other context
            mutex_lock
            ...
test_bit -> pass
            clear_bit
            mutex_unlock
mutex_lock
test_bit -> check again

Thanks,
Kuai
At first, I wanted to figure out a specific case. Now I have the answer. Maybe there are two people that want to stop

the sync action at the same time. So this is the case that can be checked by the codes.

Regards

Xiao
quoted
Regards
Xiao
quoted
quoted
quoted
+    /*
+     * Check again in case MD_RECOVERY_RUNNING is cleared before lock is
+     * held.
+     */
+    if (!test_bit(MD_RECOVERY_RUNNING, &mddev->recovery)) {
+        mddev_unlock(mddev);
+        return;
+    }
Thanks,
Kuai
.
  
Thread (37 messages) 37 messages, 3 authors, last reply 2023-06-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help