*BSD News Article 19052


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!uunet!pipex!uknet!mcsun!sun4nl!tuegate.tue.nl!svin09.info.win.tue.nl!wzv.win.tue.nl!gvr.win.tue.nl!guido
From: guido@gvr.win.tue.nl (Guido van Rooij)
Newsgroups: comp.os.386bsd.questions
Subject: swap_pager_finish complaints when first partition is swap
Date: 30 Jul 1993 17:13:30 GMT
Organization: Eindhoven University of Technology, The Netherlands
Lines: 55
Message-ID: <23bkrq$9gl@wzv.win.tue.nl>
NNTP-Posting-Host: gvr.win.tue.nl

Recently, I put in a new disk and labeled it using the following
disktab:
cp30254|Conner Peripherals 240MB IDE:\
        :dt=ESDI:ty=winchester:se#512:nt#10:ns#55:nc#895: \
        :pb#492250:ob#452100:tb=swap: \
        :pc#492250:oc#0: \
        :ph#452100:oh#0:th=4.2BSD:bh#4096:fh#512:

A few days later, I got:        
messages:Jul 30 12:00:02 gvr /386bsd: error 30 blkno 0 sz 4096 swap_pager_finish
: clean of page bba000 failed
plus about hundred more

I suspect this error is due to the following piece of code form ufs_disksubr.c:

/*
 * Determine the size of the transfer, and make sure it is
 * within the boundaries of the partition. Adjust transfer
 * if needed, and signal errors or early completion.
 */
int
bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
{
        struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
        int labelsect = lp->d_partitions[0].p_offset;
        int maxsz = p->p_size,
                sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;

        /* overwriting disk label ? */
        /* XXX should also protect bootstrap in first 8K */
        if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
#if LABELSECTOR != 0
            bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
#endif
            (bp->b_flags & B_READ) == 0 && wlabel == 0) {
                bp->b_error = EROFS;
                goto bad;
        }

Now in the case of i386, LABELSECTOR is 1. Further, labelsect and p->p_offset
are the same. So indeed, EROFS should be returned.
What I don't understand is why it fails. Clearly, for some reason, the
first partition should not start on offset 0, because it seems to interfere
with the label, but the disktab examples I saw all started at offset 0.
So perhaps there is a bug in the code..?

Can someone explain this to me? 

-Guido

-- 
Guido van Rooij                 |  Internet: guido@gvr.win.tue.nl
Bisschopsmolen 16               |  Phone:    ++31.40.461433
5612 DS Eindhoven               |  ((12+144+20)+3*sqrt(4))/7 
The Netherlands                 |    +(5*11)=9^2+0