Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH] mdadm: Deprecate the obsolete --auto-detect option
@ 2026-10-15 13:03 Masalkhi, Abd Alrhman
  2026-10-28  9:03 ` Mariusz Tkaczyk
  0 siblings, 1 reply; 5+ messages in thread
From: Masalkhi, Abd Alrhman @ 2026-10-15 13:03 UTC (permalink / raw)
  To: blazej.kucman@graidtech.com, mtkaczyk@kernel.org,
	ncroxon@redhat.com, xni@redhat.com, song@kernel.org,
	yukuai@kernel.org
  Cc: linux-raid@vger.kernel.org, Masalkhi, Abd Alrhman

From: Abd-Alrhman Masalkhi <abd.masalkhi@gatech.edu>

--auto-detect opened md0 (9:0) and issued the RAID_AUTORUN ioctl to ask
the kernel to start the arrays it had auto-detected. The kernel removed
this ioctl in commit d82fa81c2364 ("md: replace the RAID_AUTORUN ioctl
with a direct function call"). Before that, it worked only when md was
built into the kernel. Since then, md_ioctl() has rejected it with
ENOTTY, making --auto-detect ineffective on current kernels.

Remove autodetect(). Keep the option for now to avoid breaking existing
scripts, and print a warning message when it is used.

Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gatech.edu>
---
 Manage.c | 13 -------------
 mdadm.c  |  2 +-
 mdadm.h  |  1 -
 3 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/Manage.c b/Manage.c
index 40d52cfc..d38336a0 100644
--- a/Manage.c
+++ b/Manage.c
@@ -1738,19 +1738,6 @@ abort:
 	return !test && busy ? 2 : 1;
 }
 
-int autodetect(void)
-{
-	/* Open any md device, and issue the RAID_AUTORUN ioctl */
-	int rv = 1;
-	int fd = dev_open("9:0", O_RDONLY);
-	if (fd >= 0) {
-		if (ioctl(fd, RAID_AUTORUN, 0) == 0)
-			rv = 0;
-		close_fd(&fd);
-	}
-	return rv;
-}
-
 int Update_subarray(char *dev, char *subarray, enum update_opt update,
 		    struct mddev_ident *ident, int verbose)
 {
diff --git a/mdadm.c b/mdadm.c
index 2517b037..c4e234e3 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1744,7 +1744,7 @@ int main(int argc, char *argv[])
 			rv = Incremental(devlist, &c, ss);
 		break;
 	case AUTODETECT:
-		autodetect();
+		pr_err("--auto-detect has no effect. It is deprecated and will be removed in future releases.\n");
 		break;
 	}
 	if (ss) {
diff --git a/mdadm.h b/mdadm.h
index deac7a56..985951d3 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -1434,7 +1434,6 @@ extern int Manage_stop(char *devname, int fd, int quiet,
 extern int Manage_subdevs(char *devname, int fd,
 			  struct mddev_dev *devlist, int verbose, int test,
 			  enum update_opt update, int force);
-extern int autodetect(void);
 extern int Grow_Add_device(char *devname, int fd, char *newdev);
 extern int Grow_addbitmap(char *devname, int fd,
 			  struct context *c, struct shape *s);
-- 
2.43.0


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

end of thread, other threads:[~2026-10-28 16:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 13:03 [PATCH] mdadm: Deprecate the obsolete --auto-detect option Masalkhi, Abd Alrhman
2026-10-28  9:03 ` Mariusz Tkaczyk
2026-10-28 12:52   ` Masalkhi, Abd Alrhman
2026-10-28 14:00     ` Mariusz Tkaczyk
2026-10-28 16:37       ` Masalkhi, Abd Alrhman

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