CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected] 2011/07/05 23:09:01

Modified files:
        sys/dev        : vnd.c 

Log message:
vndstrategy() should fail if VNF_HAVELABEL isn't set.  This simplifies
the logic slightly and makes vnd(4) more like any other disk driver.

To avoid races, this means vndopen() can only set VNF_HAVELABEL if
dk_openmask == 0.  Otherwise, it's possible for userspace to open
rvnd0c, call VNDIOCSET, open vnd0a, then while vndreaddisklabel() (via
vndstrategy) is waiting for VOP_READ() to finish, you could issue a
read or write on the still open rvnd0c and have VNF_HAVELABEL set but
the disklabel might be in a weird state.

Note that this makes VNF_HAVELABEL nicely analogous to sd(4)/cd(4)'s
SDEV_MEDIA_LOADED flag, which is handled similarly in
{sd,cd}{open,close,strategy}.

ok dlg@, krw@, deraadt@

Reply via email to