Fix a buglet that was present in the ia64 code and that got inherited
by amd64 and i386: For buffered writes we collect data and write it out a ${DEV_BSIZE}-sized block at a time. The fragsz variable is used to keep track of how much data we have collected in the buffer so far and it's reset to zero immediately after writing a block to the dump device. When the last, possibly partially filled buffer is flushed, we didn't reset fragsz to 0 and as such would stop reflecting reality. Since we currently only need to do buffered writes once, this isn't a problem. However, when kernel dumps are made by hand (say by callling doadump from within DDB), the improperly cleared state from the first call to dumpsys causes the next call to dumpsys to create an invalid code file. This change resets fragsz after flushing the partially filled buffer so that it fixes the two problems at once. Approved by: re (scottl)
This commit is contained in:
parent
23daa51ff3
commit
696ddfbe75
@ -156,6 +156,7 @@ buf_flush(struct dumperinfo *di)
|
||||
|
||||
error = di->dumper(di->priv, buffer, 0, dumplo, DEV_BSIZE);
|
||||
dumplo += DEV_BSIZE;
|
||||
fragsz = 0;
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -156,6 +156,7 @@ buf_flush(struct dumperinfo *di)
|
||||
|
||||
error = di->dumper(di->priv, buffer, 0, dumplo, DEV_BSIZE);
|
||||
dumplo += DEV_BSIZE;
|
||||
fragsz = 0;
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,7 @@ buf_flush(struct dumperinfo *di)
|
||||
|
||||
error = di->dumper(di->priv, buffer, 0, dumplo, DEV_BSIZE);
|
||||
dumplo += DEV_BSIZE;
|
||||
fragsz = 0;
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user