[SSI] openssi/kernel/cluster/ssi/cfs cfs_ipcshm.c, 1.17, 1.18 cfsproc.c, 1.29, 1.30 svrcfs.c, 1.18, 1.19

Roger Tsang <[email protected]>
Newsgroups gmane.linux.cluster.ssic.cvs
Message-ID <[email protected]>
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14118/cluster/ssi/cfs

Modified Files:
      Tag: OPENSSI-FC
	cfs_ipcshm.c cfsproc.c svrcfs.c 
Log Message:
CFS:
- Allocate file_lock structure from stack in cfs_proc_set/getlock_0(), cfs_rb_dolocks().
- Fix possible busy spin forever in cfs_rb_dolocks(); need error handling.
- Optimize away early malloc in svrtok_lookup(). (#ifdef RCU_CFSTOK_TABLE)

IPC:
- Regression:
  - Partially initialized rmtunix_socket_info structure. (#ifdef RMTUNIX_SOCK_INFO_CACHE)

VPROC:
- Regression:
  - pvpop_reclaim_child() livelock in __ptrace_unlink path. (#ifdef VPROC_RW_LOCK)

 cluster/ssi/cfs/cfs_ipcshm.c     |    4 -
 cluster/ssi/cfs/cfsproc.c        |   90 +++++++++++++++++----------------------
 cluster/ssi/cfs/svrcfs.c         |   24 +++-------
 cluster/ssi/ipc/rmtunix.c        |    8 +--
 cluster/ssi/vproc/dvp_pvpops.c   |   10 ++--
 include/cluster/ssi/ipc/unixnm.h |    9 ++-
 include/cluster/ssi/unix.h       |    6 +-
 7 files changed, 69 insertions(+), 82 deletions(-)


Index: cfs_ipcshm.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfs_ipcshm.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- cfs_ipcshm.c	3 Feb 2009 06:18:12 -0000	1.17
+++ cfs_ipcshm.c	7 Feb 2009 04:19:43 -0000	1.18
@@ -141,10 +141,10 @@
 		de = d_alloc(cfs_shm_sb->s_root, &this);
 		de->d_sb = ip->i_sb;
 		de->d_parent = cfs_shm_sb->s_root;
-		d_instantiate(de, ip);
 #ifdef CFS_IPCSHM_DENTRY
-		d_rehash(de);
+		d_add(de, ip);
 #else
+		d_instantiate(de, ip);
 		d_rehash(shmsvr->shm_svr->sct_dp);
 #endif
 		return de;

Index: svrcfs.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/svrcfs.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- svrcfs.c	3 Feb 2009 06:18:12 -0000	1.18
+++ svrcfs.c	7 Feb 2009 04:19:43 -0000	1.19
@@ -324,10 +324,10 @@
 struct svrcfstok *
 svrtok_lookup(cfhandle_t *fhp, struct dentry *dentry, struct super_block *mount_sb)
 {
-	struct svrcfstok *newhp = NULL;
 	struct svrcfstok *hp;
 	int i;
 #ifndef RCU_CFSTOK_TABLE
+	struct svrcfstok *newhp = NULL;
 #ifdef CFSTOK_TABLE_LOCK_LOCK
 	int locked = FALSE;
 #endif
@@ -354,12 +354,6 @@
 		if (hp || !dentry)
 			break;
 #ifdef RCU_CFSTOK_TABLE
-#ifdef SVRCFS_TOKEN_KMEM_CACHE
-		newhp = kmem_cache_alloc(svrcfstok_cachep, GFP_KERNEL|__GFP_NOFAIL);
-#else
-		newhp = kmalloc_nofail(sizeof(*hp));
-#endif
-
 		WARN_ON(sem_owned(&dentry->d_inode->i_sem));
 		down(&dentry->d_inode->i_sem);
 
@@ -370,8 +364,12 @@
 			up(&dentry->d_inode->i_sem);
 			break;
 		}
-		hp = newhp;
+#ifdef SVRCFS_TOKEN_KMEM_CACHE
+		hp = kmem_cache_alloc(svrcfstok_cachep, GFP_KERNEL|__GFP_NOFAIL);
 #else
+		hp = kmalloc_nofail(sizeof(*hp));
+#endif
+#else /* !RCU_CFSTOK_TABLE */
 		hp = newhp;
 		if (!hp) {
 			hp = kmalloc(sizeof(*hp), GFP_ATOMIC);
@@ -384,8 +382,8 @@
 				continue;
 			}
 		}
-#endif /* !RCU_CFSTOK_TABLE */
 		newhp = NULL;
+#endif /* !RCU_CFSTOK_TABLE */
 		hash = svrhash(fhp);
 
 		hp->sct_fh = *fhp;
@@ -562,13 +560,9 @@
 	if (locked)
 #endif
 	UNLOCK_LOCK(&svrcfstok_table_lock);
-#endif /* !RCU_CFSTOK_TABLE */
-	if (unlikely(newhp))
-#ifdef SVRCFS_TOKEN_KMEM_CACHE
-		kmem_cache_free(svrcfstok_cachep, newhp);
-#else
+	if (newhp)
 		kfree(newhp);
-#endif
+#endif /* !RCU_CFSTOK_TABLE */
 
 	/*
 	 * The dentry inode referenced by the svrcfstok structure is the same

Index: cfsproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/cfs/cfsproc.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cfsproc.c	3 Feb 2009 06:18:12 -0000	1.29
+++ cfsproc.c	7 Feb 2009 04:19:43 -0000	1.30
@@ -1701,7 +1701,7 @@
 	struct inode *inode;
 	struct dentry *dentry;
 	int error;
-	struct file_lock *fl;
+	struct file_lock fl;
 
 	hp = fhtohp(&args->cfrla_fh);
 	SSI_ASSERT(hp);
@@ -1711,11 +1711,7 @@
 	SSI_ASSERT(dentry);
 
 	error = -ENOLCK;
-	/* SSI_XXX: Why not just have this on the stack? */
-	fl = (struct file_lock *) kmalloc(sizeof(*fl), GFP_KERNEL);
-	if (fl == NULL)
-		goto out;
-	locks_init_lock(fl);
+	locks_init_lock(&fl);
 
 	error = cfs_setup_sct_fp(hp);
 	if (error)
@@ -1724,24 +1720,23 @@
 	filp = hp->sct_fp;
 	SSI_ASSERT(filp->f_dentry->d_inode == inode);
 
-	fl->fl_lmops = &cfs_lockm_operations;
-	fl->fl_start = args->cfrla_start;
-	fl->fl_end = args->cfrla_end;
+	fl.fl_lmops = &cfs_lockm_operations;
+	fl.fl_start = args->cfrla_start;
+	fl.fl_end = args->cfrla_end;
 
 	/* SSI_XXX: If this is a lock on behalf of a remote NFS client, than
 	 * this value must relate to a lockd(s) is some way, but
 	 * we've gone remote internally in the cluster, so something
 	 * else must go here.
 	 */
-	fl->fl_pid = args->cfrla_pid;	/* Cluster wide unique */
-	fl->fl_file = filp;
-	fl->fl_flags = args->cfrla_flags;
-	SSI_ASSERT(fl->fl_flags == FL_POSIX);
-	fl->fl_type = args->cfrla_type;
+	fl.fl_pid = args->cfrla_pid;	/* Cluster wide unique */
+	fl.fl_file = filp;
+	fl.fl_flags = args->cfrla_flags;
+	SSI_ASSERT(fl.fl_flags == FL_POSIX);
+	fl.fl_type = args->cfrla_type;
 
-	error = posix_lock_file_wait(filp, fl);
+	error = posix_lock_file_wait(filp, &fl);
 out:
-	kfree(fl);
 	*statusp = error;
 
 	HASH_RELE(hp);
@@ -1755,7 +1750,7 @@
 	struct inode *inode;
 	struct dentry *dentry;
 	int error;
-	struct file_lock *fl, *resfl;
+	struct file_lock fl, *resfl;
 
 	hp = fhtohp(&args->cfrla_fh);
 	SSI_ASSERT(hp);
@@ -1765,11 +1760,7 @@
 	SSI_ASSERT(dentry);
 
 	error = -ENOLCK;
-	/* SSI_XXX: Why not just have this on the stack? */
-	fl = (struct file_lock *) kmalloc(sizeof(*fl), GFP_KERNEL);
-	if (fl == NULL)
-		goto out;
-	locks_init_lock(fl);
+	locks_init_lock(&fl);
 
 	error = cfs_setup_sct_fp(hp);
 	if (error)
@@ -1778,23 +1769,23 @@
 	filp = hp->sct_fp;
 	SSI_ASSERT(filp->f_dentry->d_inode == inode);
 
-	fl->fl_lmops = &cfs_lockm_operations;
-	fl->fl_start = args->cfrla_start;
-	fl->fl_end = args->cfrla_end;
+	fl.fl_lmops = &cfs_lockm_operations;
+	fl.fl_start = args->cfrla_start;
+	fl.fl_end = args->cfrla_end;
 
 	/* If this is a lock on behalf of a remote NFS client, than
 	 * this value must relate to a lockd(s) is some way, but
 	 * we've gone remote internally in the cluster, so something
 	 * else must go into here.
 	 */
-	fl->fl_pid = args->cfrla_pid;	/* Cluster wide unique */
-	fl->fl_file = filp;
-	fl->fl_flags = args->cfrla_flags;
-	SSI_ASSERT(fl->fl_flags == FL_POSIX);
-	fl->fl_type = args->cfrla_type;
+	fl.fl_pid = args->cfrla_pid;	/* Cluster wide unique */
+	fl.fl_file = filp;
+	fl.fl_flags = args->cfrla_flags;
+	SSI_ASSERT(fl.fl_flags == FL_POSIX);
+	fl.fl_type = args->cfrla_type;
 
 	error = 0;
-	resfl = posix_test_lock(filp, fl);
+	resfl = posix_test_lock(filp, &fl);
 	if (resfl == NULL)
 		resp->clro_type = F_UNLCK;
 	else {
@@ -1806,7 +1797,6 @@
 	}
 
 out:
-	kfree(fl);
 	resp->clro_status = error;
 
 	HASH_RELE(hp);
@@ -1826,7 +1816,7 @@
 	struct inode *inode;
 	struct dentry *dentry;
 	int error;
-	struct file_lock *fl;
+	struct file_lock fl;
 
 	/* During failover, this must already have been created */
 	hp = fhtohp(&args->cla_fhandle);
@@ -1836,44 +1826,44 @@
 	dentry = hp->sct_dp;
 	SSI_ASSERT(dentry);
 
-	/* SSI_XXX: Why not just have this on the stack? */
-	fl = (struct file_lock *) kmalloc_nofail(sizeof(*fl));
-	locks_init_lock(fl);
+	locks_init_lock(&fl);
 
-nofail:
+//nofail:
 	error = cfs_setup_sct_fp(hp);
+	BUG_ON(error);	/* SSI_XXX: need error handling? */
+#if 0
+	/* SSI_XXX: could busy spin */
 	if (error)
 		goto nofail;
+#endif
 
 	filp = hp->sct_fp;
 	SSI_ASSERT(filp->f_dentry->d_inode == inode);
 
-	fl->fl_lmops = &cfs_lockm_operations;
-	fl->fl_start = args->cla_start;
-	fl->fl_end = args->cla_end;
+	fl.fl_lmops = &cfs_lockm_operations;
+	fl.fl_start = args->cla_start;
+	fl.fl_end = args->cla_end;
 
 	/* SSI_XXX: If this is a lock on behalf of a remote NFS client, than
 	 * this value must relate to a lockd(s) is some way, but
 	 * we've gone remote internally in the cluster, so something
 	 * else must go here.
 	 */
-	fl->fl_pid = args->cla_pid;	/* Cluster wide unique */
-	fl->fl_file = filp;
-	fl->fl_flags = args->cla_flags;
-	SSI_ASSERT(fl->fl_flags == FL_POSIX);
-	fl->fl_type = args->cla_type;
+	fl.fl_pid = args->cla_pid;	/* Cluster wide unique */
+	fl.fl_file = filp;
+	fl.fl_flags = args->cla_flags;
+	SSI_ASSERT(fl.fl_flags == FL_POSIX);
+	fl.fl_type = args->cla_type;
 
 	/* This lock request can't fail because we're failing over a
 	 * hard mount and new operations are blocked.  We are just getting
 	 * a lock we had before the failure.
 	 */
-	fl->fl_flags &= ~FL_SLEEP;
-	error = posix_lock_file(filp, fl);
+	fl.fl_flags &= ~FL_SLEEP;
+	error = posix_lock_file(filp, &fl);
 
-	if (error)
-		BUG();
+	BUG_ON(error);
 
-	kfree(fl);
 	HASH_RELE(hp);
 }
 


------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.