[SSI] openssi/kernel/cluster/ssi/vproc rproc_cli_pproc.c, 1.29, 1.30

Roger Tsang <[email protected]> Wed, 15 Dec 2010 06:55:49 +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-serv12335/kernel/cluster/ssi/vproc

Modified Files:
      Tag: OPENSSI-FC
	rproc_cli_pproc.c 
Log Message:
- ssi_recalc_locks: return to caller immediately if a non-CFS lock is encountered, no need to count non-CFS locks. caller wants to know whether there are file locks that cannot be migrated with the process.
- ssi_recalc_locks: use get_files_struct()


Index: rproc_cli_pproc.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/rproc_cli_pproc.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- rproc_cli_pproc.c	9 Nov 2010 02:44:02 -0000	1.29
+++ rproc_cli_pproc.c	15 Dec 2010 06:55:47 -0000	1.30
@@ -854,7 +854,7 @@
 }
 
 /*
- * Return number of locks which prevent process movement.
+ * Return 1 if there are locks which prevent process movement.
  *
  * Possiblly recompute task->locks in the process
  * I'm assuming the common case is that locking of both a CFS an NFS
@@ -867,14 +867,12 @@
 	struct inode *inode;
 	struct file *fp;
 	struct file_lock *fl;
-	int i, noncfs_locks;
-	//int locks;
+	int i, found;
 
 	if (RVP_ISRFORK(optype))
 		return 0;
-	//locks = 0;
-	noncfs_locks = 0;
-	files = task->files;
+	found = 0;
+	files = get_files_struct(task);
 	if (files) {
 		lock_kernel(); /* for i_flock list */
 		spin_lock(&files->file_lock);
@@ -885,19 +883,22 @@
 			inode = fp->f_dentry->d_inode;
 			for(fl = inode->i_flock; fl != NULL; fl=fl->fl_next) {
 				if ((fl->fl_flags & FL_POSIX) &&
-						(fl->fl_pid != task->pid))
+				    (fl->fl_pid != task->pid))
 					continue;
-				/* Now we allow migration with CFS locks */
-				if (!cfs_inode_is_cfs(inode))
-					noncfs_locks++;
-				//locks++;
+				/* We allow migration with CFS locks */
+				if (cfs_inode_is_cfs(inode))
+					continue;
+				found = 1;
+				goto found;
 			}
 		}
+found:
 		spin_unlock(&files->file_lock);
 		unlock_kernel();
+		put_files_struct(files);
 	}
 
-	return noncfs_locks;
+	return found;
 }
 
 /*


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d