Avoid segment fault when attempting to clean up cylinder group

buffer cache.

PR:		187221
Submitted by:	Petr Lampa <lampa@fit.vutbr.cz>
Obtained from:	Petr Lampa <lampa@fit.vutbr.cz>
MFC after:	1 week
This commit is contained in:
Kirk McKusick 2014-03-12 01:28:21 +00:00
parent 22b8ff24b5
commit e2f4949a4a

View File

@ -436,13 +436,15 @@ ckfini(int markclean)
}
if (numbufs != cnt)
errx(EEXIT, "panic: lost %d buffers", numbufs - cnt);
for (cnt = 0; cnt < sblock.fs_ncg; cnt++) {
if (cgbufs[cnt].b_un.b_cg == NULL)
continue;
flush(fswritefd, &cgbufs[cnt]);
free(cgbufs[cnt].b_un.b_cg);
if (cgbufs != NULL) {
for (cnt = 0; cnt < sblock.fs_ncg; cnt++) {
if (cgbufs[cnt].b_un.b_cg == NULL)
continue;
flush(fswritefd, &cgbufs[cnt]);
free(cgbufs[cnt].b_un.b_cg);
}
free(cgbufs);
}
free(cgbufs);
pbp = pdirbp = (struct bufarea *)0;
if (cursnapshot == 0 && sblock.fs_clean != markclean) {
if ((sblock.fs_clean = markclean) != 0) {