From 95f106e80da7c8baf315693d9e797a26f66e8610 Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 9 Mar 2005 07:08:02 +0000 Subject: [PATCH] Branch: b1_4 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 | 1 + lustre/kernel_patches/patches/lustre_version.patch | 3 ++- .../patches/vfs_intent-2.4.21-chaos.patch | 10 +++++++++- .../patches/vfs_intent-2.4.21-rhel.patch | 10 +++++++++- .../patches/vfs_intent-2.4.21-suse-171.patch | 10 +++++++++- .../patches/vfs_intent-2.4.21-suse2.patch | 10 +++++++++- lustre/obdclass/class_obd.c | 2 +- lustre/tests/sanity.sh | 18 +++++++++++++++++- lustre/utils/llmount.c | 8 ++++---- 9 files changed, 61 insertions(+), 11 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 2246c1c..3b98693 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -35,6 +35,7 @@ tbd Cluster File Systems, Inc. - 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) diff --git a/lustre/kernel_patches/patches/lustre_version.patch b/lustre/kernel_patches/patches/lustre_version.patch index b0322eb..121c27f 100644 --- a/lustre/kernel_patches/patches/lustre_version.patch +++ b/lustre/kernel_patches/patches/lustre_version.patch @@ -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 _ diff --git a/lustre/kernel_patches/patches/vfs_intent-2.4.21-chaos.patch b/lustre/kernel_patches/patches/vfs_intent-2.4.21-chaos.patch index f6d9f9d..8ef6d8f 100644 --- a/lustre/kernel_patches/patches/vfs_intent-2.4.21-chaos.patch +++ b/lustre/kernel_patches/patches/vfs_intent-2.4.21-chaos.patch @@ -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; diff --git a/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch b/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch index 119d0f1..1da088c 100644 --- a/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch +++ b/lustre/kernel_patches/patches/vfs_intent-2.4.21-rhel.patch @@ -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; diff --git a/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse-171.patch b/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse-171.patch index 109d949..048c92b 100644 --- a/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse-171.patch +++ b/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse-171.patch @@ -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; diff --git a/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse2.patch b/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse2.patch index 4006c70..d283bd1 100644 --- a/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse2.patch +++ b/lustre/kernel_patches/patches/vfs_intent-2.4.21-suse2.patch @@ -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; diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 9ac86cb..f4813a2 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -646,7 +646,7 @@ static void cleanup_obdclass(void) * kernel patch */ #include #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) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index e3a5378..916bda2 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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" diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index d0581e2..2195ceb 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -22,6 +22,7 @@ */ +#define _GNU_SOURCE #include #include #include @@ -29,7 +30,6 @@ #include #include #include -#define _GNU_SOURCE #include #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) -- 1.8.3.1