Expunge traces of unlinked snapshot files when making a new snapshot.
From FreeBSD Rev. 1.123
This commit is contained in:
parent
5200a497db
commit
7d3c830b7c
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ffs_snapshot.c,v 1.47 2007/08/09 07:34:28 hannken Exp $ */
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.48 2007/08/18 09:48:33 hannken Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.47 2007/08/09 07:34:28 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.48 2007/08/18 09:48:33 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
|
@ -602,6 +602,9 @@ out1:
|
|||
else
|
||||
error = expunge_ufs2(vp, xp, fs, snapacct_ufs2,
|
||||
BLK_SNAP);
|
||||
if (error == 0 && xp->i_ffs_effnlink == 0)
|
||||
error = ffs_freefile(copy_fs, vp,
|
||||
xp->i_number, xp->i_mode);
|
||||
if (error) {
|
||||
fs->fs_snapinum[snaploc] = 0;
|
||||
goto done;
|
||||
|
@ -880,10 +883,10 @@ expunge_ufs1(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
|||
}
|
||||
/*
|
||||
* 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 *)bf + ino_to_fsbo(fs, cancelip->i_number);
|
||||
if (expungetype == BLK_NOCOPY)
|
||||
if (expungetype == BLK_NOCOPY || cancelip->i_ffs_effnlink == 0)
|
||||
dip->di_mode = 0;
|
||||
dip->di_size = 0;
|
||||
dip->di_blocks = 0;
|
||||
|
@ -1148,10 +1151,10 @@ expunge_ufs2(struct vnode *snapvp, struct inode *cancelip, struct fs *fs,
|
|||
}
|
||||
/*
|
||||
* 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 ufs2_dinode *)bf + ino_to_fsbo(fs, cancelip->i_number);
|
||||
if (expungetype == BLK_NOCOPY)
|
||||
if (expungetype == BLK_NOCOPY || cancelip->i_ffs_effnlink == 0)
|
||||
dip->di_mode = 0;
|
||||
dip->di_size = 0;
|
||||
dip->di_blocks = 0;
|
||||
|
|
Loading…
Reference in New Issue