summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/vax/vax/disksubr.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c
index 3e312d60bbb..5d5604e8a8c 100644
--- a/sys/arch/vax/vax/disksubr.c
+++ b/sys/arch/vax/vax/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.32 2006/10/21 16:01:54 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.33 2007/02/18 11:43:19 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */
/*
@@ -253,19 +253,23 @@ writedisklabel(dev, strat, lp, osdep)
int error = 0;
bp = geteblk((int)lp->d_secsize);
-
- dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
- bcopy(lp, dlp, sizeof(struct disklabel));
-
bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART);
bp->b_blkno = LABELSECTOR;
bp->b_cylinder = LABELSECTOR / lp->d_secpercyl;
bp->b_bcount = lp->d_secsize;
+ bp->b_flags = B_READ;
+ (*strat)(bp);
+ if ((error = biowait(bp)) != 0)
+ goto done;
+
+ dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
+ bcopy(lp, dlp, sizeof(struct disklabel));
bp->b_flags = B_WRITE;
(*strat)(bp);
error = biowait(bp);
- brelse(bp);
+done:
+ brelse(bp);
return (error);
}