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>
index | next in thread | raw e-mail
[-- Attachment #1 --]
[-- Attachment #2 --]
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;
{
struct buf *bp;
int error;
/* XXX should probably ensure that we don't try to do this if
someone has changed rf_protected_sectors. */
if (b_vp == 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 = geteblk((int)RF_COMPONENT_INFO_SIZE);
bp->b_dev = udev2dev(dev, 0);
/* get our ducks in a row for the read */
bp->b_blkno = RF_COMPONENT_INFO_OFFSET / DEV_BSIZE;
bp->b_bcount = RF_COMPONENT_INFO_SIZE;
/*oyk add here to support FreeBSD5.0*/
bp->b_flags |= BIO_READ;
bp->b_resid = RF_COMPONENT_INFO_SIZE / DEV_BSIZE;
DEV_STRATEGY(bp, 0);
error = bufwait(bp);
bp->b_flags |= B_INVAL | B_AGE;
bp->b_ioflags &= ~BIO_ERROR;
if (!error) {
memcpy(clabel, bp->b_data,
sizeof(RF_ComponentLabel_t));
}
brelse(bp);
return(error);
}
Now, when I excute the 'error = 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;
/* XXX should probably ensure that we don't try to do this if
someone has changed rf_protected_sectors. */
if (b_vp == 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 = geteblk((int)RF_COMPONENT_INFO_SIZE);
bp->b_dev = udev2dev(dev, 0);
/* get our ducks in a row for the read */
bp->b_blkno = RF_COMPONENT_INFO_OFFSET / DEV_BSIZE;
bp->b_bcount = RF_COMPONENT_INFO_SIZE;
bp->b_flags |= B_READ;
bp->b_resid = RF_COMPONENT_INFO_SIZE / DEV_BSIZE;
BUF_STRATEGY(bp, 0);
error = biowait(bp);
if (!error) {
memcpy(clabel, bp->b_data,
sizeof(RF_ComponentLabel_t));
}
brelse(bp);
return(error);
}
I transfer it to FreeBSD5.0 according vinum example.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OE41l4maEqxGGmNN79x00013818>
