[dm-devel] rdac.c patch not quite right.

Malahal Naineni malahal at us.ibm.com
Thu Dec 9 15:17:42 UTC 2010


Chauhan, Vijay [Vijay.Chauhan at lsi.com] wrote:
> On Thurs December 09, 2010 3:10 AM, Malahal Naineni Wrote:
> > > -	} else if ((inq.PQ_PDT & 0x20) || (inq.PQ_PDT & 0x7f)) {
> > > +	} else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x7f)) {
> > >  		/* LUN not connected*/
> > >  		ret = PATH_DOWN;
> > >  		goto done;
> > 
> > I think this new patch has the same issue as the old one. In  other
> > words, the second expression in the parenthesis is true if the first one
> > is true. So you could as well just use the second expression. If you
> > really want to use PQ as well as PDT with separate checks, you can do
> > something like this:
> > 
> > 
> > 	} else if (((inq.PQ_PDT & 0xE0) == 0x20) || (inq.PQ_PDT & 0x1F)) {
> > 		/* LUN not connected or not a Direct Access device */
> > 		ret = PATH_DOWN;
> > 		goto done;
> > 
> > Please note the 7f to 1F change and the comment change to reflect the code
> > check.
> 
> Malahal, Thanks for your review comment. First and second expression
> are two different comparisons. In First expression we are explicitly
> checking if PQ==001b. If the first expression is _FALSE_ then we check
> for second expression in which we compare if PQ==011b and PDT==11111b
> (i.e PQ_PDT = 01111111b=0x7F).

Vijay, in your patch, the second expression is not a comparison to be
precise!  Based on your explanation, you really want (inq.PQ_PDT ==
0x7F) rather than the current expression (inq.PQ_PDT & 0x7F).

Thanks, Malahal.




More information about the dm-devel mailing list