linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] FIX: chunk_size cannot be read by mdstat
@ 2010-11-29  9:56 Adam Kwolek
  2010-11-29 14:26 ` Kwolek, Adam
  2010-11-30  0:22 ` Neil Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Kwolek @ 2010-11-29  9:56 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, dan.j.williams, ed.ciechanowski

Chunk size is not read by mdstat due to too week checking of 'check' string in mdstat.
It is the same result for 'check' and 'chunk_size' check.

Add  string length additional condition for checking.

Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
---

 mdstat.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/mdstat.c b/mdstat.c
index bb030bf..5f69e31 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -248,7 +248,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
 				else
 					ent->resync = 0;
 			} else if (ent->percent == -1 &&
-				   (w[0] == 'r' || w[0] == 'c')) {
+				   (w[0] == 'r' ||
+				    ((w[0] == 'c') && strlen(w) < 9))) {
 				if (strncmp(w, "resync", 4)==0)
 					ent->resync = 1;
 				if (strncmp(w, "reshape", 7)==0)


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

* RE: [PATCH] FIX: chunk_size cannot be read by mdstat
  2010-11-29  9:56 [PATCH] FIX: chunk_size cannot be read by mdstat Adam Kwolek
@ 2010-11-29 14:26 ` Kwolek, Adam
  2010-11-30  0:22 ` Neil Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Kwolek, Adam @ 2010-11-29 14:26 UTC (permalink / raw)
  To: Kwolek, Adam, neilb@suse.de
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed

I've found that condition on strlen() doesn't always work (I wanted to achieve the same code style ;)),
so check for "check" string has to be used instead.

BR
Adam


> -----Original Message-----
> From: linux-raid-owner@vger.kernel.org [mailto:linux-raid-
> owner@vger.kernel.org] On Behalf Of Adam Kwolek
> Sent: Monday, November 29, 2010 10:57 AM
> To: neilb@suse.de
> Cc: linux-raid@vger.kernel.org; Williams, Dan J; Ciechanowski, Ed
> Subject: [PATCH] FIX: chunk_size cannot be read by mdstat
> 
> Chunk size is not read by mdstat due to too week checking of 'check'
> string in mdstat.
> It is the same result for 'check' and 'chunk_size' check.
> 
> Add  string length additional condition for checking.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  mdstat.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/mdstat.c b/mdstat.c
> index bb030bf..5f69e31 100644
> --- a/mdstat.c
> +++ b/mdstat.c
> @@ -248,7 +248,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
>  				else
>  					ent->resync = 0;
>  			} else if (ent->percent == -1 &&
> -				   (w[0] == 'r' || w[0] == 'c')) {
> +				   (w[0] == 'r' ||
> +				    ((w[0] == 'c') && strlen(w) < 9))) {
>  				if (strncmp(w, "resync", 4)==0)
>  					ent->resync = 1;
>  				if (strncmp(w, "reshape", 7)==0)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] FIX: chunk_size cannot be read by mdstat
  2010-11-29  9:56 [PATCH] FIX: chunk_size cannot be read by mdstat Adam Kwolek
  2010-11-29 14:26 ` Kwolek, Adam
@ 2010-11-30  0:22 ` Neil Brown
  2010-11-30  7:28   ` Kwolek, Adam
  1 sibling, 1 reply; 5+ messages in thread
From: Neil Brown @ 2010-11-30  0:22 UTC (permalink / raw)
  To: Adam Kwolek; +Cc: linux-raid, dan.j.williams, ed.ciechanowski

On Mon, 29 Nov 2010 10:56:50 +0100 Adam Kwolek <adam.kwolek@intel.com> wrote:

> Chunk size is not read by mdstat due to too week checking of 'check' string in mdstat.
> It is the same result for 'check' and 'chunk_size' check.

Actually chunk size is not read because there is no code to try to read it.
The chunk size needs to be reported by the personality, and they are
inconsistent in the way they report it so it is much easier to just ignore it.
GET_ARRAY_INFO gets the chunk size easily, so we stick with that when chunk
size is needed.

Thanks,
NeilBrown



> 
> Add  string length additional condition for checking.
> 
> Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> ---
> 
>  mdstat.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/mdstat.c b/mdstat.c
> index bb030bf..5f69e31 100644
> --- a/mdstat.c
> +++ b/mdstat.c
> @@ -248,7 +248,8 @@ struct mdstat_ent *mdstat_read(int hold, int start)
>  				else
>  					ent->resync = 0;
>  			} else if (ent->percent == -1 &&
> -				   (w[0] == 'r' || w[0] == 'c')) {
> +				   (w[0] == 'r' ||
> +				    ((w[0] == 'c') && strlen(w) < 9))) {
>  				if (strncmp(w, "resync", 4)==0)
>  					ent->resync = 1;
>  				if (strncmp(w, "reshape", 7)==0)


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

* RE: [PATCH] FIX: chunk_size cannot be read by mdstat
  2010-11-30  0:22 ` Neil Brown
@ 2010-11-30  7:28   ` Kwolek, Adam
  2010-11-30  7:36     ` Neil Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Kwolek, Adam @ 2010-11-30  7:28 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed

In such case code: 
	a->info.array.chunk_size = mdstat->chunk_size;

from managemon.c, function manage_member() 
has to be removed or guarded for 0 value of mdstat->chunk_size as it corrupts information in active array.

BR
Adam




> -----Original Message-----
> From: Neil Brown [mailto:neilb@suse.de]
> Sent: Tuesday, November 30, 2010 1:22 AM
> To: Kwolek, Adam
> Cc: linux-raid@vger.kernel.org; Williams, Dan J; Ciechanowski, Ed
> Subject: Re: [PATCH] FIX: chunk_size cannot be read by mdstat
> 
> On Mon, 29 Nov 2010 10:56:50 +0100 Adam Kwolek <adam.kwolek@intel.com>
> wrote:
> 
> > Chunk size is not read by mdstat due to too week checking of 'check'
> string in mdstat.
> > It is the same result for 'check' and 'chunk_size' check.
> 
> Actually chunk size is not read because there is no code to try to read
> it.
> The chunk size needs to be reported by the personality, and they are
> inconsistent in the way they report it so it is much easier to just
> ignore it.
> GET_ARRAY_INFO gets the chunk size easily, so we stick with that when
> chunk
> size is needed.
> 
> Thanks,
> NeilBrown
> 
> 
> 
> >
> > Add  string length additional condition for checking.
> >
> > Signed-off-by: Adam Kwolek <adam.kwolek@intel.com>
> > ---
> >
> >  mdstat.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/mdstat.c b/mdstat.c
> > index bb030bf..5f69e31 100644
> > --- a/mdstat.c
> > +++ b/mdstat.c
> > @@ -248,7 +248,8 @@ struct mdstat_ent *mdstat_read(int hold, int
> start)
> >  				else
> >  					ent->resync = 0;
> >  			} else if (ent->percent == -1 &&
> > -				   (w[0] == 'r' || w[0] == 'c')) {
> > +				   (w[0] == 'r' ||
> > +				    ((w[0] == 'c') && strlen(w) < 9))) {
> >  				if (strncmp(w, "resync", 4)==0)
> >  					ent->resync = 1;
> >  				if (strncmp(w, "reshape", 7)==0)


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

* Re: [PATCH] FIX: chunk_size cannot be read by mdstat
  2010-11-30  7:28   ` Kwolek, Adam
@ 2010-11-30  7:36     ` Neil Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Neil Brown @ 2010-11-30  7:36 UTC (permalink / raw)
  To: Kwolek, Adam
  Cc: linux-raid@vger.kernel.org, Williams, Dan J, Ciechanowski, Ed

On Tue, 30 Nov 2010 07:28:01 +0000 "Kwolek, Adam" <adam.kwolek@intel.com>
wrote:

> In such case code: 
> 	a->info.array.chunk_size = mdstat->chunk_size;
> 
> from managemon.c, function manage_member() 
> has to be removed or guarded for 0 value of mdstat->chunk_size as it corrupts information in active array.
> 

Good point.  I have removed that assignment, and removed the chunk_size field
from mdstat_ent.

Thanks,
NeilBrown


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

end of thread, other threads:[~2010-11-30  7:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-29  9:56 [PATCH] FIX: chunk_size cannot be read by mdstat Adam Kwolek
2010-11-29 14:26 ` Kwolek, Adam
2010-11-30  0:22 ` Neil Brown
2010-11-30  7:28   ` Kwolek, Adam
2010-11-30  7:36     ` Neil Brown

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).