Use the appropriate size when zeroing out the unused portion

of a snapshot's copy of a superblock. This patch fixes a panic
when taking a snapshot of a 4096/512 filesystem.

Reported by:	Ian Freislich <ianf@za.uu.net>
Sponsored by:   DARPA & NAI Labs.
This commit is contained in:
Kirk McKusick 2003-03-07 23:49:16 +00:00
parent 58251a8dc0
commit 34968037b1

View file

@ -352,9 +352,9 @@ restart:
bcopy(fs, copy_fs, fs->fs_sbsize);
if ((fs->fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0)
copy_fs->fs_clean = 1;
if (fs->fs_sbsize < SBLOCKSIZE)
bzero(&sbp->b_data[loc + fs->fs_sbsize],
SBLOCKSIZE - fs->fs_sbsize);
size = fs->fs_bsize < SBLOCKSIZE ? fs->fs_bsize : SBLOCKSIZE;
if (fs->fs_sbsize < size)
bzero(&sbp->b_data[loc + fs->fs_sbsize], size - fs->fs_sbsize);
size = blkroundup(fs, fs->fs_cssize);
if (fs->fs_contigsumsize > 0)
size += fs->fs_ncg * sizeof(int32_t);