Linux RAID subsystem development
 help / color / mirror / Atom feed
* mdadm: using ioctl to set disk faulty instead of sysfs
@ 2017-11-21 13:09 wuzhouhui
  2017-12-01 20:28 ` Shaohua Li
  2017-12-04  0:34 ` NeilBrown
  0 siblings, 2 replies; 3+ messages in thread
From: wuzhouhui @ 2017-11-21 13:09 UTC (permalink / raw)
  To: linux-raid

Hi, I have a suggest about mdadm to set disk faulty. Since commit 1ca69c4bc4b1ef
(md: avoid taking the mutex on some ioctls) removes lock when set disk faulty,
so we'd better using ioctl(SET_DISK_FAULTY) to set disk faulty, instead of 
echo faulty > /sys/block/<md>/md/dev-<disk>/state, because caller of state's
handler would lock mddev. Like following:

Index: mdadm-4.0/Manage.c
===================================================================
--- mdadm-4.0.orig/Manage.c
+++ mdadm-4.0/Manage.c
@@ -1662,9 +1662,7 @@ int Manage_subdevs(char *devname, int fd
 
 		case 'f': /* set faulty */
 			/* FIXME check current member */
-			if ((sysfd >= 0 && write(sysfd, "faulty", 6) != 6) ||
-			    (sysfd < 0 && ioctl(fd, SET_DISK_FAULTY,
-						rdev))) {
+			if (ioctl(fd, SET_DISK_FAULTY, rdev)) {
 				if (errno == EBUSY)
 					busy = 1;
 				pr_err("set device faulty failed for %s:  %s\n",


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-04  0:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21 13:09 mdadm: using ioctl to set disk faulty instead of sysfs wuzhouhui
2017-12-01 20:28 ` Shaohua Li
2017-12-04  0:34 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox