[PVFS2-CVS] commit by neill in pvfs2/src/apps/kernel/linux: mount_pvfs2.sh pvfs2-client-core.c pvfs2-client.c umount_pvfs2.sh

CVS commit program cvs at parl.clemson.edu
Thu May 27 19:11:47 EDT 2004


Update of /projects/cvsroot/pvfs2/src/apps/kernel/linux
In directory parlweb:/tmp/cvs-serv13331/src/apps/kernel/linux

Modified Files:
	mount_pvfs2.sh pvfs2-client-core.c pvfs2-client.c 
	umount_pvfs2.sh 
Log Message:
- added a license notice for the GPL'd kernel module code in COPYING
  and README files
- added Murali to the CREDITS file
- added a configure check for the kernel 2.4.x minor version to know
  if we need to define a few functions or not
- added a new pvfs2-error-code that can be used as an exit code for
  the pvfs2-client-core to indicate to the pvfs2-client that it should
  continue respawning it, but to sleep for a bit first.   [2.4.x in
  particular waits a while to release the device file after the
  process has died, though the same is possible under 2.6.x i guess]
- updated the test mount script with 2.4.x support if running 2.4.x
- added some debugging to client-side create state machine
- murali: fixed a logic bug in mmap-ra-cache
- murali: added matching unlocks to quickhash code functions
- removed MOD_{INC|DEC}_USE_COUNT calls, as at least under my 2.4.26
  testing, they are not necessary
- removed several lock_kernel calls in the 2.4.x code paths that
  caused the kernel to hang in a few places (still investigating)
- murali: fixed the in kernel mount option string parsing
- some misc cleanups
- verified that symlinks now work (at least in basic testing)
		
[ NOTE: this mostly works under 2.4.26 in my testing, however there
  are some known problems remaining ]


Index: mount_pvfs2.sh
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/kernel/linux/mount_pvfs2.sh,v
diff -p -u -r1.1 -r1.2
--- mount_pvfs2.sh	25 May 2004 21:38:48 -0000	1.1
+++ mount_pvfs2.sh	27 May 2004 22:11:47 -0000	1.2
@@ -6,8 +6,14 @@ if [ "`echo $PATH | grep -c /usr/src/mod
 fi
 
 if [ "`lsmod | grep -c pvfs2`" = "0" ]; then
-   echo "Loading the pvfs2 module"
-   insmod ../../../../src/kernel/linux-2.6/pvfs2.ko $1
+
+   if test "x`uname -r | cut -b 1-3`" = "x2.4"; then
+	echo "Loading the 2.4.x pvfs2 module"
+	insmod ../../../../src/kernel/linux-2.4/pvfs2.o $1
+   else
+   	echo "Loading the 2.6.x pvfs2 module"
+   	insmod ../../../../src/kernel/linux-2.6/pvfs2.ko $1
+   fi
 fi
 
 CUR_DEV="pvfs2-flow"
@@ -28,9 +34,14 @@ echo "Starting pvfs2-client"
 ./pvfs2-client -p ./pvfs2-client-core
 
 if [ "`mount | grep -c pvfs2`" = "0" ]; then
-   echo "Mounting pvfs2 on /tmp/mnt"
-#   mount -t pvfs2 pvfs2 /tmp/mnt -o coll_id=9,root_handle=1048576
-    mount -t pvfs2 tcp://lain.mcs.anl.gov:3334/pvfs2-fs /tmp/mnt
+
+   if test "x`uname -r | cut -b 1-3`" = "x2.4"; then
+   	echo "Mounting 2.4.x pvfs2 on /tmp/mnt"
+	mount -t pvfs2 pvfs2 /tmp/mnt -o tcp://lain.mcs.anl.gov:3334/pvfs2-fs
+   else
+   	echo "Mounting 2.6.x pvfs2 on /tmp/mnt"
+    	mount -t pvfs2 tcp://lain.mcs.anl.gov:3334/pvfs2-fs /tmp/mnt
+   fi
 else
    echo "Uh...I think pvfs2 is already mounted."
 fi

Index: pvfs2-client-core.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/kernel/linux/pvfs2-client-core.c,v
diff -p -u -r1.1 -r1.2
--- pvfs2-client-core.c	25 May 2004 21:38:48 -0000	1.1
+++ pvfs2-client-core.c	27 May 2004 22:11:47 -0000	1.2
@@ -1200,7 +1200,7 @@ int main(int argc, char **argv)
       systems/mount information
     */
     ret = PVFS_sys_initialize(GOSSIP_NO_DEBUG);
-    if(ret < 0)
+    if (ret < 0)
     {
         return(ret);
     }
@@ -1212,10 +1212,10 @@ int main(int argc, char **argv)
     PINT_acache_set_timeout(ACACHE_TIMEOUT_MS);
 
     ret = PINT_dev_initialize("/dev/pvfs2-req", 0);
-    if(ret < 0)
+    if (ret < 0)
     {
 	PVFS_perror("PINT_dev_initialize", ret);
-	return(-1);
+	return(-PVFS_EDEVINIT);
     }
 
     /* setup a mapped region for I/O transfers */

Index: pvfs2-client.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/kernel/linux/pvfs2-client.c,v
diff -p -u -r1.1 -r1.2
--- pvfs2-client.c	25 May 2004 21:38:48 -0000	1.1
+++ pvfs2-client.c	27 May 2004 22:11:47 -0000	1.2
@@ -15,6 +15,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
+#include "pvfs2-types.h"
 
 #ifndef PVFS2_VERSION
 #define PVFS2_VERSION "Unknown"
@@ -22,6 +23,8 @@
 
 #define PVFS2_CLIENT_CORE_NAME  "pvfs2-client-core"
 
+#define MAX_DEV_INIT_FAILURES 10
+
 typedef struct
 {
     int verbose;
@@ -119,6 +122,7 @@ static int monitor_pvfs2_client(options_
 {
     int ret = 1, fd = 0;
     pid_t new_pid = 0, wpid = 0;
+    int dev_init_failures = 0;
 
     assert(opts);
 
@@ -148,6 +152,31 @@ static int monitor_pvfs2_client(options_
                            "value %d\n", new_pid, (int)WEXITSTATUS(ret));
                 }
 
+                if (WEXITSTATUS(ret) == (unsigned char)-PVFS_EDEVINIT)
+                {
+                    /*
+                      it's likely that the device was not released yet
+                      by the client core process, even though it was
+                      terminated.  in this case, sleep for a bit and
+                      try again up to MAX_DEV_INIT_FAILURES
+                      consecutive times.
+
+                      this can happen after signaled termination,
+                      particularly on 2.4.x kernels. it seems the
+                      client-core sometimes doesn't release the device
+                      quickly enough.  while inelegant, this sleep is
+                      a temporary measure since we plan to remove the
+                      signaled termination of the client-core all
+                      together in the future.
+                    */
+                    if (++dev_init_failures == MAX_DEV_INIT_FAILURES)
+                    {
+                        break;
+                    }
+                    sleep(1);
+                    continue;
+                }
+
                 if ((opts->path[0] != '/') && (opts->path [0] != '.'))
                 {
                     printf("*** The pvfs2-client-core has exited ***\n");
@@ -155,11 +184,13 @@ static int monitor_pvfs2_client(options_
                            "configured PATH, please specify the\n full "
                            "path name (instead of \"%s\")\n",opts->path);
                 }
-                    break;
+                break;
             }
 
             if (WIFSIGNALED(ret))
             {
+                dev_init_failures = 0;
+
                 if (opts->verbose)
                 {
                     printf("Child process with pid %d was killed by an "

Index: umount_pvfs2.sh
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/apps/kernel/linux/umount_pvfs2.sh,v
diff -p -u -r1.1 -r1.2
--- umount_pvfs2.sh	25 May 2004 21:38:48 -0000	1.1
+++ umount_pvfs2.sh	27 May 2004 22:11:47 -0000	1.2
@@ -2,7 +2,7 @@
 
 umount /tmp/mnt
 killall -TERM pvfs2-client
-sleep 1
+sleep 2
 rmmod pvfs2
 
 



More information about the PVFS2-CVS mailing list