Date: Tue, 10 Jul 2012 12:59:07 -0700 (PDT) From: Scott Long <scott4long@yahoo.com> To: Sean Bruno <seanbru@yahoo-inc.com>, Andrew Boyer <aboyer@averesystems.com> Cc: "freebsd-scsi@freebsd.org" <freebsd-scsi@freebsd.org>, "scottl@freebsd.org" <scottl@freebsd.org>, "ambrisko@FreeBSD.ORG" <ambrisko@freebsd.org> Subject: Re: [patch] MFI should set bio_resid on command failure Message-ID: <1341950347.63294.YahooMailNeo@web45701.mail.sp1.yahoo.com> In-Reply-To: <1341938629.2573.7.camel@powernoodle.corp.yahoo.com> References: <909AAC62-7BB4-43E7-B04B-27466B038A07@averesystems.com> <1341340916.3370.6.camel@powernoodle.corp.yahoo.com> <2936EBFD-CA1E-4EC4-9790-80D1A5DC5567@averesystems.com> <1341938629.2573.7.camel@powernoodle.corp.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
=0A=0A=0A=0A----- Original Message -----=0A> From: Sean Bruno <seanbru@yaho= o-inc.com>=0A> To: Andrew Boyer <aboyer@averesystems.com>=0A> Cc: "freebsd-= scsi@freebsd.org" <freebsd-scsi@freebsd.org>; scottl@freebsd.org; "ambrisko= @FreeBSD.ORG" <ambrisko@freebsd.org>=0A> Sent: Tuesday, July 10, 2012 10:43= AM=0A> Subject: Re: [patch] MFI should set bio_resid on command failure=0A= > =0A> On Tue, 2012-07-10 at 09:37 -0700, Andrew Boyer wrote:=0A>> On Jul = 3, 2012, at 2:41 PM, Sean Bruno wrote:=0A>> =0A>> > On Tue, 2012-07-03 at = 06:47 -0700, Andrew Boyer wrote:=0A>> >> When an MFI command fails, the dr= iver needs to set =0A> bio->bio_resid so that the upper levels notice.=C2= =A0 Otherwise we see commands =0A> silently failing leading to data corrupt= ion.=C2=A0 This mirrors dadone().=0A>> >> =0A>> >> -Andrew=0A>> >> =0A>>= >> Index: sys/dev/mfi/mfi_disk.c=0A>> >> =0A> =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=0A>> >> --- sys/dev/mfi/mfi_disk.c=C2=A0=C2=A0= =C2=A0 (revision 238071)=0A>> >> +++ sys/dev/mfi/mfi_disk.c=C2=A0=C2=A0=C2= =A0 (working copy)=0A>> >> @@ -298,6 +298,7 @@=0A>> >> =C2=A0=C2=A0=C2=A0= hdr =3D bio->bio_driver1;=0A>> >> =0A>> >> =C2=A0=C2=A0=C2=A0 if (bio->b= io_flags & BIO_ERROR) {=0A>> >> +=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 bio= ->bio_resid =3D bio->bio_bcount;=0A>> >> =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0 if (bio->bio_error =3D=3D 0)=0A>> >> =C2=A0=C2=A0=C2=A0 =C2=A0=C2= =A0=C2=A0 =C2=A0=C2=A0=C2=A0 bio->bio_error =3D EIO;=0A>> >> =C2=A0=C2=A0= =C2=A0 =C2=A0=C2=A0=C2=A0 disk_err(bio, "hard error", -1, 1);=0A>> >> =0A>= > >> --------------------------------------------------=0A>> >> Andrew Bo= yer=C2=A0=C2=A0=C2=A0 aboyer@averesystems.com=0A>> >> =0A>> > =0A>> > Th= is looks right to me.=C2=A0 It mirrors the behavior in =0A> mfi_disk_strate= gy()=0A>> > as well.=0A>> > =0A>> > Sean=0A>> > =0A>> =0A>> Anyone int= erested in committing?=C2=A0 (And MFC'ing to stable/8=E2=80=A6)=0A>> =0A>> = -Andrew=0A>> =0A>> --------------------------------------------------=0A>= > Andrew Boyer=C2=A0=C2=A0=C2=A0 aboyer@averesystems.com=0A>> =0A>> =0A>> = =0A> =0A> Let me hit dougA and scottl for validation.=C2=A0 Their wisdom he= re can=0A> validate my naivete.=0A> =0A=0A=0AYeah, b_resid needs to be set,= and a lot of drivers get this wrong.=0A=0AScott=0A
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1341950347.63294.YahooMailNeo>