Skip to content

Commit c331eb0

Browse files
neilbrownLinus Torvalds
authored andcommitted
[PATCH] md: Fix badness in sysfs_notify caused by md_new_event
From: NeilBrown <neilb@suse.de> If an error is reported by a drive in a RAID array (which is done via bi_end_io - in interrupt context), we call md_error and md_new_event which calls sysfs_notify. However sysfs_notify grabs a mutex and so cannot be called in interrupt context. This patch just creates a variant of md_new_event which avoids the sysfs call, and uses that. A better fix for later is to arrange for the event to be called from user-context. Note: avoiding the sysfs call isn't a problem as an error will not, by itself, modify the sync_action attribute. (We do still need to wake_up(&md_event_waiters) as an error by itself will modify /proc/mdstat). Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent a835fa7 commit c331eb0

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎drivers/md/md.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ void md_new_event(mddev_t *mddev)
167167
}
168168
EXPORT_SYMBOL_GPL(md_new_event);
169169

170+
/* Alternate version that can be called from interrupts
171+
* when calling sysfs_notify isn't needed.
172+
*/
173+
void md_new_event_inintr(mddev_t *mddev)
174+
{
175+
atomic_inc(&md_event_count);
176+
wake_up(&md_event_waiters);
177+
}
178+
170179
/*
171180
* Enables to iterate over all existing md arrays
172181
* all_mddevs_lock protects this list.
@@ -4149,7 +4158,7 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev)
41494158
set_bit(MD_RECOVERY_INTR, &mddev->recovery);
41504159
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
41514160
md_wakeup_thread(mddev->thread);
4152-
md_new_event(mddev);
4161+
md_new_event_inintr(mddev);
41534162
}
41544163

41554164
/* seq_file implementation /proc/mdstat */

0 commit comments

Comments
 (0)