Expunge traces of unlinked snapshot files when making a new snapshot.

This commit is contained in:
Tor Egge 2006-05-13 20:41:37 +00:00
parent 684e75f7c3
commit b405cb5ea5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158527

View File

@ -701,6 +701,13 @@ ffs_snapshot(mp, snapfile)
else
error = expunge_ufs2(vp, xp, fs, snapacct_ufs2,
BLK_SNAP);
if (error == 0 && xp->i_effnlink == 0) {
error = ffs_freefile(ump,
copy_fs,
vp,
xp->i_number,
xp->i_mode);
}
if (error) {
fs->fs_snapinum[snaploc] = 0;
goto done;
@ -989,11 +996,11 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype)
}
/*
* Set a snapshot inode to be a zero length file, regular files
* to be completely unallocated.
* or unlinked snapshots to be completely unallocated.
*/
dip = (struct ufs1_dinode *)bp->b_data +
ino_to_fsbo(fs, cancelip->i_number);
if (expungetype == BLK_NOCOPY)
if (expungetype == BLK_NOCOPY || cancelip->i_effnlink == 0)
dip->di_mode = 0;
dip->di_size = 0;
dip->di_blocks = 0;