Whamcloud - gitweb
ext2obd/ext2_obd.c: added iput() after reading a bad inode,
authoradilger <adilger>
Thu, 23 Dec 1999 10:21:35 +0000 (10:21 +0000)
committeradilger <adilger>
Thu, 23 Dec 1999 10:21:35 +0000 (10:21 +0000)
  remove EXT2_UNDEL_DIR_INO from list of iterated inodes.
class/obdcontrol: after snaprestore remove snapshot from table by key not index

15 files changed:
lustre/demos/baseclean.sh
lustre/demos/basesetup.sh
lustre/demos/obdfsclean.sh
lustre/demos/obdfssetup.sh
lustre/demos/obdtest.sh
lustre/demos/snap3clean.sh
lustre/demos/snap3set.sh
lustre/demos/snapclean.sh
lustre/demos/snapdel.sh
lustre/demos/snaprest.sh
lustre/demos/snaprestclean.sh
lustre/demos/snapsetup.sh
lustre/demos/snaptest.sh
lustre/obdclass/class_obd.c
lustre/obdclass/obdcontrol

index 5ac231b..fc6a871 100755 (executable)
@@ -1,28 +1,25 @@
 #!/bin/sh
 # Script to remove the loopback device and temp file created in newtest.sh
 OBDDIR="`dirname $0`/.."
 #!/bin/sh
 # Script to remove the loopback device and temp file created in newtest.sh
 OBDDIR="`dirname $0`/.."
-
-[ "$OBDDIR" = "./.." ] && OBDDIR=".."
-
 . $OBDDIR/demos/config.sh
 
 
 . $OBDDIR/demos/config.sh
 
 
-mount | grep $MNTOBD > /dev/null 2>&1
-if [ x$? = x0 ]; then 
+mount | grep "$MNTOBD " > /dev/null 2>&1
+if [ x$? = x0 ]; then
     echo "Stuff still mounted on $MNTOBD"
     echo "Stuff still mounted on $MNTOBD"
-    exit 
+    exit 1
 fi
 
 fi
 
-mount | grep $MNTSNAP > /dev/null 2>&1
-if [ x$? = x0 ]; then 
+mount | grep "$MNTSNAP " > /dev/null 2>&1
+if [ x$? = x0 ]; then
     echo "Stuff still mounted on $MNTSNAP"
     echo "Stuff still mounted on $MNTSNAP"
-    exit 
+    exit 2
 fi
 
 fi
 
-mount | grep $MNTSNAP > /dev/null 2>&1
-if [ x$? = x0 ]; then 
+mount | grep "$MNTSNAP2 " > /dev/null 2>&1
+if [ x$? = x0 ]; then
     echo "Stuff still mounted on $MNTSNAP2"
     echo "Stuff still mounted on $MNTSNAP2"
-    exit 
+    exit 3
 fi
 
 
 fi
 
 
index 7cecc93..263e252 100755 (executable)
@@ -1,7 +1,6 @@
 #! /bin/sh
 # Get the locations for the files from a single place to avoid confusion
 OBDDIR="`dirname $0`/.."
 #! /bin/sh
 # Get the locations for the files from a single place to avoid confusion
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "./.." ] && OBDDIR=".."
 
 # source config info
 . $OBDDIR/demos/config.sh
 
 # source config info
 . $OBDDIR/demos/config.sh
@@ -26,7 +25,7 @@ if [ "$LOOPDEV" -a "`losetup $LOOPDEV 2> /dev/null`" ]; then
     echo "You need to clean up $LOOPDEV (via cleanup.sh),"
     echo "or you can change which device is used in demos/config.sh" 1>&2
     # undo previous
     echo "You need to clean up $LOOPDEV (via cleanup.sh),"
     echo "or you can change which device is used in demos/config.sh" 1>&2
     # undo previous
-    rm $TMPFILE
+    [ "$TMPFILE" ] && rm $TMPFILE
     exit 2
 fi
 
     exit 2
 fi
 
@@ -42,6 +41,6 @@ if [ "$BASEDEV" ]; then
 else
     echo "\$BASEDEV not defined in demos/config.sh.  Please fix!"
     [ "$LOOPDEV" ] && losetup -d $LOOPDEV 
 else
     echo "\$BASEDEV not defined in demos/config.sh.  Please fix!"
     [ "$LOOPDEV" ] && losetup -d $LOOPDEV 
-    rm $TMPFILE
+    [ "$TMPFILE" ] && rm $TMPFILE
     exit 3
 fi
     exit 3
 fi
index aad02f5..4723394 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 # Utility script for cleaning up a simple OBDFS mounted filesystem
 OBDDIR="`dirname $0`/.."
 #!/bin/sh
 # Utility script for cleaning up a simple OBDFS mounted filesystem
 OBDDIR="`dirname $0`/.."
-
 . $OBDDIR/demos/config.sh
 
 umount $MNTOBD
 . $OBDDIR/demos/config.sh
 
 umount $MNTOBD
index 543ae5a..1e8b158 100755 (executable)
@@ -1,9 +1,6 @@
 #! /bin/bash
 # Utility script for configuring a simple OBDFS mount
 #! /bin/bash
 # Utility script for configuring a simple OBDFS mount
-
 OBDDIR="`dirname $0`/.."
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "./.." ] && OBDDIR=".."
-
 .  $OBDDIR/demos/config.sh
 
 $OBDDIR/demos/basesetup.sh
 .  $OBDDIR/demos/config.sh
 
 $OBDDIR/demos/basesetup.sh
index 34f86d1..89a003f 100755 (executable)
@@ -3,7 +3,6 @@
 # not already mounted on /mnt/obd, we call the basic OBD setup script to
 # create and mount a filesystem for us.
 OBDDIR="`dirname $0`/.."
 # not already mounted on /mnt/obd, we call the basic OBD setup script to
 # create and mount a filesystem for us.
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "" ] && OBDDIR=".."
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTOBD/lost+found ] && $OBDDIR/demos/obdfssetup.sh
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTOBD/lost+found ] && $OBDDIR/demos/obdfssetup.sh
index dd62b39..63a04a2 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 # Utility script for cleaning up a third snapshot created by setup3.sh
 OBDDIR="`dirname $0`/.."
 #!/bin/sh
 # Utility script for cleaning up a third snapshot created by setup3.sh
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "" ] && OBDDIR=".."
 . $OBDDIR/demos/config.sh
 
 plog umount $MNTSNAP2
 . $OBDDIR/demos/config.sh
 
 plog umount $MNTSNAP2
index 517101e..88645a2 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 # Utility script for creating a third snapshot.
 OBDDIR="`dirname $0`/.."
 #!/bin/sh
 # Utility script for creating a third snapshot.
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "" ] && OBDDIR=".."
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTSNAP/lost+found ] && $OBDDIR/demos/snapsetup.sh
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTSNAP/lost+found ] && $OBDDIR/demos/snapsetup.sh
index 10d08f8..04df14f 100755 (executable)
@@ -1,7 +1,6 @@
 #! /bin/bash
 # Utility script for cleaning up snapshots and removing modules.
 OBDDIR="`dirname $0`/.."
 #! /bin/bash
 # Utility script for cleaning up snapshots and removing modules.
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "" ] && OBDDIR=".."
 . $OBDDIR/demos/config.sh
 
 plog umount $MNTOBD
 . $OBDDIR/demos/config.sh
 
 plog umount $MNTOBD
@@ -20,4 +19,5 @@ EOF
 
 rmmod obdsnap
 
 
 rmmod obdsnap
 
+rm $SNAPTABLE
 $OBDDIR/demos/obdfsclean.sh
 $OBDDIR/demos/obdfsclean.sh
index d6fece3..7fc872d 100755 (executable)
@@ -2,7 +2,6 @@
 # Utility script to test deleting a snapshot that has been previously
 # created as the setup.sh script does.
 OBDDIR="`dirname $0`/.."
 # Utility script to test deleting a snapshot that has been previously
 # created as the setup.sh script does.
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "" ] && OBDDIR=".."
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTSNAP/lost+found ] && echo "need to run obdsetup.sh first" && exit 1
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTSNAP/lost+found ] && echo "need to run obdsetup.sh first" && exit 1
index 23d0080..f260ab0 100755 (executable)
@@ -2,7 +2,6 @@
 # Utility script to test restoring a previous snapshot.  This will destroy
 # the "current" snapshot and restore the old one in its place.
 OBDDIR="`dirname $0`/.."
 # Utility script to test restoring a previous snapshot.  This will destroy
 # the "current" snapshot and restore the old one in its place.
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "./.." ] && OBDDIR=".."
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTSNAP/lost+found ] && echo "need to run snapsetup.sh first" && exit 1
 . $OBDDIR/demos/config.sh
 
 [ ! -d $MNTSNAP/lost+found ] && echo "need to run snapsetup.sh first" && exit 1
@@ -10,13 +9,13 @@ OBDDIR="`dirname $0`/.."
 plog umount $MNTSNAP
 plog umount $MNTOBD
 
 plog umount $MNTSNAP
 plog umount $MNTOBD
 
-mount | grep $MNTOBD > /dev/null 2>&1
+mount | grep "$MNTOBD " > /dev/null 2>&1
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTOBD; clean up first."
     exit 
 fi
 
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTOBD; clean up first."
     exit 
 fi
 
-mount | grep $MNTSNAP > /dev/null 2>&1
+mount | grep "$MNTSNAP " > /dev/null 2>&1
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTSNAP; clean up first."
     exit 
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTSNAP; clean up first."
     exit 
index 70a343e..855362e 100755 (executable)
@@ -1,18 +1,15 @@
 #! /bin/bash
 # Utility script for cleaning up a simple OBDFS mounted filesystem
 OBDDIR="`dirname $0`/.."
 #! /bin/bash
 # Utility script for cleaning up a simple OBDFS mounted filesystem
 OBDDIR="`dirname $0`/.."
-
 . $OBDDIR/demos/config.sh
 
 umount $MNTOBD
 . $OBDDIR/demos/config.sh
 
 umount $MNTOBD
-mount | grep $MNTOBD > /dev/null 2>&1
+mount | grep "$MNTOBD " > /dev/null 2>&1
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTOBD; clean up first."
     exit 
 fi
 
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTOBD; clean up first."
     exit 
 fi
 
-rmmod obdfs
-
 $OBDDIR/class/obdcontrol -f << EOF
 device /dev/obd2
 cleanup
 $OBDDIR/class/obdcontrol -f << EOF
 device /dev/obd2
 cleanup
@@ -23,8 +20,10 @@ detach
 quit
 EOF
 
 quit
 EOF
 
+rmmod obdfs
 rmmod obdsnap
 rmmod obdext2
 rmmod obdclass
 
 rmmod obdsnap
 rmmod obdext2
 rmmod obdclass
 
+rm $SNAPTABLE
 $OBDDIR/demos/baseclean.sh
 $OBDDIR/demos/baseclean.sh
index f7ef4df..8bb36a0 100755 (executable)
@@ -3,13 +3,11 @@
 # not already mounted on /mnt/obd, we call the basic OBD setup script to
 # create and mount a filesystem for us.
 OBDDIR="`dirname $0`/.."
 # not already mounted on /mnt/obd, we call the basic OBD setup script to
 # create and mount a filesystem for us.
 OBDDIR="`dirname $0`/.."
-
 . $OBDDIR/demos/config.sh
 
 
 # prepare the snapshot drive with a file to be COW'd
 . $OBDDIR/demos/config.sh
 
 
 # prepare the snapshot drive with a file to be COW'd
-
-mount | grep $MNTOBD > /dev/null 2>&1
+mount | grep "$MNTOBD " > /dev/null 2>&1
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTOBD; clean up first."
     exit 
 if [ x$? = x0 ]; then 
     echo "Stuff still mounted on $MNTOBD; clean up first."
     exit 
index b01fdfc..bd0a4ea 100755 (executable)
@@ -2,7 +2,6 @@
 # Utility script to perform minor modifications to the read-write mounted
 # snapshot in order to demonstrate the changes w.r.t. the read-only snapshot
 OBDDIR="`dirname $0`/.."
 # Utility script to perform minor modifications to the read-write mounted
 # snapshot in order to demonstrate the changes w.r.t. the read-only snapshot
 OBDDIR="`dirname $0`/.."
-[ "$OBDDIR" = "" ] && OBDDIR=".."
 . $OBDDIR/demos/config.sh
 
 plog chmod 777 $MNTOBD                 # change attributes on an existing file
 . $OBDDIR/demos/config.sh
 
 plog chmod 777 $MNTOBD                 # change attributes on an existing file
index bb97aa5..de5df3f 100644 (file)
@@ -94,7 +94,7 @@ static int obd_class_release(struct inode * inode, struct file * file)
                return -ENODEV;
        fsync_dev(inode->i_rdev);
        if (obd_dev[dev].obd_refcnt <= 0)
                return -ENODEV;
        fsync_dev(inode->i_rdev);
        if (obd_dev[dev].obd_refcnt <= 0)
-               printk(KERN_ALERT "presto_psdev_release: refcount(%d) <= 0\n",
+               printk(KERN_ALERT "obd_class_release: refcount(%d) <= 0\n",
                       obd_dev[dev].obd_refcnt);
        obd_dev[dev].obd_refcnt--;
 
                       obd_dev[dev].obd_refcnt);
        obd_dev[dev].obd_refcnt--;
 
index 68648d2..7486cc8 100755 (executable)
@@ -386,7 +386,7 @@ sub SnapRestore {
     my $restoreto = shift;
     my $snaptable = shift;
     my $tableno = shift;
     my $restoreto = shift;
     my $snaptable = shift;
     my $tableno = shift;
-    my $key;
+    my $restoretime;
 
     # don't do anything until connected
     if (!defined($::client_id)) {
 
     # don't do anything until connected
     if (!defined($::client_id)) {
@@ -405,24 +405,24 @@ sub SnapRestore {
     }
    
     my $table = ReadSnapShotTable($snaptable);
     }
    
     my $table = ReadSnapShotTable($snaptable);
-    $key = FindSnapInTable($table, $restoreto);
-    if ( ! defined $table->{0} || ! defined $key ) {
+    $restoretime = FindSnapInTable($table, $restoreto);
+    if ( ! defined $table->{0} || ! defined $restoretime ) {
        PrintSnapShotTable($table);
        print "No current or $restoreto slot in this table\n";
        return;
     }
 
     my $currentindex = $table->{0};
        PrintSnapShotTable($table);
        print "No current or $restoreto slot in this table\n";
        return;
     }
 
     my $currentindex = $table->{0};
-    if (  $table->{$key} == $currentindex ) {
+    if (  $table->{$restoretime} == $currentindex ) {
        print "You should not restore to the current snapshot\n";
        return;
     }
     
     # swap the entries for 0 and $restoreto
        print "You should not restore to the current snapshot\n";
        return;
     }
     
     # swap the entries for 0 and $restoreto
-    my $tmp = $table->{$key};
-    $table->{$key} = $table->{0};
+    my $tmp = $table->{$restoretime};
+    $table->{$restoretime} = $table->{0};
     $table->{0} = $tmp;
     $table->{0} = $tmp;
-    PrintSnapShotTable($table);
+    PrintSnapShotTable($table);
 
     # write it back
     WriteSnapShotTable($snaptable, $table);
 
     # write it back
     WriteSnapShotTable($snaptable, $table);
@@ -446,13 +446,13 @@ sub SnapRestore {
        print STDERR "ioctl failed: $!\n";
     } elsif ($rc eq "0 but true") {
        print "Snaprestore finished (success)\n";
        print STDERR "ioctl failed: $!\n";
     } elsif ($rc eq "0 but true") {
        print "Snaprestore finished (success)\n";
-       delete $table->{$restoreto};
+       delete $table->{$restoretime} if defined $restoretime;
        # write it back
        WriteSnapShotTable($snaptable, $table);
        
        # set it in the kernel
        SnapSetTable($tableno, $snaptable);
        # write it back
        WriteSnapShotTable($snaptable, $table);
        
        # set it in the kernel
        SnapSetTable($tableno, $snaptable);
-       PrintSnapShotTable($table);
+       PrintSnapShotTable($table);
 
     } else {
        print "ioctl returned error code $rc.\n";
 
     } else {
        print "ioctl returned error code $rc.\n";
@@ -463,10 +463,10 @@ sub FindSnapInTable {
     my $table = shift;
     my $snapno =shift;
 
     my $table = shift;
     my $snapno =shift;
 
-    foreach my $key ( keys %{$table} ) {
-       if ( $table->{$key} == $snapno) { 
-           print "Found key $key for snapno $snapno\n";
-           return $key;
+    foreach my $restoretime ( keys %{$table} ) {
+       if ( $table->{$restoretime} == $snapno) { 
+           print "Found key $restoretime for snapno $snapno\n";
+           return $restoretime;
        }
     }
     undef;
        }
     }
     undef;