Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Reset node's parent pointer when it's removed. Technically the
details: https://anonhg.NetBSD.org/src/rev/4830e413bbf3
branches: trunk
changeset: 762816:4830e413bbf3
user: pooka <pooka%NetBSD.org@localhost>
date: Tue Mar 01 15:14:35 2011 +0000
description:
Reset node's parent pointer when it's removed. Technically the
parent still exists, but allows us to avoid complicated g/c algorithms
if the parent *is* removed.
diffstat:
sys/rump/librump/rumpvfs/rumpfs.c | 9 +++++----
tests/fs/puffs/h_dtfs/dtfs_subr.c | 8 ++++++--
tests/fs/puffs/h_dtfs/dtfs_vnops.c | 5 ++++-
3 files changed, 15 insertions(+), 7 deletions(-)
diffs (79 lines):
diff -r 13158a2c123c -r 4830e413bbf3 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Tue Mar 01 15:04:47 2011 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Tue Mar 01 15:14:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.91 2011/02/02 15:58:09 pooka Exp $ */
+/* $NetBSD: rumpfs.c,v 1.92 2011/03/01 15:14:35 pooka Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.91 2011/02/02 15:58:09 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.92 2011/03/01 15:14:35 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -733,8 +733,8 @@
goto getvnode;
} else {
if (dotdot) {
- rn = rnd->rn_parent;
- goto getvnode;
+ if ((rn = rnd->rn_parent) != NULL)
+ goto getvnode;
} else {
LIST_FOREACH(rd, &rnd->rn_dir, rd_entries) {
if (rd->rd_namelen == cnp->cn_namelen &&
@@ -927,6 +927,7 @@
freedir(rnd, cnp);
rn->rn_flags |= RUMPNODE_CANRECLAIM;
+ rn->rn_parent = NULL;
out:
vput(dvp);
diff -r 13158a2c123c -r 4830e413bbf3 tests/fs/puffs/h_dtfs/dtfs_subr.c
--- a/tests/fs/puffs/h_dtfs/dtfs_subr.c Tue Mar 01 15:04:47 2011 +0000
+++ b/tests/fs/puffs/h_dtfs/dtfs_subr.c Tue Mar 01 15:14:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dtfs_subr.c,v 1.2 2010/07/14 13:09:52 pooka Exp $ */
+/* $NetBSD: dtfs_subr.c,v 1.3 2011/03/01 15:19:49 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@@ -314,8 +314,12 @@
assert(pn_dir->pn_va.va_type == VDIR);
LIST_REMOVE(dent, dfd_entries);
- if (pn_file->pn_va.va_type == VDIR)
+ if (pn_file->pn_va.va_type == VDIR) {
+ struct dtfs_file *df = DTFS_PTOF(pn_file);
+
pn_dir->pn_va.va_nlink--;
+ df->df_dotdot = NULL;
+ }
pn_file->pn_va.va_nlink--;
assert(pn_dir->pn_va.va_nlink >= 2);
diff -r 13158a2c123c -r 4830e413bbf3 tests/fs/puffs/h_dtfs/dtfs_vnops.c
--- a/tests/fs/puffs/h_dtfs/dtfs_vnops.c Tue Mar 01 15:04:47 2011 +0000
+++ b/tests/fs/puffs/h_dtfs/dtfs_vnops.c Tue Mar 01 15:14:35 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dtfs_vnops.c,v 1.7 2010/07/21 06:58:25 pooka Exp $ */
+/* $NetBSD: dtfs_vnops.c,v 1.8 2011/03/01 15:19:49 pooka Exp $ */
/*
* Copyright (c) 2006 Antti Kantee. All Rights Reserved.
@@ -51,6 +51,9 @@
/* parent dir? */
if (PCNISDOTDOT(pcn)) {
+ if (df->df_dotdot == NULL)
+ return ENOENT;
+
assert(df->df_dotdot->pn_va.va_type == VDIR);
puffs_newinfo_setcookie(pni, df->df_dotdot);
puffs_newinfo_setvtype(pni, df->df_dotdot->pn_va.va_type);
Home |
Main Index |
Thread Index |
Old Index