Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Dec 2008 13:25:58 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186565 - head/sys/fs/pseudofs
Message-ID:  <200812291325.mBTDPwtm058443@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Dec 29 13:25:58 2008
New Revision: 186565
URL: http://svn.freebsd.org/changeset/base/186565

Log:
  When the insmntque() in the pfs_vncache_alloc() fails, vop_reclaim calls
  pfs_vncache_free() that removes pvd from the list, while it is not yet
  put on the list.
  
  Prevent the invalid removal from the list by clearing pvd_next and
  pvd_prev for the newly allocated pvd, and only move pfs_vncache list
  head when the pvd was at the head.
  
  Suggested and approved by:	des
  MFC after:	2 weeks

Modified:
  head/sys/fs/pseudofs/pseudofs_vncache.c

Modified: head/sys/fs/pseudofs/pseudofs_vncache.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vncache.c	Mon Dec 29 12:58:45 2008	(r186564)
+++ head/sys/fs/pseudofs/pseudofs_vncache.c	Mon Dec 29 13:25:58 2008	(r186565)
@@ -149,6 +149,7 @@ retry:
 
 	/* nope, get a new one */
 	pvd = malloc(sizeof *pvd, M_PFSVNCACHE, M_WAITOK);
+	pvd->pvd_next = pvd->pvd_prev = NULL;
 	error = getnewvnode("pseudofs", mp, &pfs_vnodeops, vpp);
 	if (error) {
 		free(pvd, M_PFSVNCACHE);
@@ -245,7 +246,7 @@ pfs_vncache_free(struct vnode *vp)
 		pvd->pvd_next->pvd_prev = pvd->pvd_prev;
 	if (pvd->pvd_prev)
 		pvd->pvd_prev->pvd_next = pvd->pvd_next;
-	else
+	else if (pfs_vncache == pvd)
 		pfs_vncache = pvd->pvd_next;
 	--pfs_vncache_entries;
 	mtx_unlock(&pfs_vncache_mutex);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812291325.mBTDPwtm058443>