From 15dac618aabf2d5611a280bce13ca79c673f4f6d Mon Sep 17 00:00:00 2001 From: Aurelien Degremont Date: Tue, 30 May 2017 23:56:06 +0200 Subject: [PATCH] LU-8435 tests: slab alloc error does not LBUG Under memory pressure, for instance using a memory cgroup and kmem.limit_in_bytes enforced (SLURM does this), osc_extent_alloc() could fail and error handling will hit an LBUG. Add a test for this. Test-Parameters: trivial testlist=sanity,sanity,sanity Signed-off-by: Aurelien Degremont Change-Id: I135f05ee4be14521522c949e50bd4c8deb1f099a Reviewed-on: https://review.whamcloud.com/21745 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond --- lustre/tests/sanity.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 7aa4bf6..97c6d0f 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -16380,6 +16380,36 @@ test_410() } run_test 410 "Test inode number returned from kernel thread" +cleanup_test411_cgroup() { + trap 0 + rmdir "$1" +} + +test_411() { + local cg_basedir=/sys/fs/cgroup/memory + test -d "$cg_basedir" || { skip "no setup for cgroup"; return; } + + dd if=/dev/zero of=$DIR/$tfile bs=1M count=100 conv=fsync || + error "test file creation failed" + cancel_lru_locks osc + + # Create a very small memory cgroup to force a slab allocation error + local cgdir=$cg_basedir/osc_slab_alloc + mkdir $cgdir || error "cgroup mkdir '$cgdir' failed" + trap "cleanup_test411_cgroup $cgdir" EXIT + echo 2M > $cgdir/memory.kmem.limit_in_bytes + echo 1M > $cgdir/memory.limit_in_bytes + + # Should not LBUG, just be killed by oom-killer + sh -c "echo \$$ > $cgdir/tasks && dd if=$DIR/$tfile of=/dev/null" && + error "fail to trigger a memory allocation error" + + cleanup_test411_cgroup $cgdir + + return 0 +} +run_test 411 "Slab allocation error with cgroup does not LBUG" + prep_801() { [[ $(lustre_version_code mds1) -lt $(version_code 2.9.55) ]] || [[ $(lustre_version_code ost1) -lt $(version_code 2.9.55) ]] && -- 1.8.3.1