Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Aug 2016 08:57:15 +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: r303705 - head/sys/fs/pseudofs
Message-ID:  <201608030857.u738vFbF085386@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Aug  3 08:57:15 2016
New Revision: 303705
URL: https://svnweb.freebsd.org/changeset/base/303705

Log:
  Remove Giant asserts.  Update comment.
  
  Owning Giant in the init/uninit is accidental due to the moment where
  VFS modules initialization is performed, and is not enforced by the
  VFS interface.  The Giant lock does not prevent a parallel execution
  of the code, it is VFS which implements the proper protocol.
  
  Approved by:	des (pseudofs maintainer)
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

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

Modified: head/sys/fs/pseudofs/pseudofs.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs.c	Wed Aug  3 08:53:29 2016	(r303704)
+++ head/sys/fs/pseudofs/pseudofs.c	Wed Aug  3 08:57:15 2016	(r303705)
@@ -383,8 +383,6 @@ pfs_init(struct pfs_info *pi, struct vfs
 	struct pfs_node *root;
 	int error;
 
-	mtx_assert(&Giant, MA_OWNED);
-
 	pfs_fileno_init(pi);
 
 	/* set up the root directory */
@@ -414,8 +412,6 @@ pfs_uninit(struct pfs_info *pi, struct v
 {
 	int error;
 
-	mtx_assert(&Giant, MA_OWNED);
-
 	pfs_destroy(pi->pi_root);
 	pi->pi_root = NULL;
 	pfs_fileno_uninit(pi);

Modified: head/sys/fs/pseudofs/pseudofs.h
==============================================================================
--- head/sys/fs/pseudofs/pseudofs.h	Wed Aug  3 08:53:29 2016	(r303704)
+++ head/sys/fs/pseudofs/pseudofs.h	Wed Aug  3 08:57:15 2016	(r303705)
@@ -189,9 +189,9 @@ typedef int (*pfs_destroy_t)(PFS_DESTROY
 /*
  * pfs_info: describes a pseudofs instance
  *
- * The pi_mutex is only used to avoid using the global subr_unit lock for
- * unrhdr.  The rest of struct pfs_info is only modified while Giant is
- * held (during vfs_init() and vfs_uninit()).
+ * The pi_mutex is only used to avoid using the global subr_unit lock
+ * for unrhdr.  The rest of struct pfs_info is only modified during
+ * vfs_init() and vfs_uninit() of the consumer filesystem.
  */
 struct pfs_info {
 	char			 pi_name[PFS_FSNAMELEN];

Modified: head/sys/fs/pseudofs/pseudofs_fileno.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_fileno.c	Wed Aug  3 08:53:29 2016	(r303704)
+++ head/sys/fs/pseudofs/pseudofs_fileno.c	Wed Aug  3 08:57:15 2016	(r303705)
@@ -52,7 +52,6 @@ void
 pfs_fileno_init(struct pfs_info *pi)
 {
 
-	mtx_assert(&Giant, MA_OWNED);
 	mtx_init(&pi->pi_mutex, "pfs_fileno", NULL, MTX_DEF);
 	pi->pi_unrhdr = new_unrhdr(3, INT_MAX / NO_PID, &pi->pi_mutex);
 }
@@ -64,7 +63,6 @@ void
 pfs_fileno_uninit(struct pfs_info *pi)
 {
 
-	mtx_assert(&Giant, MA_OWNED);
 	delete_unrhdr(pi->pi_unrhdr);
 	pi->pi_unrhdr = NULL;
 	mtx_destroy(&pi->pi_mutex);

Modified: head/sys/fs/pseudofs/pseudofs_vncache.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vncache.c	Wed Aug  3 08:53:29 2016	(r303704)
+++ head/sys/fs/pseudofs/pseudofs_vncache.c	Wed Aug  3 08:57:15 2016	(r303705)
@@ -84,7 +84,6 @@ void
 pfs_vncache_load(void)
 {
 
-	mtx_assert(&Giant, MA_OWNED);
 	mtx_init(&pfs_vncache_mutex, "pfs_vncache", NULL, MTX_DEF);
 	pfs_exit_tag = EVENTHANDLER_REGISTER(process_exit, pfs_exit, NULL,
 	    EVENTHANDLER_PRI_ANY);
@@ -97,7 +96,6 @@ void
 pfs_vncache_unload(void)
 {
 
-	mtx_assert(&Giant, MA_OWNED);
 	EVENTHANDLER_DEREGISTER(process_exit, pfs_exit_tag);
 	KASSERT(pfs_vncache_entries == 0,
 	    ("%d vncache entries remaining", pfs_vncache_entries));



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