Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/fs/puffs Kill suspend support. It was never implemented...
details: https://anonhg.NetBSD.org/src/rev/417f063c15ad
branches: trunk
changeset: 748811:417f063c15ad
user: pooka <pooka%NetBSD.org@localhost>
date: Thu Nov 05 19:42:44 2009 +0000
description:
Kill suspend support. It was never implemented correctly:
* it depended on the biglock (in a very cruel way)
* it was attached to userspace transactions rather than logical
fs operations
(If someone wants to revisit it some day, most of the stuff can be
reused from cvs history)
diffstat:
sys/fs/puffs/puffs_msgif.c | 113 +------------------------------------
sys/fs/puffs/puffs_node.c | 5 +-
sys/fs/puffs/puffs_sys.h | 4 +-
sys/fs/puffs/puffs_vfsops.c | 129 +++----------------------------------------
sys/fs/puffs/puffs_vnops.c | 91 ++----------------------------
5 files changed, 25 insertions(+), 317 deletions(-)
diffs (truncated from 583 to 300 lines):
diff -r 21224b8d3396 -r 417f063c15ad sys/fs/puffs/puffs_msgif.c
--- a/sys/fs/puffs/puffs_msgif.c Thu Nov 05 19:34:06 2009 +0000
+++ b/sys/fs/puffs/puffs_msgif.c Thu Nov 05 19:42:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_msgif.c,v 1.73 2009/03/18 10:22:42 cegger Exp $ */
+/* $NetBSD: puffs_msgif.c,v 1.74 2009/11/05 19:42:44 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -30,11 +30,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.73 2009/03/18 10:22:42 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_msgif.c,v 1.74 2009/11/05 19:42:44 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
-#include <sys/fstrans.h>
#include <sys/kmem.h>
#include <sys/kthread.h>
#include <sys/lock.h>
@@ -366,38 +365,7 @@
}
}
- /*
- * test for suspension lock.
- *
- * Note that we *DO NOT* keep the lock, since that might block
- * lock acquiring PLUS it would give userlandia control over
- * the lock. The operation queue enforces a strict ordering:
- * when the fs server gets in the op stream, it knows things
- * are in order. The kernel locks can't guarantee that for
- * userspace, in any case.
- *
- * BUT: this presents a problem for ops which have a consistency
- * clause based on more than one operation. Unfortunately such
- * operations (read, write) do not reliably work yet.
- *
- * Ya, Ya, it's wrong wong wrong, me be fixink this someday.
- *
- * XXX: and there is one more problem. We sometimes need to
- * take a lazy lock in case the fs is suspending and we are
- * executing as the fs server context. This might happen
- * e.g. in the case that the user server triggers a reclaim
- * in the kernel while the fs is suspending. It's not a very
- * likely event, but it needs to be fixed some day.
- */
-
- /*
- * MOREXXX: once PUFFS_WCACHEINFO is enabled, we can't take
- * the mutex here, since getpages() might be called locked.
- */
- fstrans_start(mp, FSTRANS_NORMAL);
mutex_enter(&pmp->pmp_lock);
- fstrans_done(mp);
-
if (pmp->pmp_status != PUFFSTAT_RUNNING) {
mutex_exit(&pmp->pmp_lock);
park->park_flags |= PARKFLAG_HASERROR;
@@ -432,7 +400,6 @@
puffs_msg_wait(struct puffs_mount *pmp, struct puffs_msgpark *park)
{
struct puffs_req *preq = park->park_preq; /* XXX: hmmm */
- struct mount *mp = PMPTOMP(pmp);
int error = 0;
int rv;
@@ -504,20 +471,6 @@
mutex_exit(&park->park_mtx);
}
- /*
- * retake the lock and release. This makes sure (haha,
- * I'm humorous) that we don't process the same vnode in
- * multiple threads due to the locks hacks we have in
- * puffs_lock(). In reality this is well protected by
- * the biglock, but once that's gone, well, hopefully
- * this will be fixed for real. (and when you read this
- * comment in 2017 and subsequently barf, my condolences ;).
- */
- if (rv == 0 && !fstrans_is_owner(mp)) {
- fstrans_start(mp, FSTRANS_NORMAL);
- fstrans_done(mp);
- }
-
skipwait:
mutex_enter(&pmp->pmp_lock);
puffs_mp_release(pmp);
@@ -799,63 +752,6 @@
puffs_msgpark_release1(park, 2);
}
-/*
- * helpers
- */
-static void
-dosuspendresume(void *arg)
-{
- struct puffs_mount *pmp = arg;
- struct mount *mp;
- int rv;
-
- mp = PMPTOMP(pmp);
- /*
- * XXX? does this really do any good or is it just
- * paranoid stupidity? or stupid paranoia?
- */
- if (mp->mnt_iflag & IMNT_UNMOUNT) {
- printf("puffs dosuspendresume(): detected suspend on "
- "unmounting fs\n");
- goto out;
- }
-
- /* Do the dance. Allow only one concurrent suspend */
- rv = vfs_suspend(PMPTOMP(pmp), 1);
- if (rv == 0)
- vfs_resume(PMPTOMP(pmp));
-
- out:
- mutex_enter(&pmp->pmp_lock);
- KASSERT(pmp->pmp_suspend == 1);
- pmp->pmp_suspend = 0;
- puffs_mp_release(pmp);
- mutex_exit(&pmp->pmp_lock);
-
- kthread_exit(0);
-}
-
-static void
-puffsop_suspend(struct puffs_mount *pmp)
-{
- int rv = 0;
-
- mutex_enter(&pmp->pmp_lock);
- if (pmp->pmp_suspend || pmp->pmp_status != PUFFSTAT_RUNNING) {
- rv = EBUSY;
- } else {
- puffs_mp_reference(pmp);
- pmp->pmp_suspend = 1;
- }
- mutex_exit(&pmp->pmp_lock);
- if (rv)
- return;
- rv = kthread_create(PRI_NONE, 0, NULL, dosuspendresume,
- pmp, NULL, "puffsusp");
-
- /* XXX: "return" rv */
-}
-
static void
puffsop_flush(struct puffs_mount *pmp, struct puffs_flush *pf)
{
@@ -949,6 +845,7 @@
{
struct puffs_mount *pmp = this;
struct puffs_req *preq = (struct puffs_req *)pth;
+ int rv = 0;
/* XXX: need to send error to userspace */
if (pth->pth_framelen < sizeof(struct puffs_req)) {
@@ -968,7 +865,7 @@
break;
case PUFFSOP_SUSPEND:
DPRINTF(("dispatch: suspend\n"));
- puffsop_suspend(pmp);
+ rv = EOPNOTSUPP;
break;
default:
DPRINTF(("dispatch: invalid class 0x%x\n", preq->preq_opclass));
@@ -976,7 +873,7 @@
break;
}
- return 0;
+ return rv;
}
int
diff -r 21224b8d3396 -r 417f063c15ad sys/fs/puffs/puffs_node.c
--- a/sys/fs/puffs/puffs_node.c Thu Nov 05 19:34:06 2009 +0000
+++ b/sys/fs/puffs/puffs_node.c Thu Nov 05 19:42:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_node.c,v 1.14 2009/09/30 18:19:17 pooka Exp $ */
+/* $NetBSD: puffs_node.c,v 1.15 2009/11/05 19:42:44 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.14 2009/09/30 18:19:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_node.c,v 1.15 2009/11/05 19:42:44 pooka Exp $");
#include <sys/param.h>
#include <sys/hash.h>
@@ -93,7 +93,6 @@
error = getnewvnode(VT_PUFFS, mp, puffs_vnodeop_p, &vp);
if (error)
goto bad;
- vp->v_vnlock = NULL;
vp->v_type = type;
/*
diff -r 21224b8d3396 -r 417f063c15ad sys/fs/puffs/puffs_sys.h
--- a/sys/fs/puffs/puffs_sys.h Thu Nov 05 19:34:06 2009 +0000
+++ b/sys/fs/puffs/puffs_sys.h Thu Nov 05 19:42:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_sys.h,v 1.71 2009/11/05 19:22:57 pooka Exp $ */
+/* $NetBSD: puffs_sys.h,v 1.72 2009/11/05 19:42:44 pooka Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@@ -153,7 +153,7 @@
#define PNODE_NOREFS 0x01 /* no backend reference */
#define PNODE_DYING 0x02 /* NOREFS + inactive */
-#define PNODE_SUSPEND 0x04 /* issue all operations as FAF */
+#define PNODE_FAF 0x04 /* issue all operations as FAF */
#define PNODE_DOINACT 0x08 /* if inactive-on-demand, call inactive */
#define PNODE_METACACHE_ATIME 0x10 /* cache atime metadata */
diff -r 21224b8d3396 -r 417f063c15ad sys/fs/puffs/puffs_vfsops.c
--- a/sys/fs/puffs/puffs_vfsops.c Thu Nov 05 19:34:06 2009 +0000
+++ b/sys/fs/puffs/puffs_vfsops.c Thu Nov 05 19:42:44 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: puffs_vfsops.c,v 1.82 2009/03/18 10:22:42 cegger Exp $ */
+/* $NetBSD: puffs_vfsops.c,v 1.83 2009/11/05 19:42:44 pooka Exp $ */
/*
* Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.82 2009/03/18 10:22:42 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vfsops.c,v 1.83 2009/11/05 19:42:44 pooka Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -40,7 +40,6 @@
#include <sys/vnode.h>
#include <sys/dirent.h>
#include <sys/kauth.h>
-#include <sys/fstrans.h>
#include <sys/proc.h>
#include <sys/module.h>
@@ -109,9 +108,6 @@
if (!data)
return EINVAL;
- error = fstrans_mount(mp);
- if (error)
- return error;
args = (struct puffs_kargs *)data;
/* devel phase */
@@ -224,7 +220,6 @@
mp->mnt_dev_bshift = DEV_BSHIFT;
mp->mnt_flag &= ~MNT_LOCAL; /* we don't really know, so ... */
mp->mnt_data = pmp;
- mp->mnt_iflag |= IMNT_HAS_TRANS;
pmp->pmp_status = PUFFSTAT_MOUNTING;
pmp->pmp_mp = mp;
@@ -267,8 +262,6 @@
vfs_getnewfsid(mp);
out:
- if (error)
- fstrans_unmount(mp);
if (error && pmp && pmp->pmp_pnodehash)
kmem_free(pmp->pmp_pnodehash, BUCKETALLOC(pmp->pmp_npnodehash));
if (error && pmp)
@@ -365,7 +358,6 @@
cv_destroy(&pmp->pmp_msg_waiter_cv);
mutex_destroy(&pmp->pmp_lock);
- fstrans_unmount(mp);
kmem_free(pmp->pmp_pnodehash, BUCKETALLOC(pmp->pmp_npnodehash));
kmem_free(pmp, sizeof(struct puffs_mount));
error = 0;
@@ -436,17 +428,12 @@
}
static int
-pageflush(struct mount *mp, kauth_cred_t cred, int waitfor, int suspending)
+pageflush(struct mount *mp, kauth_cred_t cred, int waitfor)
{
struct puffs_node *pn;
struct vnode *vp, *mvp;
int error, rv;
- KASSERT(((waitfor == MNT_WAIT) && suspending) == 0);
- KASSERT((suspending == 0)
- || (fstrans_is_owner(mp)
- && fstrans_getstate(mp) == FSTRANS_SUSPENDING));
Home |
Main Index |
Thread Index |
Old Index