summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2002-01-17 08:33:32 +0000
committermckusick <mckusick@FreeBSD.org>2002-01-17 08:33:32 +0000
commit4e7dcb216b8e5f38cbfecebbe944d04e616efa6f (patch)
tree2ba285e49fe7ceef6eb59f32bf9741b0e2eaf70b /sys/ufs
parent2c590ba2d9588b0ca27b4a9f28241e12163bb620 (diff)
downloadFreeBSD-src-4e7dcb216b8e5f38cbfecebbe944d04e616efa6f.zip
FreeBSD-src-4e7dcb216b8e5f38cbfecebbe944d04e616efa6f.tar.gz
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.
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c4
-rw-r--r--sys/ufs/ffs/fs.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index fbbc67f..1d0a372 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -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;
}
diff --git a/sys/ufs/ffs/fs.h b/sys/ufs/ffs/fs.h
index 7d4bfc8..fc336aa 100644
--- a/sys/ufs/ffs/fs.h
+++ b/sys/ufs/ffs/fs.h
@@ -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
OpenPOWER on IntegriCloud