Whamcloud - gitweb
Branch: b1_4
authoradilger <adilger>
Wed, 9 Mar 2005 07:08:02 +0000 (07:08 +0000)
committeradilger <adilger>
Wed, 9 Mar 2005 07:08:02 +0000 (07:08 +0000)
Fix kernel oops when creating .foo in unlinked directory.
Kernels vanilla-2.4.24+ and 2.6.5+ already have this fix.
b=5548

lustre/ChangeLog
lustre/kernel_patches/patches/lustre_version.patch
lustre/kernel_patches/patches/vfs_intent-2.4.21-chaos.patch
lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch
lustre/kernel_patches/patches/vfs_intent-2.4.21-suse-171.patch
lustre/kernel_patches/patches/vfs_intent-2.4.21-suse2.patch
lustre/obdclass/class_obd.c
lustre/tests/sanity.sh
lustre/utils/llmount.c

index 2246c1c..3b98693 100644 (file)
@@ -35,6 +35,7 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        - support common vfs-enforced mount options (nodev,nosuid,noexec) (5637)
        - fix several locking issues related to i_size (5492,5624,5654,5672)
        - don't move pending lock onto export if it is already evicted (5683)
+       - fix kernel oops when creating .foo in unlinked directory (5548)
        * miscellania
        - service request history (4965)
        - put {ll,lov,osc}_async_page structs in a single slab (4699)
index b0322eb..121c27f 100644 (file)
@@ -1,3 +1,4 @@
+Version 44: fix link_path_walk_it() oops creating .foo in deleted "." (b=5548)
 Version 43: fix remove_suid to not crash 2.6, and do anything on 2.4 (b=5695)
 Version 42: export show_task()
 Version 41: revalidate should check working dir is a directory (b=4134)
@@ -17,6 +18,6 @@ Version 34: ext3 iopen assertion (b=2517), operations on deleted "." (b=2399)
 --- /dev/null  Fri Aug 30 17:31:37 2002
 +++ linux-2.4.18-18.8.0-l12-braam/include/linux/lustre_version.h       Thu Feb 13 07:58:33 2003
 @@ -0,0 +1 @@
-+#define LUSTRE_KERNEL_VERSION 43
++#define LUSTRE_KERNEL_VERSION 44
 
 _
index f6d9f9d..8ef6d8f 100644 (file)
@@ -300,7 +300,15 @@ Index: linux-ia64/fs/namei.c
                                break;
                }
                goto return_base;
-@@ -643,6 +680,27 @@ return_reval:
+@@ -637,12 +672,42 @@ return_reval:
+                       nd->last_type = LAST_DOT;
+               else if (this.len == 2 && this.name[1] == '.')
+                       nd->last_type = LAST_DOTDOT;
++              else
++                      goto return_base;
+ return_reval:
+               /*
+                * We bypassed the ordinary revalidation routines.
                 * Check the cached dentry for staleness.
                 */
                dentry = nd->dentry;
index 119d0f1..1da088c 100644 (file)
@@ -300,7 +300,15 @@ Index: linux-2.4.21/fs/namei.c
                                break;
                }
                goto return_base;
-@@ -643,6 +680,34 @@
+@@ -637,12 +672,42 @@ return_reval:
+                       nd->last_type = LAST_DOT;
+               else if (this.len == 2 && this.name[1] == '.')
+                       nd->last_type = LAST_DOTDOT;
++              else
++                      goto return_base;
+ return_reval:
+               /*
+                * We bypassed the ordinary revalidation routines.
                 * Check the cached dentry for staleness.
                 */
                dentry = nd->dentry;
index 109d949..048c92b 100644 (file)
@@ -300,7 +300,15 @@ Index: linux-2.4.21-241/fs/namei.c
                                break;
                }
                goto return_base;
-@@ -658,6 +695,34 @@
+@@ -652,12 +689,42 @@
+                       nd->last_type = LAST_DOT;
+               else if (this.len == 2 && this.name[1] == '.')
+                       nd->last_type = LAST_DOTDOT;
++              else
++                      goto return_base;
+ return_reval:
+               /*
+                * We bypassed the ordinary revalidation routines.
                 * Check the cached dentry for staleness.
                 */
                dentry = nd->dentry;
index 4006c70..d283bd1 100644 (file)
@@ -300,7 +300,15 @@ Index: linux-2.4.21-x86_64/fs/namei.c
                                break;
                }
                goto return_base;
-@@ -643,6 +680,34 @@
+@@ -637,12 +672,42 @@
+                       nd->last_type = LAST_DOT;
+               else if (this.len == 2 && this.name[1] == '.')
+                       nd->last_type = LAST_DOTDOT;
++              else
++                      goto return_base;
+ return_reval:
+               /*
+                * We bypassed the ordinary revalidation routines.
                 * Check the cached dentry for staleness.
                 */
                dentry = nd->dentry;
index 9ac86cb..f4813a2 100644 (file)
@@ -646,7 +646,7 @@ static void cleanup_obdclass(void)
  * kernel patch */
 #include <linux/lustre_version.h>
 #define LUSTRE_MIN_VERSION 32
-#define LUSTRE_MAX_VERSION 43
+#define LUSTRE_MAX_VERSION 44
 #if (LUSTRE_KERNEL_VERSION < LUSTRE_MIN_VERSION)
 # error Cannot continue: Your Lustre kernel patch is older than the sources
 #elif (LUSTRE_KERNEL_VERSION > LUSTRE_MAX_VERSION)
index e3a5378..916bda2 100644 (file)
@@ -1687,6 +1687,10 @@ test_48a() { # bug 2399
        mkdir $DIR/d48a || error "recreate directory failed"
        touch foo || error "'touch foo' failed after recreating cwd"
        mkdir bar || error "'mkdir foo' failed after recreating cwd"
+       if check_kernel_version 44; then
+               touch .foo || error "'touch .foo' failed after recreating cwd"
+               mkdir .bar || error "'mkdir .foo' failed after recreating cwd"
+       fi
        ls . || error "'ls .' failed after recreating cwd"
        ls .. || error "'ls ..' failed after removing cwd"
        cd . || error "'cd .' failed after recreating cwd"
@@ -1704,6 +1708,10 @@ test_48b() { # bug 2399
        rmdir $DIR/d48b || error "remove cwd $DIR/d48b failed"
        touch foo && error "'touch foo' worked after removing cwd"
        mkdir foo && error "'mkdir foo' worked after removing cwd"
+       if check_kernel_version 44; then
+               touch .foo && error "'touch .foo' worked after removing cwd"
+               mkdir .foo && error "'mkdir .foo' worked after removing cwd"
+       fi
        ls . && error "'ls .' worked after removing cwd"
        ls .. || error "'ls ..' failed after removing cwd"
        cd . && error "'cd .' worked after removing cwd"
@@ -1723,6 +1731,10 @@ test_48c() { # bug 2350
        $TRACE rmdir $DIR/d48c/dir || error "remove cwd $DIR/d48c/dir failed"
        $TRACE touch foo && error "'touch foo' worked after removing cwd"
        $TRACE mkdir foo && error "'mkdir foo' worked after removing cwd"
+       if check_kernel_version 44; then
+               touch .foo && error "'touch .foo' worked after removing cwd"
+               mkdir .foo && error "'mkdir .foo' worked after removing cwd"
+       fi
        $TRACE ls . && error "'ls .' worked after removing cwd"
        $TRACE ls .. || error "'ls ..' failed after removing cwd"
        $TRACE cd . && error "'cd .' worked after removing cwd"
@@ -1743,6 +1755,10 @@ test_48d() { # bug 2350
        $TRACE rmdir $DIR/d48d || error "remove parent $DIR/d48d failed"
        $TRACE touch foo && error "'touch foo' worked after removing parent"
        $TRACE mkdir foo && error "'mkdir foo' worked after removing parent"
+       if check_kernel_version 44; then
+               touch .foo && error "'touch .foo' worked after removing parent"
+               mkdir .foo && error "'mkdir .foo' worked after removing parent"
+       fi
        $TRACE ls . && error "'ls .' worked after removing parent"
        $TRACE ls .. && error "'ls ..' worked after removing parent"
        $TRACE cd . && error "'cd .' worked after recreate parent"
@@ -1760,7 +1776,7 @@ test_48e() { # bug 4134
        mkdir -p $DIR/d48e/dir
        # On a buggy kernel addition of "; touch file" after cd .. will
        # produce kernel oops in lookup_hash_it
-       ( cd $DIR/d48e/dir ; sleep 2 ; cd -P .. ) &
+       ( cd $DIR/d48e/dir ; sleep 2 ; cd -P ..; touch foo ) &
        cdpid=$!
        $TRACE rmdir $DIR/d48e/dir || error "remove cwd $DIR/d48e/dir failed"
        $TRACE rmdir $DIR/d48e || error "remove parent $DIR/d48e failed"
index d0581e2..2195ceb 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 
+#define _GNU_SOURCE
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -29,7 +30,6 @@
 #include <string.h>
 #include <sys/mount.h>
 #include <mntent.h>
-#define _GNU_SOURCE
 #include <getopt.h>
 
 #include "obdctl.h"
@@ -259,7 +259,7 @@ static const struct opt_map opt_map[] = {
 
 static int parse_one_option(const char *check, int *flagp)
 {
-        struct opt_map *opt;
+        const struct opt_map *opt;
 
         for (opt = &opt_map[0]; opt->opt != NULL; opt++) {
                 if (strcmp(check, opt->opt) == 0) {
@@ -375,7 +375,7 @@ set_local(struct lustre_mount_data *lmd)
                 fprintf(stderr, "%s: Unknown network type: %d\n",
                         progname, lmd->lmd_nal);
                 return 1;
-                
+
         case SOCKNAL:
         case TCPNAL:
         case OPENIBNAL:
@@ -439,7 +439,7 @@ set_peer(char *hostname, struct lustre_mount_data *lmd)
                 fprintf(stderr, "%s: Unknown network type: %d\n",
                         progname, lmd->lmd_nal);
                 return 1;
-                
+
         case IIBNAL:
         case VIBNAL:
                 if (lmd->lmd_server_nid != PTL_NID_ANY)