1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

Use the slice-relative blkno in all parts of the label write

protection checks.  Using the partition-relative blkno in some
parts broke the write protection for partitions at unusual
offsets (only for partitions at offset 1 on i386's).
This commit is contained in:
Bruce Evans 1998-07-29 08:24:23 +00:00
parent 8d8a81c91e
commit ea0823f2c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37942

View File

@ -43,7 +43,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $ * from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: subr_diskslice.c,v 1.52 1998/07/20 14:35:27 bde Exp $ * $Id: subr_diskslice.c,v 1.53 1998/07/28 19:39:09 bde Exp $
*/ */
#include "opt_devfs.h" #include "opt_devfs.h"
@ -197,7 +197,7 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()");
/* XXX should also protect bootstrap in first 8K */ /* XXX should also protect bootstrap in first 8K */
if (blkno <= LABELSECTOR + labelsect && if (blkno <= LABELSECTOR + labelsect &&
#if LABELSECTOR != 0 #if LABELSECTOR != 0
bp->b_blkno + sz > LABELSECTOR + labelsect && blkno + sz > LABELSECTOR + labelsect &&
#endif #endif
(bp->b_flags & B_READ) == 0 && sp->ds_wlabel == 0) { (bp->b_flags & B_READ) == 0 && sp->ds_wlabel == 0) {
bp->b_error = EROFS; bp->b_error = EROFS;
@ -238,7 +238,7 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()");
*/ */
if (blkno <= LABELSECTOR + labelsect if (blkno <= LABELSECTOR + labelsect
#if LABELSECTOR != 0 #if LABELSECTOR != 0
&& bp->b_blkno + sz > LABELSECTOR + labelsect && blkno + sz > LABELSECTOR + labelsect
#endif #endif
&& sp->ds_offset != 0) { && sp->ds_offset != 0) {
struct iodone_chain *ic; struct iodone_chain *ic;