From 0e4952274e080868cb22c3a5ecbaa450f731f2f4 Mon Sep 17 00:00:00 2001 From: adilger <adilger> Date: Sat, 6 Oct 2007 02:45:16 +0000 Subject: [PATCH] Branch b1_6 Description: enable data checksumming by default Details : enable checksum by default, allow --disable-checksum configure option and "-o nochecksum" mount option. Checksums can also be disabled at runtime via $LPROC/osc/*/checksum_pages. b=13579 i=nathan i=johann Minor fixes to get sanity.sh running. --- lustre/ChangeLog | 12 ++++++------ lustre/llite/llite_internal.h | 3 ++- lustre/llite/llite_lib.c | 16 ++++++++++------ lustre/llite/lproc_llite.c | 6 +++--- lustre/tests/sanity.sh | 18 +++++++++--------- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index f93cad41f2..d4cca12afd 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -73,7 +73,7 @@ Severity : minor Bugzilla : 12948 Description: buffer overruns could theoretically occur Details : llapi_semantic_traverse() modifies the "path" argument by - appending values to the end of the origin string, and a buffer + appending values to the end of the origin string, and a buffer overrun may occur. Adding buffer overrun check in liblustreapi. Severity : normal @@ -97,10 +97,10 @@ Severity : normal Bugzilla : 13452 Description: Kernel config for 2.6.18-vanilla. Details : Modify targets/2.6-vanilla.target.in. - Add config file kernel-2.6.18-2.6-vanilla-i686.config. - Add config file kernel-2.6.18-2.6-vanilla-i686-smp.config. - Add config file kernel-2.6.18-2.6-vanilla-x86_64.config. - Add config file kernel-2.6.18-2.6-vanilla-x86_64-smp.config. + Add config file kernel-2.6.18-2.6-vanilla-i686.config. + Add config file kernel-2.6.18-2.6-vanilla-i686-smp.config. + Add config file kernel-2.6.18-2.6-vanilla-x86_64.config. + Add config file kernel-2.6.18-2.6-vanilla-x86_64-smp.config. Severity : major Bugzilla : 11710 @@ -215,7 +215,7 @@ Bugzilla : 12398 Description: enable data checksumming by default Details : enable checksum by default, allow --disable-checksum configure option and "-o nochecksum" mount option. Checksums - can also be disabled at runtime via $LPROC/llite/*/checksum_pages. + can also be disabled at runtime via $LPROC/osc/*/checksum_pages. Severity : normal Frequency : Occasionally with failover diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index e977d0ac97..75cc6abe5f 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -209,13 +209,14 @@ enum stats_track_type { /* flags for sbi->ll_flags */ #define LL_SBI_NOLCK 0x01 /* DLM locking disabled (directio-only) */ -#define LL_SBI_CHECKSUM 0x02 /* checksum each page as it's written */ +#define LL_SBI_DATA_CHECKSUM 0x02 /* checksum each page on the wire */ #define LL_SBI_FLOCK 0x04 #define LL_SBI_USER_XATTR 0x08 /* support user xattr */ #define LL_SBI_ACL 0x10 /* support ACL */ #define LL_SBI_JOIN 0x20 /* support JOIN */ #define LL_SBI_LOCALFLOCK 0x40 /* Local flocks support by kernel */ #define LL_SBI_LRU_RESIZE 0x80 /* support lru resize */ +#define LL_SBI_LLITE_CHECKSUM 0x100 /* checksum each page in memory */ /* default value for ll_sb_info->contention_time */ #define SBI_DEFAULT_CONTENTION_SECONDS 60 diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 4b03c3957a..d13f173b74 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -86,8 +86,11 @@ static struct ll_sb_info *ll_init_sbi(void) list_add_tail(&sbi->ll_list, &ll_super_blocks); spin_unlock(&ll_sb_lock); +#ifdef ENABLE_CHECKSUM + sbi->ll_flags |= LL_SBI_DATA_CHECKSUM; +#endif #ifdef ENABLE_LLITE_CHECKSUM - sbi->ll_flags |= LL_SBI_CHECKSUM; + sbi->ll_flags |= LL_SBI_LLITE_CHECKSUM; #endif #ifdef HAVE_LRU_RESIZE_SUPPORT @@ -370,9 +373,10 @@ static int client_common_fill_super(struct super_block *sb, GOTO(out_root, err); } - checksum = sbi->ll_flags & LL_SBI_CHECKSUM; - err = obd_set_info_async(sbi->ll_osc_exp, strlen("checksum"),"checksum", - sizeof(checksum), &checksum, NULL); + checksum = sbi->ll_flags & LL_SBI_DATA_CHECKSUM; + err = obd_set_info_async(sbi->ll_osc_exp, strlen("checksum"), + "checksum", sizeof(checksum), + &checksum, NULL); /* making vm readahead 0 for 2.4.x. In the case of 2.6.x, backing dev info assigned to inode mapping is used for @@ -709,12 +713,12 @@ static int ll_options(char *options, int *flags) goto next; } - tmp = ll_set_opt("checksum", s1, LL_SBI_CHECKSUM); + tmp = ll_set_opt("checksum", s1, LL_SBI_DATA_CHECKSUM); if (tmp) { *flags |= tmp; goto next; } - tmp = ll_set_opt("nochecksum", s1, LL_SBI_CHECKSUM); + tmp = ll_set_opt("nochecksum", s1, LL_SBI_DATA_CHECKSUM); if (tmp) { *flags &= ~tmp; goto next; diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 5f8d84c0c9..d40c9528a1 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -316,7 +316,7 @@ static int ll_rd_checksum(char *page, char **start, off_t off, struct ll_sb_info *sbi = ll_s2sbi(sb); return snprintf(page, count, "%u\n", - (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0); + (sbi->ll_flags & LL_SBI_LLITE_CHECKSUM) ? 1 : 0); } static int ll_wr_checksum(struct file *file, const char *buffer, @@ -334,9 +334,9 @@ static int ll_wr_checksum(struct file *file, const char *buffer, if (rc) return rc; if (val) - sbi->ll_flags |= LL_SBI_CHECKSUM; + sbi->ll_flags |= (LL_SBI_LLITE_CHECKSUM|LL_SBI_DATA_CHECKSUM); else - sbi->ll_flags &= ~LL_SBI_CHECKSUM; + sbi->ll_flags &= ~(LL_SBI_LLITE_CHECKSUM|LL_SBI_DATA_CHECKSUM); rc = obd_set_info_async(sbi->ll_osc_exp, strlen("checksum"), "checksum", sizeof(val), &val, NULL); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 3c40921384..328be96f64 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3041,8 +3041,8 @@ run_test 76 "destroy duplicate inodes in client inode cache ====" export ORIG_CSUM="" set_checksums() { - [ "$ORIG_CSUM" ]||ORIG_CSUM=`cat $LPROC/llite/*/checksum_pages|head -n1` - for f in $LPROC/llite/*/checksum_pages; do + [ "$ORIG_CSUM" ] || ORIG_CSUM=`cat $LPROC/osc/*/checksums | head -n1` + for f in $LPROC/osc/*/checksums; do echo $1 >> $f done @@ -4297,12 +4297,12 @@ test_120a() { [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ skip "no early lock cancel on server" && return 9 lru_resize_disable - mkdir $DIR/$tdir + mkdir -p $DIR/$tdir cancel_lru_locks mdc stat $DIR/$tdir > /dev/null can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` blk1=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` - mkdir $DIR/$tdir/d1 + mkdir -p $DIR/$tdir/d1 can2=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` blk2=`awk '/ldlm_bl_callback/ {print $2}' $LPROC/ldlm/services/ldlm_cbd/stats` [ $can1 -eq $can2 ] || error $((can2-can1)) "cancel RPC occured." @@ -4315,7 +4315,7 @@ test_120b() { [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ skip "no early lock cancel on server" && return 9 lru_resize_disable - mkdir $DIR/$tdir + mkdir -p $DIR/$tdir cancel_lru_locks mdc stat $DIR/$tdir > /dev/null can1=`awk '/ldlm_cancel/ {print $2}' $LPROC/ldlm/services/ldlm_canceld/stats` @@ -4370,7 +4370,7 @@ test_120e() { [ -z "`grep early_lock_cancel $LPROC/mdc/*/connect_flags`" ] && \ skip "no early lock cancel on server" && return 9 lru_resize_disable - mkdir $DIR/$tdir + mkdir -p $DIR/$tdir dd if=/dev/zero of=$DIR/$tdir/f1 count=1 cancel_lru_locks mdc cancel_lru_locks osc @@ -4524,7 +4524,7 @@ test_124a() { skip "no lru resize on server" && return 0 cancel_lru_locks mdc lru_resize_enable - NSDIR=`find $LPROC/ldlm/namespaces | grep mdc | head -1` + NSDIR=`find $LPROC/ldlm/namespaces | grep -i mdc | head -1` # we want to test main pool functionality, that is cancel based on SLV # this is why shrinkers are disabled @@ -4591,7 +4591,7 @@ test_124b() { skip "no lru resize on server" && return 0 cleanup -f || error "failed to unmount" MOUNTOPT="$MOUNTOPT,nolruresize" - setup + setup || error "setup failed" NR=3000 mkdir -p $DIR/$tdir || error "failed to create $DIR/$tdir" @@ -4608,7 +4608,7 @@ test_124b() { cleanup -f || error "failed to unmount" MOUNTOPT=`echo $MOUNTOPT | sed "s/nolruresize/lruresize/"` - setup + setup || error "setup failed" createmany -o $DIR/$tdir/f $NR log "doing ls -la $DIR/$tdir 3 times (lru resize enabled)" -- GitLab