diff options
author | iedowse <iedowse@FreeBSD.org> | 2006-05-31 09:05:49 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2006-05-31 09:05:49 +0000 |
commit | 9d817df889b68d471c8935500342a91c98a411f3 (patch) | |
tree | 0dc4431f4bc6713d05d532ed3b5be8be9d3b4af1 /sys/boot/i386/libi386 | |
parent | cc936f1acc6c1d00f67fa2e74ae0f78fcf2674e0 (diff) | |
download | FreeBSD-src-9d817df889b68d471c8935500342a91c98a411f3.zip FreeBSD-src-9d817df889b68d471c8935500342a91c98a411f3.tar.gz |
Increment the disk block offset after writing, not before. This
fixes filesystem corruption when nextboot.conf is located after
cylinder 1023. The bug appears to have been introduced at the time
bd_read was copied to create bd_write.
PR: bin/98005
Reported by: yar
MFC after: 1 week
Diffstat (limited to 'sys/boot/i386/libi386')
-rw-r--r-- | sys/boot/i386/libi386/biosdisk.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c index fa82b36..8a1b402 100644 --- a/sys/boot/i386/libi386/biosdisk.c +++ b/sys/boot/i386/libi386/biosdisk.c @@ -1037,9 +1037,6 @@ bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) */ if (bbuf != NULL) bcopy(p, breg, x * BIOSDISK_SECSIZE); - p += (x * BIOSDISK_SECSIZE); - dblk += x; - resid -= x; /* Loop retrying the operation a couple of times. The BIOS may also retry. */ for (retry = 0; retry < 3; retry++) { @@ -1103,6 +1100,9 @@ bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) if (result) { return(-1); } + p += (x * BIOSDISK_SECSIZE); + dblk += x; + resid -= x; } /* hexdump(dest, (blks * BIOSDISK_SECSIZE)); */ |