[SSI] openssi/kernel/cluster/ssi/vproc reopen.c,1.34,1.35

Roger Tsang <[email protected]> Fri, 05 Mar 2010 06:30:23 +0000
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv9483/kernel/cluster/ssi/vproc

Modified Files:
      Tag: OPENSSI-FC
	reopen.c 
Log Message:
IPC:
- Fix partially initialized shmid_kernel_svr.shm_perm structure.
- Fix ipc/sem.c:exit_sem() GCC warning: ISO C90 forbids mixed declarations and
  code.
- Split ssi_shm_setup() into separate functions ssi_shm_setup_client/new() to
  reduce stack usage in some paths.

IPC (#ifdef IPC_SHM_RACE_FIX):
- Fix shm_svr_rmid() called without spinlock for the ID.
- Fix race deferencing invalid struct shmid_kernel, shmid_kernel_svr.
- Enable lockfree shmid_kernel_svr IPC id lookup. Use ipc_rcu_alloc and IPC
  reference counting.
- Reduce contention. Avoid the ipc_ids mutex. Use per IPC id spinlock.
- Fix cli_ipcname_findid() race with cli_ipcname_getid() could overwrite
  existing IPC segment.
- Fix non-critical section under shm_ids.sem lock in shm_create_cli_entry().
- Prevent re-acquire shm_ids.sem in shm_destroy() path. ripc_shm_rmid() no
  longer returns with shm_ids.sem unlocked.
- Remove contention in shmem_svr_lookup(); no longer acquire shm_ids_svr.sem.
- Fix do_shmat() possible hang calling dput() while holding spinlock.
- Fix cfs_shm_node_mnts[] race.
- Fix inode leak in ssi_shm_setup() error path when do_shm_register() fails.

IPC (#ifdef IPC_SHM_LOCK_DEST_FIX):
- Fix [ ssic-linux-Bug 2838006 ] Corrupt SHM_LOCK_DEST flag.
- Refactor ipc_shm_nodedown() for SHM_LOCK_DEST flag. Use SHM_LOCK_DEST flag.
- Fix ripc_drop_locks() error path dereferencing NULL pointer in
  ipc_drop_locks().

IPC (#ifdef CFS_IPCSHM_DENTRY):
- ssi_shm_setup_client() use d_instantiate_unique() to prevent duplicate
  entries.

 cluster/ssi/cfs/cfs_ipcshm.c     |  422 ++++++++++++++++++-----------
 cluster/ssi/cfs/cfsproc.c        |    6 
 cluster/ssi/ipc/ipcshm_svr.c     |  280 +++++++++++--------
 cluster/ssi/ipc/namesvr_func.c   |   12 
 cluster/ssi/vproc/reopen.c       |   30 +-
 include/cluster/ssi/cfs/cfs_fs.h |   16 +
 include/cluster/ssi/ipc/shm.h    |   13 
 include/linux/shm.h              |    7 
 ipc/msg.c                        |    6 
 ipc/sem.c                        |   17 -
 ipc/shm.c                        |  450 ++++++++++++++++++++-----------
 ipc/util.c                       |   18 -
 ipc/util.h                       |    5 
 mm/shmem.c                       |    9 
 14 files changed, 845 insertions(+), 446 deletions(-)


Index: reopen.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/reopen.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- reopen.c	17 Dec 2009 06:43:51 -0000	1.34
+++ reopen.c	5 Mar 2010 06:30:21 -0000	1.35
@@ -816,11 +816,25 @@
 #endif
 	if (path->svrnode && sscanf (pathname, "/SYSV%x", &key) == 1) {
 		*dentryp = ssi_shm_setup(path->svrnode, path->ino, 0, key);
-		if (*dentryp) {
+#ifdef IPC_SHM_RACE_FIX
+		if (*dentryp == NULL) {
+			*mntp = NULL;
+			goto out;
+		}
+		read_lock(&cfs_shm_node_mnts_lock);
+		*mntp = mntget(cfs_shm_node_mnts[path->svrnode]);
+		read_unlock(&cfs_shm_node_mnts_lock);
+		if (*mntp != NULL)
 			error = 0;
+		/* else lost race with nodedown */
+		goto out;
+#else /* IPC_SHM_RACE_FIX */
+		if (*dentryp) {
 			*mntp = mntget(cfs_shm_node_mnts[path->svrnode]);
+			error = 0;
 			goto out;
 		}
+#endif /* !IPC_SHM_RACE_FIX */
 	}
 	if (!path->deleted) {
 #ifdef REOP_EXPORT_PATH_SVRNODE
@@ -913,6 +927,19 @@
 	/* SSI_XXX: clean up */
 
 out:
+#ifdef IPC_SHM_RACE_FIX
+	if (error && *dentryp) {
+		if (*dentryp) {
+			dput(*dentryp);
+			*dentryp = NULL;
+		}
+		if (*mntp) {
+			mntput(*mntp);
+			*mntp = NULL;
+		}
+	}
+	SSI_ASSERT(!*dentryp || (*dentryp)->d_sb == (*mntp)->mnt_sb);
+#else /* IPC_SHM_RACE_FIX */
 	SSI_ASSERT((*dentryp)->d_sb == (*mntp)->mnt_sb);
 
 	if (error && *dentryp) {
@@ -923,6 +950,7 @@
 		*dentryp = NULL;
 		*mntp = NULL;
 	}
+#endif /* !IPC_SHM_RACE_FIX */
 	if (error)
 		printk(KERN_ERR "reop_import_path: failed error %d path %s\n",
 						 error, pathname);


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev