Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 1998 10:24:17 -0400 (EDT)
From:      Luoqi Chen <luoqi@watermarkgroup.com>
To:        luoqi@watermarkgroup.com, mike@smith.net.au
Cc:        current@FreeBSD.ORG
Subject:   Re: possible race window for getblk?
Message-ID:  <199808271424.KAA15815@lor.watermarkgroup.com>

next in thread | raw e-mail | index | archive | help
> 
> > The problem with this check is, reads only hold shared lock on the vnode,
> > thus the vnode lock won't prevent two reads from successfully creating
> > two new buffers at the same block offset. This check should be extended
> > to shared lock:
> >                 if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE && gbincore(vp, blkno)) {
> >                         bp->b_flags |= B_INVAL;
> >                         brelse(bp);
> >                         goto loop;
> >                 }
> 
> Makes sense.  Does this apply to -stable as well?
> 
Yes, it's there since 1995. I looked at the CVS history, it used to be only
the incore check. VOP_ISLOCKED check was added later as an optimization,
I think. Given the total number of buffers of 2K and the hash size of 512, 
on average each hash chain is of length 4, it doesn't seem to save us much
with this optimization (if it doesn't cost more).

-lq

> -- 
> \\  Sometimes you're ahead,       \\  Mike Smith
> \\  sometimes you're behind.      \\  mike@smith.net.au
> \\  The race is long, and in the  \\  msmith@freebsd.org
> \\  end it's only with yourself.  \\  msmith@cdrom.com
> 
> 

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?199808271424.KAA15815>