From: adilger Date: Thu, 23 Dec 1999 10:21:35 +0000 (+0000) Subject: ext2obd/ext2_obd.c: added iput() after reading a bad inode, X-Git-Tag: v1_7_100~6153 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=fe852b97e1d80516a45d67b89108bf4cac87672a ext2obd/ext2_obd.c: added iput() after reading a bad inode, remove EXT2_UNDEL_DIR_INO from list of iterated inodes. class/obdcontrol: after snaprestore remove snapshot from table by key not index --- diff --git a/lustre/demos/baseclean.sh b/lustre/demos/baseclean.sh index 5ac231b..fc6a871 100755 --- a/lustre/demos/baseclean.sh +++ b/lustre/demos/baseclean.sh @@ -1,28 +1,25 @@ #!/bin/sh # Script to remove the loopback device and temp file created in newtest.sh OBDDIR="`dirname $0`/.." - -[ "$OBDDIR" = "./.." ] && OBDDIR=".." - . $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" - exit + exit 1 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" - exit + exit 2 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" - exit + exit 3 fi diff --git a/lustre/demos/basesetup.sh b/lustre/demos/basesetup.sh index 7cecc93..263e252 100755 --- a/lustre/demos/basesetup.sh +++ b/lustre/demos/basesetup.sh @@ -1,7 +1,6 @@ #! /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 @@ -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 - rm $TMPFILE + [ "$TMPFILE" ] && rm $TMPFILE 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 - rm $TMPFILE + [ "$TMPFILE" ] && rm $TMPFILE exit 3 fi diff --git a/lustre/demos/obdfsclean.sh b/lustre/demos/obdfsclean.sh index aad02f5..4723394 100755 --- a/lustre/demos/obdfsclean.sh +++ b/lustre/demos/obdfsclean.sh @@ -1,7 +1,6 @@ #!/bin/sh # Utility script for cleaning up a simple OBDFS mounted filesystem OBDDIR="`dirname $0`/.." - . $OBDDIR/demos/config.sh umount $MNTOBD diff --git a/lustre/demos/obdfssetup.sh b/lustre/demos/obdfssetup.sh index 543ae5a..1e8b158 100755 --- a/lustre/demos/obdfssetup.sh +++ b/lustre/demos/obdfssetup.sh @@ -1,9 +1,6 @@ #! /bin/bash # Utility script for configuring a simple OBDFS mount - OBDDIR="`dirname $0`/.." -[ "$OBDDIR" = "./.." ] && OBDDIR=".." - . $OBDDIR/demos/config.sh $OBDDIR/demos/basesetup.sh diff --git a/lustre/demos/obdtest.sh b/lustre/demos/obdtest.sh index 34f86d1..89a003f 100755 --- a/lustre/demos/obdtest.sh +++ b/lustre/demos/obdtest.sh @@ -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`/.." -[ "$OBDDIR" = "" ] && OBDDIR=".." . $OBDDIR/demos/config.sh [ ! -d $MNTOBD/lost+found ] && $OBDDIR/demos/obdfssetup.sh diff --git a/lustre/demos/snap3clean.sh b/lustre/demos/snap3clean.sh index dd62b39..63a04a2 100755 --- a/lustre/demos/snap3clean.sh +++ b/lustre/demos/snap3clean.sh @@ -1,7 +1,6 @@ #!/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 diff --git a/lustre/demos/snap3set.sh b/lustre/demos/snap3set.sh index 517101e..88645a2 100755 --- a/lustre/demos/snap3set.sh +++ b/lustre/demos/snap3set.sh @@ -1,7 +1,6 @@ #!/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 diff --git a/lustre/demos/snapclean.sh b/lustre/demos/snapclean.sh index 10d08f8..04df14f 100755 --- a/lustre/demos/snapclean.sh +++ b/lustre/demos/snapclean.sh @@ -1,7 +1,6 @@ #! /bin/bash # Utility script for cleaning up snapshots and removing modules. OBDDIR="`dirname $0`/.." -[ "$OBDDIR" = "" ] && OBDDIR=".." . $OBDDIR/demos/config.sh plog umount $MNTOBD @@ -20,4 +19,5 @@ EOF rmmod obdsnap +rm $SNAPTABLE $OBDDIR/demos/obdfsclean.sh diff --git a/lustre/demos/snapdel.sh b/lustre/demos/snapdel.sh index d6fece3..7fc872d 100755 --- a/lustre/demos/snapdel.sh +++ b/lustre/demos/snapdel.sh @@ -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`/.." -[ "$OBDDIR" = "" ] && OBDDIR=".." . $OBDDIR/demos/config.sh [ ! -d $MNTSNAP/lost+found ] && echo "need to run obdsetup.sh first" && exit 1 diff --git a/lustre/demos/snaprest.sh b/lustre/demos/snaprest.sh index 23d0080..f260ab0 100755 --- a/lustre/demos/snaprest.sh +++ b/lustre/demos/snaprest.sh @@ -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`/.." -[ "$OBDDIR" = "./.." ] && OBDDIR=".." . $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 -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 -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 diff --git a/lustre/demos/snaprestclean.sh b/lustre/demos/snaprestclean.sh index 70a343e..855362e 100755 --- a/lustre/demos/snaprestclean.sh +++ b/lustre/demos/snaprestclean.sh @@ -1,18 +1,15 @@ #! /bin/bash # Utility script for cleaning up a simple OBDFS mounted filesystem OBDDIR="`dirname $0`/.." - . $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 -rmmod obdfs - $OBDDIR/class/obdcontrol -f << EOF device /dev/obd2 cleanup @@ -23,8 +20,10 @@ detach quit EOF +rmmod obdfs rmmod obdsnap rmmod obdext2 rmmod obdclass +rm $SNAPTABLE $OBDDIR/demos/baseclean.sh diff --git a/lustre/demos/snapsetup.sh b/lustre/demos/snapsetup.sh index f7ef4df..8bb36a0 100755 --- a/lustre/demos/snapsetup.sh +++ b/lustre/demos/snapsetup.sh @@ -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`/.." - . $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 diff --git a/lustre/demos/snaptest.sh b/lustre/demos/snaptest.sh index b01fdfc..bd0a4ea 100755 --- a/lustre/demos/snaptest.sh +++ b/lustre/demos/snaptest.sh @@ -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`/.." -[ "$OBDDIR" = "" ] && OBDDIR=".." . $OBDDIR/demos/config.sh plog chmod 777 $MNTOBD # change attributes on an existing file diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index bb97aa5..de5df3f 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -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) - 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--; diff --git a/lustre/obdclass/obdcontrol b/lustre/obdclass/obdcontrol index 68648d2..7486cc8 100755 --- a/lustre/obdclass/obdcontrol +++ b/lustre/obdclass/obdcontrol @@ -386,7 +386,7 @@ sub SnapRestore { my $restoreto = shift; my $snaptable = shift; my $tableno = shift; - my $key; + my $restoretime; # don't do anything until connected if (!defined($::client_id)) { @@ -405,24 +405,24 @@ sub SnapRestore { } 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}; - 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 - my $tmp = $table->{$key}; - $table->{$key} = $table->{0}; + my $tmp = $table->{$restoretime}; + $table->{$restoretime} = $table->{0}; $table->{0} = $tmp; - PrintSnapShotTable($table); + # PrintSnapShotTable($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"; - delete $table->{$restoreto}; + delete $table->{$restoretime} if defined $restoretime; # 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"; @@ -463,10 +463,10 @@ sub FindSnapInTable { 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;