Date: Wed, 19 Dec 2001 15:59:47 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Josef Karthauser <joe@tao.org.uk> Cc: freebsd-current@FreeBSD.ORG Subject: Found second pseudofs bug... Message-ID: <200112192359.fBJNxlb21845@apollo.backplane.com> References: <200112182048.fBIKmsw61056@freefall.freebsd.org> <20011218233427.C412@tao.org.uk> <200112190103.fBJ134885760@apollo.backplane.com> <20011219010928.A3769@tao.org.uk> <200112190118.fBJ1IZQ85907@apollo.backplane.com> <20011219012344.A4024@tao.org.uk> <200112190802.fBJ82n387037@apollo.backplane.com> <20011219183715.A9679@tao.org.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
Really easy to reproduce.
ls -lR /proc
vmstat -m | fgrep vfscache
ls -lR /proc
vmstat -m | fgrep vfscache
ls -lR /proc
vmstat -m | fgrep vfscache
The pseudofs code is using the wrong VOP descriptor, but I'll let DES
fix it when he gets back. In the mean time I have added appropriate
comments and cache_purge() calls and committed the interim fix
to -current. I also adding a missing cache_purge() call to the reclaim
code which is required to be there regardless of the VOP descriptor
issue.
Josef, I believe that this plus the last patch, both of which are now
in -current, will solve your problem. Note: cvsup repositories may
not have been updated as of the time of this posting.
-Matt
Index: fs/pseudofs//pseudofs_vncache.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/pseudofs/pseudofs_vncache.c,v
retrieving revision 1.9
diff -u -r1.9 pseudofs_vncache.c
--- fs/pseudofs//pseudofs_vncache.c 3 Nov 2001 03:07:09 -0000 1.9
+++ fs/pseudofs//pseudofs_vncache.c 19 Dec 2001 23:49:48 -0000
@@ -105,9 +105,11 @@
{
struct pfs_vdata *pvd;
int error;
-
- /* see if the vnode is in the cache */
- /* XXX linear search... not very efficient */
+
+ /*
+ * See if the vnode is in the cache.
+ * XXX linear search is not very efficient.
+ */
mtx_lock(&pfs_vncache_mutex);
for (pvd = pfs_vncache; pvd; pvd = pvd->pvd_next) {
if (pvd->pvd_pn == pn && pvd->pvd_pid == pid) {
@@ -115,6 +117,8 @@
++pfs_vncache_hits;
*vpp = pvd->pvd_vnode;
mtx_unlock(&pfs_vncache_mutex);
+ /* XXX see comment at top of pfs_lookup() */
+ cache_purge(*vpp);
return (0);
}
/* XXX if this can happen, we're in trouble */
@@ -176,6 +180,8 @@
pfs_vncache_free(struct vnode *vp)
{
struct pfs_vdata *pvd;
+
+ cache_purge(vp);
mtx_lock(&pfs_vncache_mutex);
pvd = (struct pfs_vdata *)vp->v_data;
Index: fs/pseudofs//pseudofs_vnops.c
===================================================================
RCS file: /home/ncvs/src/sys/fs/pseudofs/pseudofs_vnops.c,v
retrieving revision 1.20
diff -u -r1.20 pseudofs_vnops.c
--- fs/pseudofs//pseudofs_vnops.c 11 Dec 2001 20:48:20 -0000 1.20
+++ fs/pseudofs//pseudofs_vnops.c 19 Dec 2001 23:52:06 -0000
@@ -293,6 +293,15 @@
/*
* Look up a file or directory
+ *
+ * XXX NOTE! pfs_lookup() has been hooked into vop_lookup_desc! This
+ * will result in a lookup operation for a vnode which may already be
+ * cached, therefore we have to be careful to purge the VFS cache when
+ * reusing a vnode.
+ *
+ * This code will work, but is not really correct. Normally we would hook
+ * vfs_cache_lookup() into vop_lookup_desc and hook pfs_lookup() into
+ * vop_cachedlookup_desc.
*/
static int
pfs_lookup(struct vop_lookup_args *va)
@@ -385,6 +394,9 @@
error = pfs_vncache_alloc(vn->v_mount, vpp, pn, pid);
if (error)
PFS_RETURN (error);
+ /*
+ * XXX See comment at top of the routine.
+ */
if (cnp->cn_flags & MAKEENTRY)
cache_enter(vn, *vpp, cnp);
PFS_RETURN (0);
@@ -693,7 +705,7 @@
pfs_reclaim(struct vop_reclaim_args *va)
{
PFS_TRACE((((struct pfs_vdata *)va->a_vp->v_data)->pvd_pn->pn_name));
-
+
return (pfs_vncache_free(va->a_vp));
}
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112192359.fBJNxlb21845>
