From 8ccca0ae2d5d8a29c032a5d099e4a89cdce28a33 Mon Sep 17 00:00:00 2001
From: bwzhou <bwzhou>
Date: Tue, 20 May 2008 09:07:38 +0000
Subject: [PATCH] Branch b1_6 b=13285 r=adilger, deen

1. updated ext3-mballoc3-core.patch and added ext3-max-dir-size.patch to limit the maximum size of a directory;
2. updated other ldiskfs patches to resolve patch conflicts caused by the above two new patches;
3. added a test case in sanity.sh.
---
 lustre/tests/sanity.sh | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh
index 3c32b70693..35503305de 100644
--- a/lustre/tests/sanity.sh
+++ b/lustre/tests/sanity.sh
@@ -4968,6 +4968,43 @@ test_128() { # bug 15212
 }
 run_test 128 "interactive lfs for 2 consecutive find's"
 
+test_129() {
+	[ "$FSTYPE" = "ldiskfs" ] || return 0
+	mkdir $DIR/$tdir
+
+	EFBIG=27
+	ldiskfs_prefix=/proc/fs/ldiskfs
+	proc_file=max_dir_size
+	max_bytes=16385
+
+	echo $max_bytes >$ldiskfs_prefix/$proc_file
+
+	I=0
+	J=0
+	while [ $I -lt $max_bytes ]; do
+		touch $DIR/$tdir/$J
+		J=$((J+1))
+		I=$(stat -c%s "$DIR/$tdir")
+	done
+
+	# One more file and we should be over the limit
+	multiop $DIR/$tdir/$J Oc
+	rc=$?
+	if [ $rc -eq 0 ]; then
+		rm -rf $DIR/$tdir
+		error "exceeded dir size limit: $I bytes"
+	elif [ $rc -ne $EFBIG ]; then
+		rm -rf $DIR/$tdir
+		error "return code $rc received instead of expected $EFBIG"
+	else
+		echo "return code $rc received as expected"
+	fi
+
+	echo 0 >$ldiskfs_prefix/$proc_file
+	rm -rf $DIR/$tdir
+}
+run_test 129 "test directory size limit ========================"
+
 TMPDIR=$OLDTMPDIR
 TMP=$OLDTMP
 HOME=$OLDHOME
-- 
GitLab