From 95f197eba249931587f9b9e698ba58ba8af5564e Mon Sep 17 00:00:00 2001
From: adilger <adilger>
Date: Wed, 14 May 2008 22:24:20 +0000
Subject: [PATCH] Branch b1_6 Description: MDS may lose file striping (and
 hence file data) in some cases Details    : If there are additional extended
 attributes stored on the MDS, 	     in particular ACLs, SELinux, or user
 attributes (if user_xattr 	     is specified for the client mount
 options) then there is a risk 	     of attribute loss.  Additionally, the
 Lustre file striping 	     needs to be larger than default (e.g. striped
 over all OSTs), 	     and an additional attribute must be stored
 initially in the 	     inode and then increase in size enough to be
 moved to the 	     external attribute block (e.g. ACL growing in size) for
 file 	     data to be lost. i=kalpak.shah i=alex.zhuravlev b=15777

Sync ChangeLog from b_release_1_6_5.
---
 lustre/ChangeLog       | 44 ++++++++++++++++++++++++++++++++----------
 lustre/tests/sanity.sh | 44 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 10 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index f59cb9cd3d..569729e322 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -48,20 +48,15 @@ Bugzilla   : 15278
 Description: fix build on ppc32
 Details    : compile code with -m64 flag produce wrong object file for ppc32.
 
-Severity   : normal
-Bugzilla   : 15212
-Description: Reinitialize optind to 0 so that interactive lfs works in all cases
-
 -------------------------------------------------------------------------------
 
 
-04-26-2008  Sun Microsystems, Inc.
+2008-05-26  Sun Microsystems, Inc.
        * version 1.6.5
        * Support for kernels:
         2.6.5-7.311 (SLES 9),
         2.6.9-67.0.7.EL (RHEL 4),
         2.6.16.54-0.2.5 (SLES 10),
-        2.6.18-53.1.14.el5 (RHEL 5),
         2.6.22.14 vanilla (kernel.org)
        * Client support for unpatched kernels:
          (see http://wiki.lustre.org/index.php?title=Patchless_Client)
@@ -81,11 +76,34 @@ Description: Reinitialize optind to 0 so that interactive lfs works in all cases
 		'tunefs.lustre --param="mdt.quota_type=ug1" $MDTDEV'.
 	 For more information, please refer to bugzilla 13904.
 
-Severity   : normal
+Severity   : critical
+Frequency  : very rare, if additional xattrs are used on kernels >= 2.6.12
+Bugzilla   : 15777
+Description: MDS may lose file striping (and hence file data) in some cases
+Details    : If there are additional extended attributes stored on the MDS,
+	     in particular ACLs, SELinux, or user attributes (if user_xattr
+	     is specified for the client mount options) then there is a risk
+	     of attribute loss.  Additionally, the Lustre file striping
+	     needs to be larger than default (e.g. striped over all OSTs),
+	     and an additional attribute must be stored initially in the
+	     inode and then increase in size enough to be moved to the
+	     external attribute block (e.g. ACL growing in size) for file
+	     data to be lost.
+
+Severity   : enhancement
 Bugzilla   : 12191
 Description: add message levels for liblustreapi
 
 Severity   : normal
+Frequency  : rare
+Bugzilla   : 13380
+Description: MDT cannot be unmounted, reporting "Mount still busy"
+Details	   : Mountpoint references were being leaked during open reply
+	     reconstruction after an MDS restart.  Drop mountpoint reference
+	     in reconstruct_open() and free dentry reference also.
+
+Severity   : minor
+Frequency  : rare
 Bugzilla   : 13380
 Description: fix for occasional failure case of -ENOSPC in recovery-small tests 
 Details    : Move the 'good_osts' check before the 'total_bavail' check.  This 
@@ -130,6 +148,11 @@ Description: the min numbers of lproc stats are wrong
 Details    : adding a new constant LC_MIN_INIT and use it for initialization
 	     of lc_min.
 
+Severity   : normal
+Frequency  : always with interactive lfs
+Bugzilla   : 15212
+Description: Reinitialize optind to 0 so that interactive lfs works in all cases
+
 Severity   : normal
 Frequency  : with multiple concurrent readdir processes in same directory
 Bugzilla   : 15406, 15169, 15175
@@ -204,7 +227,7 @@ Severity   : enhancement
 Bugzilla   : 15416
 Description: Update kernel to SLES9 2.6.5-7.311.
 
-Severity   : normal
+Severity   : enhancement
 Bugzilla   : 12652
 Description: Files open for execute are not marked busy on SLES10
 Details    : Add FMODE_EXEC to SLES10 SP1 server kernel series.
@@ -216,7 +239,7 @@ Description: Add server support for vanilla-2.6.22.14.
 Severity   : normal
 Frequency  : occasional
 Bugzilla   : 13375
-Description: make lov_create() will not stuck in obd_statfs_rqset()
+Description: Avoid lov_create() getting stuck in obd_statfs_rqset()
 Details    : If an OST is down the MDS will hang indefinitely in
 	     obd_statfs_rqset() waiting for the statfs data. While for
 	     MDS QOS usage of statfs, it should not stuck in waiting.
@@ -534,8 +557,8 @@ Description: Allow masking D_WARNING, D_ERROR messages from console
 Details    : Console messages can now be disabled via lnet.printk.
 
 Severity   : normal
-Bugzilla   : 14614
 Frequency  : always
+Bugzilla   : 14614
 Description: User code with malformed file open parameter crashes client node
 Details    : Before packing join_file req, all the related reference should be
 	     checked carefully in case some malformed flags cause fake join_file
@@ -2272,6 +2295,7 @@ Bugzilla   : 10816
 Description: Improve multi-block allocation algorithm to avoid fragmentation
 Details    : The mballoc3 code (ldiskfs2 only) adds new mechanisms to improve
 	     allocation locality and avoid filesystem fragmentation.
+
 ------------------------------------------------------------------------------
 
 2007-04-01  Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 1f68de3650..3c32b70693 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -3812,6 +3812,50 @@ test_102g() {
 }
 run_test 102g "star copy files, keep osts ==========="
 
+test_102h() { # bug 15777
+	[ -z $(lctl get_param -n mdc.*.connect_flags | grep xattr) ] &&
+		skip "must have user_xattr" && return
+	[ -z "$(which setfattr 2>/dev/null)" ] &&
+		skip "could not find setfattr" && return
+
+	XBIG=trusted.big
+	XSIZE=1024
+	touch $DIR/$tfile
+	VALUE=datadatadatadatadatadatadatadata
+	while [ $(echo $VALUE | wc -c) -lt $XSIZE ]; do
+		VALUE="$VALUE$VALUE"
+	done
+	log "save $XBIG on $DIR/$tfile"
+	setfattr -n $XBIG -v "$VALUE" $DIR/$tfile ||
+		error "saving $XBIG on $DIR/$tfile failed"
+	ORIG=$(getfattr -n $XBIG $DIR/$tfile 2> /dev/null | grep $XBIG)
+	OSIZE=$(echo $ORIG | wc -c)
+	[ $OSIZE -lt $XSIZE ] && error "set $XBIG too small ($OSIZE < $XSIZE)"
+
+	XSML=trusted.sml
+	log "save $XSML on $DIR/$tfile"
+	setfattr -n $XSML -v val $DIR/$tfile ||
+		error "saving $XSML on $DIR/$tfile failed"
+	NEW=$(getfattr -n $XBIG $DIR/$tfile 2> /dev/null | grep $XBIG)
+	if [ "$NEW" != "$ORIG" ]; then
+		log "orig: $ORIG"
+		log "new: $NEW"
+		error "$XBIG different after saving $XSML"
+	fi
+
+	log "grow $XSML on $DIR/$tfile"
+	setfattr -n $XSML -v "$VALUE" $DIR/$tfile ||
+		error "growing $XSML on $DIR/$tfile failed"
+	NEW=$(getfattr -n $XBIG $DIR/$tfile 2> /dev/null | grep $XBIG)
+	if [ "$NEW" != "$ORIG" ]; then
+		log "orig: $ORIG"
+		log "new: $NEW"
+		error "$XBIG different after growing $XSML"
+	fi
+	log "$XBIG still valid after growing $XSML"
+}
+run_test 102h "grow xattr from inside inode to external block"
+
 run_acl_subtest()
 {
     $LUSTRE/tests/acl/run $LUSTRE/tests/acl/$1.test
-- 
GitLab