Revert rev. 1.101. Dead snapshots would hang around until unmount.
Adresses PR #44568 (WAPBL doens't play nice with snapshots).
This commit is contained in:
parent
1ce01ed2f8
commit
28125a4542
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.103 2011/02/16 19:43:50 hannken Exp $ */
|
||||
/* $NetBSD: ffs_snapshot.c,v 1.104 2011/02/18 08:39:13 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.103 2011/02/16 19:43:50 hannken Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.104 2011/02/18 08:39:13 hannken Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_ffs.h"
|
||||
@ -280,7 +280,6 @@ ffs_snapshot(struct mount *mp, struct vnode *vp, struct timespec *ctime)
|
||||
fs->fs_snapinum[snaploc] = ip->i_number;
|
||||
|
||||
mutex_enter(&si->si_lock);
|
||||
vref(vp);
|
||||
if (is_active_snapshot(si, ip))
|
||||
panic("ffs_snapshot: %"PRIu64" already on list", ip->i_number);
|
||||
TAILQ_INSERT_TAIL(&si->si_snapshots, ip, i_nextsnap);
|
||||
@ -394,7 +393,8 @@ out:
|
||||
(void) ffs_truncate(vp, (off_t)0, 0, NOCRED);
|
||||
UFS_WAPBL_END(mp);
|
||||
}
|
||||
}
|
||||
} else
|
||||
vref(vp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1313,8 +1313,10 @@ ffs_snapgone(struct inode *ip)
|
||||
if (xp == ip)
|
||||
break;
|
||||
mutex_exit(&si->si_lock);
|
||||
if (xp != NULL)
|
||||
vrele(ITOV(ip));
|
||||
#ifdef DEBUG
|
||||
if (snapdebug && xp == NULL)
|
||||
else if (snapdebug)
|
||||
printf("ffs_snapgone: lost snapshot vnode %llu\n",
|
||||
(unsigned long long)ip->i_number);
|
||||
#endif
|
||||
@ -1382,7 +1384,6 @@ ffs_snapremove(struct vnode *vp)
|
||||
free(ip->i_snapblklist, M_UFSMNT);
|
||||
ip->i_snapblklist = NULL;
|
||||
}
|
||||
vrele(vp);
|
||||
} else
|
||||
mutex_exit(&si->si_lock);
|
||||
/*
|
||||
@ -1763,25 +1764,28 @@ void
|
||||
ffs_snapshot_unmount(struct mount *mp)
|
||||
{
|
||||
struct vnode *devvp = VFSTOUFS(mp)->um_devvp;
|
||||
struct inode *ip;
|
||||
struct inode *xp;
|
||||
struct vnode *vp = NULL;
|
||||
struct snap_info *si;
|
||||
bool list_empty = true;
|
||||
|
||||
si = VFSTOUFS(mp)->um_snapinfo;
|
||||
mutex_enter(&si->si_lock);
|
||||
while ((ip = TAILQ_FIRST(&si->si_snapshots)) != 0) {
|
||||
list_empty = false;
|
||||
TAILQ_REMOVE(&si->si_snapshots, ip, i_nextsnap);
|
||||
if (ip->i_snapblklist == si->si_snapblklist)
|
||||
while ((xp = TAILQ_FIRST(&si->si_snapshots)) != 0) {
|
||||
vp = ITOV(xp);
|
||||
TAILQ_REMOVE(&si->si_snapshots, xp, i_nextsnap);
|
||||
if (xp->i_snapblklist == si->si_snapblklist)
|
||||
si->si_snapblklist = NULL;
|
||||
free(ip->i_snapblklist, M_UFSMNT);
|
||||
si->si_gen++;
|
||||
mutex_exit(&si->si_lock);
|
||||
vrele(ITOV(ip));
|
||||
mutex_enter(&si->si_lock);
|
||||
free(xp->i_snapblklist, M_UFSMNT);
|
||||
if (xp->i_nlink > 0) {
|
||||
si->si_gen++;
|
||||
mutex_exit(&si->si_lock);
|
||||
vrele(vp);
|
||||
mutex_enter(&si->si_lock);
|
||||
}
|
||||
}
|
||||
si->si_gen++;
|
||||
mutex_exit(&si->si_lock);
|
||||
if (! list_empty)
|
||||
if (vp)
|
||||
fscow_disestablish(mp, ffs_copyonwrite, devvp);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user