Skip to contentSkip to conversation

block: don't return -EINVAL for not found names in devt_from_devname

PATCH Applied Christoph Hellwig 3 participants 3 messages Jun 22, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: don't return -EINVAL for not found names in devt_from_devname

When we didn't find a device and didn't guess it might be a partition, it might still show up later, so don't disable rootwait for it by returning -EINVAL.

Fixes 079caa35f786 ("init: clear root_wait on all invalid root= strings")
---
 block/early-lookup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
block/early-lookup.c +2 -2
index a5be3c68ed079c..9e2d5a19de1b3b 100644
@@ -174,7 +174,7 @@ static int __init devt_from_devname(const char *name, dev_t *devt)
 	while (p > s && isdigit(p[-1]))
 		p--;
 	if (p == s || !*p || *p == '0')
-		return -EINVAL;
+		return -ENODEV;
 
 	/* try disk name without <part number> */
 	part = simple_strtoul(p, NULL, 10);
@@ -185,7 +185,7 @@ static int __init devt_from_devname(const char *name, dev_t *devt)
 
 	/* try disk name without p<part number> */
 	if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
-		return -EINVAL;
+		return -ENODEV;
 	p[-1] = '\0';
 	*devt = blk_lookup_devt(s, part);
 	if (*devt)
Signature · 1 line
2.39.2
maintainer Applied
#1 lore raw
Quoted 5 lines · Christoph Hellwig

When we didn't find a device and didn't guess it might be a partition, it might still show up later, so don't disable rootwait for it by returning -EINVAL.

Applied, thanks!

[1/1] block: don't return -EINVAL for not found names in devt_from_devname

      commit: 648fa60fa7de3ca6f6303e1721591ad73def9cf0

Best regards,

Signature · 1 line
Jens Axboe
Tested-by on v1 1/1
#2 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig

When we didn't find a device and didn't guess it might be a partition, it might still show up later, so don't disable rootwait for it by returning -EINVAL.

Fixes 079caa35f786 ("init: clear root_wait on all invalid root= strings")
Quoted 26 lines
---
  block/early-lookup.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
block/early-lookup.c +2 -2
index a5be3c68ed079c..9e2d5a19de1b3b 100644
@@ -174,7 +174,7 @@ static int __init devt_from_devname(const char *name, dev_t *devt)
  	while (p > s && isdigit(p[-1]))
  		p--;
  	if (p == s || !*p || *p == '0')
-		return -EINVAL;
+		return -ENODEV;
 
  	/* try disk name without <part number> */
  	part = simple_strtoul(p, NULL, 10);
@@ -185,7 +185,7 @@ static int __init devt_from_devname(const char *name, dev_t *devt)
 
  	/* try disk name without p<part number> */
  	if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
-		return -EINVAL;
+		return -ENODEV;
  	p[-1] = '\0';
  	*devt = blk_lookup_devt(s, part);
  	if (*devt)