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
This commit is contained in:
Ian Dowse 2006-05-31 09:05:49 +00:00
parent fd447da171
commit 9c0ce099e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159096

View File

@ -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)); */