Date: Wed, 5 Jun 2002 10:40:17 +0800 From: "kai ouyang" <oykai@msn.com> To: "John Baldwin" <jhb@FreeBSD.org>, <current@FreeBSD.org> Subject: Please help: why bufwait() will cause the thread status change to SSLEEP? Message-ID: <OE41l4maEqxGGmNN79x00013818@hotmail.com>
next in thread | raw e-mail | index | archive | help
------=_NextPart_001_0000_01C20C7D.61FF45C0 Content-Type: multipart/alternative; boundary="----=_NextPart_002_0001_01C20C7D.61FF45C0" ------=_NextPart_002_0001_01C20C7D.61FF45C0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Dear John and everyone, I do not know the thread group means what in FreeBSD5.0. Could you give me some information? Now, I mask the code about thread group operations. When I want to get the RAIDFrame information(exist in the disk block). I can call raidread_component_label(), as the following: int raidread_component_label(dev, b_vp, clabel) udev_t dev; struct vnode *b_vp; RF_ComponentLabel_t *clabel; { =20 struct buf *bp; int error; =20 /* XXX should probably ensure that we don't try to do this if someone has changed rf_protected_sectors. */ =20 if (b_vp =3D=3D NULL) { /* For whatever reason, this component is not valid. Don't try to read a component label from it. */ return(EINVAL); } /* get a block of the appropriate size... */ bp =3D geteblk((int)RF_COMPONENT_INFO_SIZE); bp->b_dev =3D udev2dev(dev, 0); /* get our ducks in a row for the read */ bp->b_blkno =3D RF_COMPONENT_INFO_OFFSET / DEV_BSIZE; bp->b_bcount =3D RF_COMPONENT_INFO_SIZE; /*oyk add here to support FreeBSD5.0*/ bp->b_flags |=3D BIO_READ; bp->b_resid =3D RF_COMPONENT_INFO_SIZE / DEV_BSIZE; DEV_STRATEGY(bp, 0); error =3D bufwait(bp); bp->b_flags |=3D B_INVAL | B_AGE; bp->b_ioflags &=3D ~BIO_ERROR; if (!error) { memcpy(clabel, bp->b_data, sizeof(RF_ComponentLabel_t)); } brelse(bp); =20 return(error); } Now, when I excute the 'error =3D bufwait(bp);', the system will be crash= . the error information is also thread status SSLEEP. I do know what will cause the thread status change to SSLEEP. The function in FreeBSD4.x as following: int raidread_component_label(dev, b_vp, clabel) udev_t dev; struct vnode *b_vp; RF_ComponentLabel_t *clabel; { struct buf *bp; int error; =20 /* XXX should probably ensure that we don't try to do this if someone has changed rf_protected_sectors. */ =20 if (b_vp =3D=3D NULL) { /* For whatever reason, this component is not valid. Don't try to read a component label from it. */ return(EINVAL); } /* get a block of the appropriate size... */ bp =3D geteblk((int)RF_COMPONENT_INFO_SIZE); bp->b_dev =3D udev2dev(dev, 0); /* get our ducks in a row for the read */ bp->b_blkno =3D RF_COMPONENT_INFO_OFFSET / DEV_BSIZE; bp->b_bcount =3D RF_COMPONENT_INFO_SIZE; bp->b_flags |=3D B_READ; bp->b_resid =3D RF_COMPONENT_INFO_SIZE / DEV_BSIZE; BUF_STRATEGY(bp, 0); error =3D biowait(bp); =20 if (!error) { memcpy(clabel, bp->b_data, sizeof(RF_ComponentLabel_t)); } brelse(bp); =20 return(error); } I transfer it to FreeBSD5.0 according vinum example. Best Regards Ouyang Kai=B4=D3=CD=F8=D5=BE=B5=C3=B5=BD=B8=FC=B6=E0=D0=C5=CF=A2=A1=A3MSN= Explorer =C3=E2=B7=D1=CF=C2=D4=D8:http://explorer.msn.com/lccn ------=_NextPart_002_0001_01C20C7D.61FF45C0 Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable <HTML><BODY STYLE=3D"font:10pt verdana; border:none;"><DIV>Dear John and = everyone,</DIV> <DIV> </DIV> <DIV>I do not know the thread group mea= ns what in FreeBSD5.0.<BR>Could you give me some information?<BR>Now, I m= ask the code about thread group operations.<BR>When I want to get the RAI= DFrame information(exist in the disk block).<BR>I can call raidread_compo= nent_label(), as the following:<BR>int raidread_component_label(dev, b_vp= , clabel)<BR> udev_t dev;<BR> struct vnode *b_vp;<BR> RF_C= omponentLabel_t *clabel;<BR>{<BR> <BR> struct buf *bp;<BR> = ;int error;<BR> <BR> /* XXX should probably ensure that we don'= t try to do this if<BR> someone has changed rf_protecte= d_sectors. */ <BR> if (b_vp =3D=3D NULL) {<BR> /* For wha= tever reason, this component is not valid.<BR> Do= n't try to read a component label from it. */<BR> return(EINVA= L);<BR> }</DIV> <DIV> /* get a block of the appropriate size...= */<BR> bp =3D geteblk((int)RF_COMPONENT_INFO_SIZE);<BR> bp->= ;b_dev =3D udev2dev(dev, 0);</DIV> <DIV> /* get our ducks in a row f= or the read */<BR> bp->b_blkno =3D RF_COMPONENT_INFO_OFFSET / DEV= _BSIZE;<BR> bp->b_bcount =3D RF_COMPONENT_INFO_SIZE;<BR> /*o= yk add here to support FreeBSD5.0*/<BR> bp->b_flags |=3D BIO_READ= ;<BR> bp->b_resid =3D RF_COMPONENT_INFO_SIZE / DEV_BSIZE;<B= R> DEV_STRATEGY(bp, 0);<BR> error =3D bufwait(bp);<BR> &nb= sp; bp->b_flags |=3D B_INVAL | B_AGE;<BR= > bp->b_ioflags &=3D ~BI= O_ERROR;<BR> if (!error) {<BR> &= nbsp;memcpy(clabel, bp->b_data,<BR>  = ; sizeof(RF_ComponentLabel_t));</DIV> <DIV> = }<BR> brelse(bp); <BR> return(error);<= BR>}</DIV> <DIV>Now, when I excute the 'error =3D bufwait(bp);', the syst= em will be crash. the error information<BR>is also thread status SSLEEP.<= BR>I do know what will cause the thread status change to SSLEEP.<BR>The f= unction in FreeBSD4.x as following:<BR>int raidread_component_label(dev, = b_vp, clabel)<BR> udev_t dev;<BR> struct vnode *b_vp;<BR> = RF_ComponentLabel_t *clabel;<BR>{<BR> struct buf *bp;<BR> int e= rror;<BR> <BR> /* XXX should probably ensure that we don't try = to do this if<BR> someone has changed rf_protected_sect= ors. */ </DIV> <DIV> if (b_vp =3D=3D NULL) {<BR> /* For w= hatever reason, this component is not valid.<BR> = Don't try to read a component label from it. */<BR> return(EIN= VAL);<BR> }</DIV> <DIV> /* get a block of the appropriate size.= .. */<BR> bp =3D geteblk((int)RF_COMPONENT_INFO_SIZE);<BR> bp-&= gt;b_dev =3D udev2dev(dev, 0);</DIV> <DIV> /* get our ducks in a row= for the read */<BR> bp->b_blkno =3D RF_COMPONENT_INFO_OFFSET / D= EV_BSIZE;<BR> bp->b_bcount =3D RF_COMPONENT_INFO_SIZE;<BR> b= p->b_flags |=3D B_READ;<BR> bp->b_resid =3D RF_COMPONENT= _INFO_SIZE / DEV_BSIZE;</DIV> <DIV> BUF_STRATEGY(bp, 0);</DIV> <DIV>= error =3D biowait(bp); </DIV> <DIV> if (!error) {<BR> &nb= sp;memcpy(clabel, bp->b_data,<BR> &= nbsp; sizeof(RF_ComponentLabel_t));<BR> &nbs= p; }<BR> brelse(bp); <BR> return(error);<BR>}<BR>&n= bsp;I transfer it to FreeBSD5.0 according vinum example.<BR><BR>Best Rega= rds<BR>Ouyang Kai</DIV></BODY></HTML><br clear=3Dall><hr>=B4=D3=CD=F8=D5=BE= =B5=C3=B5=BD=B8=FC=B6=E0=D0=C5=CF=A2=A1=A3MSN Explorer =C3=E2=B7=D1=CF=C2= =D4=D8=A3=BA<a href=3D'http://explorer.msn.com/lccn'>http://explorer.msn.= com/lccn</a><br></p> ------=_NextPart_002_0001_01C20C7D.61FF45C0-- ------=_NextPart_001_0000_01C20C7D.61FF45C0 Content-Type: text/plain; name="bufwait.txt" Content-Disposition: attachment; filename="bufwait.txt" Content-Transfer-Encoding: quoted-printable I do not know the thread group means what in FreeBSD5.0. Could you give me some information? Now, I mask the code about thread group operations. When I want to get the RAIDFrame information(exist in the disk block). I can call raidread_component_label(), as the following: int raidread_component_label(dev, b_vp, clabel) udev_t dev; struct vnode *b_vp; RF_ComponentLabel_t *clabel; { =09 struct buf *bp; int error; =09 /* XXX should probably ensure that we don't try to do this if someone has changed rf_protected_sectors. */ =20 if (b_vp =3D=3D NULL) { /* For whatever reason, this component is not valid. Don't try to read a component label from it. */ return(EINVAL); } /* get a block of the appropriate size... */ bp =3D geteblk((int)RF_COMPONENT_INFO_SIZE); bp->b_dev =3D udev2dev(dev, 0); /* get our ducks in a row for the read */ bp->b_blkno =3D RF_COMPONENT_INFO_OFFSET / DEV_BSIZE; bp->b_bcount =3D RF_COMPONENT_INFO_SIZE; /*oyk add here to support FreeBSD5.0*/ bp->b_flags |=3D BIO_READ; bp->b_resid =3D RF_COMPONENT_INFO_SIZE / DEV_BSIZE; DEV_STRATEGY(bp, 0); error =3D bufwait(bp); bp->b_flags |=3D B_INVAL | B_AGE; bp->b_ioflags &=3D ~BIO_ERROR; if (!error) { memcpy(clabel, bp->b_data, sizeof(RF_ComponentLabel_t)); } brelse(bp); =20 return(error); } Now, when I excute the 'error =3D bufwait(bp);', the system will be crash= . the error information is also thread status SSLEEP. I do know what will cause the thread status change to SSLEEP. The function in FreeBSD4.x as following: int raidread_component_label(dev, b_vp, clabel) udev_t dev; struct vnode *b_vp; RF_ComponentLabel_t *clabel; { struct buf *bp; int error; =09 /* XXX should probably ensure that we don't try to do this if someone has changed rf_protected_sectors. */ =20 if (b_vp =3D=3D NULL) { /* For whatever reason, this component is not valid. Don't try to read a component label from it. */ return(EINVAL); } /* get a block of the appropriate size... */ bp =3D geteblk((int)RF_COMPONENT_INFO_SIZE); bp->b_dev =3D udev2dev(dev, 0); /* get our ducks in a row for the read */ bp->b_blkno =3D RF_COMPONENT_INFO_OFFSET / DEV_BSIZE; bp->b_bcount =3D RF_COMPONENT_INFO_SIZE; bp->b_flags |=3D B_READ; bp->b_resid =3D RF_COMPONENT_INFO_SIZE / DEV_BSIZE; BUF_STRATEGY(bp, 0); error =3D biowait(bp); =20 if (!error) { memcpy(clabel, bp->b_data, sizeof(RF_ComponentLabel_t)); } brelse(bp); =20 return(error); } I transfer it to FreeBSD5.0 according vinum example. ------=_NextPart_001_0000_01C20C7D.61FF45C0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OE41l4maEqxGGmNN79x00013818>