aboutsummaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_snapshot.c
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2002-12-18 19:50:28 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2002-12-18 19:50:28 +0000
commit4c572f622231e2e71cdb7564461fd3064d81d52f (patch)
tree720780a095050e735496f0a0cb88bfa665444ccd /sys/ufs/ffs/ffs_snapshot.c
parentd8e7d462eb22bb4d3c3a13ac2b72b3a78c9306a9 (diff)
downloadsrc-4c572f622231e2e71cdb7564461fd3064d81d52f.tar.gz
src-4c572f622231e2e71cdb7564461fd3064d81d52f.zip
Fix corruption introduced in previous delta.
Reported by: Aurelien Nephtali <aurelien.nephtali@wanadoo.fr> Sponsored by: DARPA & NAI Labs.
Notes
Notes: svn path=/head/; revision=108050
Diffstat (limited to 'sys/ufs/ffs/ffs_snapshot.c')
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index d64e4f2fca9d..7fe373d7bcaf 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -983,15 +983,19 @@ mapacct_ufs1(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
ufs1_daddr_t blkno;
struct inode *ip;
ino_t inum;
+ int acctit;
ip = VTOI(vp);
inum = ip->i_number;
+ if (lblkno == -1)
+ acctit = 0;
+ else
+ acctit = 1;
for ( ; oldblkp < lastblkp; oldblkp++, lblkno++) {
blkno = *oldblkp;
if (blkno == 0 || blkno == BLK_NOCOPY)
continue;
- if (lblkno != -1 && expungetype == BLK_SNAP &&
- blkno != BLK_SNAP)
+ if (acctit && expungetype == BLK_SNAP && blkno != BLK_SNAP)
*ip->i_snapblklist++ = lblkno;
if (blkno == BLK_SNAP)
blkno = blkstofrags(fs, lblkno);
@@ -1254,15 +1258,19 @@ mapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
ufs2_daddr_t blkno;
struct inode *ip;
ino_t inum;
+ int acctit;
ip = VTOI(vp);
inum = ip->i_number;
+ if (lblkno == -1)
+ acctit = 0;
+ else
+ acctit = 1;
for ( ; oldblkp < lastblkp; oldblkp++, lblkno++) {
blkno = *oldblkp;
if (blkno == 0 || blkno == BLK_NOCOPY)
continue;
- if (lblkno != -1 && expungetype == BLK_SNAP &&
- blkno != BLK_SNAP)
+ if (acctit && expungetype == BLK_SNAP && blkno != BLK_SNAP)
*ip->i_snapblklist++ = lblkno;
if (blkno == BLK_SNAP)
blkno = blkstofrags(fs, lblkno);