Fix a bug introduced in ffs_snapshot.c -r1.25 and fs.h -r1.26

which caused incomplete snapshots to be taken. When background
fsck would run on these snapshots, the result would be files
being incorrectly released which would subsequently panic the
kernel with ``handle_workitem_freefile: inodedep survived'',
``handle_written_inodeblock: live inodedep'', and
``handle_workitem_remove: lost inodedep'' errors.
This commit is contained in:
Kirk McKusick 2002-01-17 08:33:32 +00:00
parent 00e39e5ea1
commit 99bef8782b
2 changed files with 4 additions and 4 deletions

View File

@ -266,7 +266,7 @@ restart:
* touch up the few cylinder groups that changed during
* the suspension period.
*/
len = howmany(fs->fs_ncg, (NBBY * sizeof(int)));
len = howmany(fs->fs_ncg, NBBY);
MALLOC(fs->fs_active, int *, len, M_DEVBUF, M_WAITOK);
bzero(fs->fs_active, len);
for (cg = 0; cg < fs->fs_ncg; cg++) {
@ -322,7 +322,7 @@ restart:
if (error)
goto out1;
error = cgaccount(cg, vp, nbp, 2);
brelse(nbp);
bawrite(nbp);
if (error)
goto out1;
}

View File

@ -292,7 +292,7 @@ struct fs {
u_int8_t *fs_contigdirs; /* # of contiguously allocated dirs */
struct csum *fs_csp; /* cg summary info buffer for fs_cs */
int32_t *fs_maxcluster; /* max cluster in each cyl group */
u_int32_t *fs_active; /* used by snapshots to track fs */
u_int *fs_active; /* used by snapshots to track fs */
int32_t fs_cpc; /* cyl per cycle in postbl */
int16_t fs_opostbl[16][8]; /* old rotation block list head */
int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */
@ -368,7 +368,7 @@ struct fs {
* Macros to access bits in the fs_active array.
*/
#define ACTIVECGNUM(fs, cg) ((fs)->fs_active[(cg) / (NBBY * sizeof(int))])
#define ACTIVECGOFF(cg) (1 << ((cg) / (NBBY * sizeof(int))))
#define ACTIVECGOFF(cg) (1 << ((cg) % (NBBY * sizeof(int))))
/*
* The size of a cylinder group is calculated by CGSIZE. The maximum size