linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix oddity where mdadm did not recognise a relative path
@ 2017-01-17 19:07 Wols Lists
  2017-01-29 17:48 ` jes.sorensen
  2017-03-01 22:03 ` jes.sorensen
  0 siblings, 2 replies; 5+ messages in thread
From: Wols Lists @ 2017-01-17 19:07 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 0001-Fix-oddity-where-mdadm-did-not-recognise-a-relative-.patch --]
[-- Type: text/x-patch, Size: 1254 bytes --]

From 4ce784307a9004124392ce48432960d7ca94d0bf Mon Sep 17 00:00:00 2001
From: Wol <anthony@youngman.org.uk>
Date: Tue, 17 Jan 2017 17:47:05 +0000
Subject: [PATCH] Fix oddity where mdadm did not recognise a relative path

mdadm assumed that a pathname started with a "/", while an array
name didn't. This alters the logic so that if the first character
is not a "/" it tries to open an array, and if that fails it drops
through to the pathname code rather than terminating immediately
with an error.

Signed-off-by: Wol <anthony@youngman.org.uk>
---
 mdadm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mdadm.c b/mdadm.c
index c3a265b..b5d89e4 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1899,12 +1899,12 @@ static int misc_list(struct mddev_dev *devlist,
 			rv |= SetAction(dv->devname, c->action);
 			continue;
 		}
-		if (dv->devname[0] == '/')
-			mdfd = open_mddev(dv->devname, 1);
-		else {
-			mdfd = open_dev(dv->devname);
-			if (mdfd < 0)
-				pr_err("Cannot open %s\n", dv->devname);
+		switch(dv->devname[0] == '/') {
+			case 0:
+				mdfd = open_dev(dv->devname);
+				if (mdfd >= 0) break;
+			case 1:
+				mdfd = open_mddev(dv->devname, 1);  
 		}
 		if (mdfd>=0) {
 			switch(dv->disposition) {
-- 
2.7.3


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

* Re: [PATCH] Fix oddity where mdadm did not recognise a relative path
  2017-01-17 19:07 [PATCH] Fix oddity where mdadm did not recognise a relative path Wols Lists
@ 2017-01-29 17:48 ` jes.sorensen
  2017-01-29 18:24   ` Wols Lists
  2017-03-01 22:03 ` jes.sorensen
  1 sibling, 1 reply; 5+ messages in thread
From: jes.sorensen @ 2017-01-29 17:48 UTC (permalink / raw)
  To: Wols Lists; +Cc: linux-raid

Wols Lists <antlists@youngman.org.uk> writes:
> From 4ce784307a9004124392ce48432960d7ca94d0bf Mon Sep 17 00:00:00 2001
> From: Wol <anthony@youngman.org.uk>
> Date: Tue, 17 Jan 2017 17:47:05 +0000
> Subject: [PATCH] Fix oddity where mdadm did not recognise a relative path
>
> mdadm assumed that a pathname started with a "/", while an array
> name didn't. This alters the logic so that if the first character
> is not a "/" it tries to open an array, and if that fails it drops
> through to the pathname code rather than terminating immediately
> with an error.
>
> Signed-off-by: Wol <anthony@youngman.org.uk>
> ---
>  mdadm.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Applied, thanks!

Sorry I have been swamped the last couple of weeks finishing up my old
job and starting the new one. Will be bogged down a lot the next couple
of weeks, so please be patient.

Cheers,
Jes

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

* Re: [PATCH] Fix oddity where mdadm did not recognise a relative path
  2017-01-29 17:48 ` jes.sorensen
@ 2017-01-29 18:24   ` Wols Lists
  0 siblings, 0 replies; 5+ messages in thread
From: Wols Lists @ 2017-01-29 18:24 UTC (permalink / raw)
  Cc: linux-raid

On 29/01/17 17:48, jes.sorensen@gmail.com wrote:
> Wols Lists <antlists@youngman.org.uk> writes:
>> From 4ce784307a9004124392ce48432960d7ca94d0bf Mon Sep 17 00:00:00 2001
>> From: Wol <anthony@youngman.org.uk>
>> Date: Tue, 17 Jan 2017 17:47:05 +0000
>> Subject: [PATCH] Fix oddity where mdadm did not recognise a relative path
>>
>> mdadm assumed that a pathname started with a "/", while an array
>> name didn't. This alters the logic so that if the first character
>> is not a "/" it tries to open an array, and if that fails it drops
>> through to the pathname code rather than terminating immediately
>> with an error.
>>
>> Signed-off-by: Wol <anthony@youngman.org.uk>
>> ---
>>  mdadm.c | 12 ++++++------
>>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> Applied, thanks!
> 
> Sorry I have been swamped the last couple of weeks finishing up my old
> job and starting the new one. Will be bogged down a lot the next couple
> of weeks, so please be patient.
> 
Neil said you were changing jobs - that's fine. I just didn't want it to
get missed, and as there was no initial response I was trying to do as
gentle a "what's up" as I could.

That's fine. If it's in, then great :-) and I can wait for it to be
released whenever.

Cheers,
Wol

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

* Re: [PATCH] Fix oddity where mdadm did not recognise a relative path
  2017-01-17 19:07 [PATCH] Fix oddity where mdadm did not recognise a relative path Wols Lists
  2017-01-29 17:48 ` jes.sorensen
@ 2017-03-01 22:03 ` jes.sorensen
  2017-03-03 18:36   ` Wols Lists
  1 sibling, 1 reply; 5+ messages in thread
From: jes.sorensen @ 2017-03-01 22:03 UTC (permalink / raw)
  To: Wols Lists; +Cc: linux-raid

Wols Lists <antlists@youngman.org.uk> writes:
> From 4ce784307a9004124392ce48432960d7ca94d0bf Mon Sep 17 00:00:00 2001
> From: Wol <anthony@youngman.org.uk>
> Date: Tue, 17 Jan 2017 17:47:05 +0000
> Subject: [PATCH] Fix oddity where mdadm did not recognise a relative path
>
> mdadm assumed that a pathname started with a "/", while an array
> name didn't. This alters the logic so that if the first character
> is not a "/" it tries to open an array, and if that fails it drops
> through to the pathname code rather than terminating immediately
> with an error.
>
> Signed-off-by: Wol <anthony@youngman.org.uk>
> ---
>  mdadm.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/mdadm.c b/mdadm.c
> index c3a265b..b5d89e4 100644
> --- a/mdadm.c
> +++ b/mdadm.c
> @@ -1899,12 +1899,12 @@ static int misc_list(struct mddev_dev *devlist,
>  			rv |= SetAction(dv->devname, c->action);
>  			continue;
>  		}
> -		if (dv->devname[0] == '/')
> -			mdfd = open_mddev(dv->devname, 1);
> -		else {
> -			mdfd = open_dev(dv->devname);
> -			if (mdfd < 0)
> -				pr_err("Cannot open %s\n", dv->devname);
> +		switch(dv->devname[0] == '/') {
> +			case 0:
> +				mdfd = open_dev(dv->devname);
> +				if (mdfd >= 0) break;
> +			case 1:
> +				mdfd = open_mddev(dv->devname, 1);  

I thought this was still pending but going back, it looks like I did
apply it. The problem is I noticed a major issue in the patch, which
doesn't belong in code, it is doing 'if () break' on the same line.

Mind sending me a patch to fix that.

Thanks,
Jes

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

* Re: [PATCH] Fix oddity where mdadm did not recognise a relative path
  2017-03-01 22:03 ` jes.sorensen
@ 2017-03-03 18:36   ` Wols Lists
  0 siblings, 0 replies; 5+ messages in thread
From: Wols Lists @ 2017-03-03 18:36 UTC (permalink / raw)
  To: jes.sorensen; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

> 
> I thought this was still pending but going back, it looks like I did
> apply it. The problem is I noticed a major issue in the patch, which
> doesn't belong in code, it is doing 'if () break' on the same line.

Sorry about that - corporate style and all that :-) but it is important
to not break the standard style.
> 
> Mind sending me a patch to fix that.
> 
> Thanks,
> Jes
> 
Cheers,
Wol

[-- Attachment #2: 0001-Fix-formatting-error.patch --]
[-- Type: text/x-patch, Size: 624 bytes --]

From 945b835cc89fd16279e01f743f8507b80219c8a1 Mon Sep 17 00:00:00 2001
From: Wol <anthony@youngman.org.uk>
Date: Fri, 3 Mar 2017 18:31:52 +0000
Subject: [PATCH] Fix formatting error

---
 mdadm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mdadm.c b/mdadm.c
index b5d89e4..d973ae4 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1902,7 +1902,8 @@ static int misc_list(struct mddev_dev *devlist,
 		switch(dv->devname[0] == '/') {
 			case 0:
 				mdfd = open_dev(dv->devname);
-				if (mdfd >= 0) break;
+				if (mdfd >= 0)
+					break;
 			case 1:
 				mdfd = open_mddev(dv->devname, 1);  
 		}
-- 
2.7.3


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

end of thread, other threads:[~2017-03-03 18:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-17 19:07 [PATCH] Fix oddity where mdadm did not recognise a relative path Wols Lists
2017-01-29 17:48 ` jes.sorensen
2017-01-29 18:24   ` Wols Lists
2017-03-01 22:03 ` jes.sorensen
2017-03-03 18:36   ` Wols Lists

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).