Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/bouyer-quota2]: src/sys/ufs/ffs Sync with HEAD
details: https://anonhg.NetBSD.org/src/rev/8b25dda33de4
branches: bouyer-quota2
changeset: 761186:8b25dda33de4
user: bouyer <bouyer%NetBSD.org@localhost>
date: Fri Feb 18 09:51:16 2011 +0000
description:
Sync with HEAD
diffstat:
sys/ufs/ffs/ffs_snapshot.c | 40 ++++++++++++++++++++++------------------
1 files changed, 22 insertions(+), 18 deletions(-)
diffs (97 lines):
diff -r a882fb6a88f0 -r 8b25dda33de4 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c Thu Feb 17 17:13:48 2011 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c Fri Feb 18 09:51:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_snapshot.c,v 1.102.4.5 2011/02/17 13:28:15 bouyer Exp $ */
+/* $NetBSD: ffs_snapshot.c,v 1.102.4.6 2011/02/18 09:51:16 bouyer 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.102.4.5 2011/02/17 13:28:15 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.102.4.6 2011/02/18 09:51:16 bouyer Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -288,7 +288,6 @@
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);
@@ -402,7 +401,8 @@
(void) ffs_truncate(vp, (off_t)0, 0, NOCRED);
UFS_WAPBL_END(mp);
}
- }
+ } else
+ vref(vp);
return (error);
}
@@ -1321,8 +1321,10 @@
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
@@ -1390,7 +1392,6 @@
free(ip->i_snapblklist, M_UFSMNT);
ip->i_snapblklist = NULL;
}
- vrele(vp);
} else
mutex_exit(&si->si_lock);
/*
@@ -1775,25 +1776,28 @@
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);
}
Home |
Main Index |
Thread Index |
Old Index