Skip to content

Commit c622ca5

Browse files
apaszkieshligit
authored andcommitted
md: don't print the same repeated messages about delayed sync operation
This fixes a long-standing bug that caused a flood of messages like: "md: delaying data-check of md1 until md2 has finished (they share one or more physical units)" It can be reproduced like this: 1. Create at least 3 raid1 arrays on a pair of disks, each on different partitions. 2. Request a sync operation like 'check' or 'repair' on 2 arrays by writing to their md/sync_action attribute files. One operation should start and one should be delayed and a message like the above will be printed. 3. Issue a write to the third array. Each write will cause 2 copies of the message to be printed. This happens when wake_up(&resync_wait) is called, usually by md_check_recovery(). Then the delayed sync thread again prints the message and is put to sleep. This patch adds a check in md_do_sync() to prevent printing this message more than once for the same pair of devices. Reported-by: Sven Koehler <[email protected]> Link: https://bugzilla.kernel.org/show_bug.cgi?id=151801 Signed-off-by: Artur Paszkiewicz <[email protected]> Signed-off-by: Shaohua Li <[email protected]>
1 parent 207efcd commit c622ca5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/md/md.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7865,6 +7865,7 @@ void md_do_sync(struct md_thread *thread)
78657865
*/
78667866

78677867
do {
7868+
int mddev2_minor = -1;
78687869
mddev->curr_resync = 2;
78697870

78707871
try_again:
@@ -7894,10 +7895,14 @@ void md_do_sync(struct md_thread *thread)
78947895
prepare_to_wait(&resync_wait, &wq, TASK_INTERRUPTIBLE);
78957896
if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery) &&
78967897
mddev2->curr_resync >= mddev->curr_resync) {
7897-
printk(KERN_INFO "md: delaying %s of %s"
7898-
" until %s has finished (they"
7899-
" share one or more physical units)\n",
7900-
desc, mdname(mddev), mdname(mddev2));
7898+
if (mddev2_minor != mddev2->md_minor) {
7899+
mddev2_minor = mddev2->md_minor;
7900+
printk(KERN_INFO "md: delaying %s of %s"
7901+
" until %s has finished (they"
7902+
" share one or more physical units)\n",
7903+
desc, mdname(mddev),
7904+
mdname(mddev2));
7905+
}
79017906
mddev_put(mddev2);
79027907
if (signal_pending(current))
79037908
flush_signals(current);

0 commit comments

Comments
 (0)