Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Fix race condition between (create|mknod|mkdir|symlino) and ...
details: https://anonhg.NetBSD.org/src/rev/94efd9c7f701
branches: trunk
changeset: 780869:94efd9c7f701
user: manu <manu%NetBSD.org@localhost>
date: Fri Aug 10 08:42:10 2012 +0000
description:
Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
diffstat:
lib/libpuffs/dispatcher.c | 36 ++++++++++++++++++++++++++----------
sys/fs/puffs/puffs_vnops.c | 6 +++---
2 files changed, 29 insertions(+), 13 deletions(-)
diffs (153 lines):
diff -r 8b833797931f -r 94efd9c7f701 lib/libpuffs/dispatcher.c
--- a/lib/libpuffs/dispatcher.c Fri Aug 10 08:22:49 2012 +0000
+++ b/lib/libpuffs/dispatcher.c Fri Aug 10 08:42:10 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dispatcher.c,v 1.42 2012/07/21 05:17:10 manu Exp $ */
+/* $NetBSD: dispatcher.c,v 1.43 2012/08/10 08:42:10 manu Exp $ */
/*
* Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: dispatcher.c,v 1.42 2012/07/21 05:17:10 manu Exp $");
+__RCSID("$NetBSD: dispatcher.c,v 1.43 2012/08/10 08:42:10 manu Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -315,6 +315,7 @@
struct puffs_vnmsg_create *auxt = auxbuf;
struct puffs_newinfo pni;
struct puffs_cn pcn;
+ struct puffs_node *pn = NULL;
if (pops->puffs_node_create == NULL) {
error = 0;
@@ -343,13 +344,16 @@
if (error) {
pu->pu_pathfree(pu, &pcn.pcn_po_full);
} else {
- struct puffs_node *pn;
-
pn = PU_CMAP(pu, auxt->pvnr_newnode);
pn->pn_po = pcn.pcn_po_full;
}
}
+ if (!error) {
+ if (pn == NULL)
+ pn = PU_CMAP(pu, auxt->pvnr_newnode);
+ pn->pn_nlookup++;
+ }
break;
}
@@ -358,6 +362,7 @@
struct puffs_vnmsg_mknod *auxt = auxbuf;
struct puffs_newinfo pni;
struct puffs_cn pcn;
+ struct puffs_node *pn = NULL;
if (pops->puffs_node_mknod == NULL) {
error = 0;
@@ -386,13 +391,16 @@
if (error) {
pu->pu_pathfree(pu, &pcn.pcn_po_full);
} else {
- struct puffs_node *pn;
-
pn = PU_CMAP(pu, auxt->pvnr_newnode);
pn->pn_po = pcn.pcn_po_full;
}
}
+ if (!error) {
+ if (pn == NULL)
+ pn = PU_CMAP(pu, auxt->pvnr_newnode);
+ pn->pn_nlookup++;
+ }
break;
}
@@ -659,6 +667,7 @@
struct puffs_vnmsg_mkdir *auxt = auxbuf;
struct puffs_newinfo pni;
struct puffs_cn pcn;
+ struct puffs_node *pn = NULL;
if (pops->puffs_node_mkdir == NULL) {
error = 0;
@@ -687,13 +696,16 @@
if (error) {
pu->pu_pathfree(pu, &pcn.pcn_po_full);
} else {
- struct puffs_node *pn;
-
pn = PU_CMAP(pu, auxt->pvnr_newnode);
pn->pn_po = pcn.pcn_po_full;
}
}
+ if (!error) {
+ if (pn == NULL)
+ pn = PU_CMAP(pu, auxt->pvnr_newnode);
+ pn->pn_nlookup++;
+ }
break;
}
@@ -719,6 +731,7 @@
struct puffs_vnmsg_symlink *auxt = auxbuf;
struct puffs_newinfo pni;
struct puffs_cn pcn;
+ struct puffs_node *pn = NULL;
if (pops->puffs_node_symlink == NULL) {
error = 0;
@@ -748,13 +761,16 @@
if (error) {
pu->pu_pathfree(pu, &pcn.pcn_po_full);
} else {
- struct puffs_node *pn;
-
pn = PU_CMAP(pu, auxt->pvnr_newnode);
pn->pn_po = pcn.pcn_po_full;
}
}
+ if (!error) {
+ if (pn == NULL)
+ pn = PU_CMAP(pu, auxt->pvnr_newnode);
+ pn->pn_nlookup++;
+ }
break;
}
diff -r 8b833797931f -r 94efd9c7f701 sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c Fri Aug 10 08:22:49 2012 +0000
+++ b/sys/fs/puffs/puffs_vnops.c Fri Aug 10 08:42:10 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_vnops.c,v 1.171 2012/07/27 07:38:44 manu Exp $ */
+/* $NetBSD: puffs_vnops.c,v 1.172 2012/08/10 08:42:11 manu Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.171 2012/07/27 07:38:44 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.172 2012/08/10 08:42:11 manu Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -446,7 +446,7 @@
}
callinactive(pmp, ck, 0);
- callreclaim(pmp, ck, 0);
+ callreclaim(pmp, ck, 1);
}
/*
Home |
Main Index |
Thread Index |
Old Index