From e15dfb6720bfd928dbcebef0039a71d562efbf1a Mon Sep 17 00:00:00 2001 From: shadow Date: Fri, 23 Jan 2009 13:32:34 +0000 Subject: [PATCH] don't leak openhandle in ESTALE case. Branch b_release_1_8_0 b=16417 i=green i=johann i=bobijam --- lustre/llite/dcache.c | 7 +++++++ lustre/tests/sanityN.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index fed9019..fd0d52b 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -473,6 +473,13 @@ do_lock: if (rc != -ESTALE) { CDEBUG(D_INFO, "ll_intent_lock: rc %d : it->it_status " "%d\n", rc, it->d.lustre.it_status); + } else { +#ifndef HAVE_VFS_INTENT_PATCHES + if (it_disposition(it, DISP_OPEN_OPEN) && + !it_open_error(DISP_OPEN_OPEN, it)) + /* server have valid open - close file first*/ + ll_release_openhandle(de, it); +#endif } GOTO(out, rc = 0); } diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh index ed31f66..c7e17267 100644 --- a/lustre/tests/sanityN.sh +++ b/lustre/tests/sanityN.sh @@ -794,6 +794,32 @@ test_35() { # bug 17645 } run_test 35 "-EINTR cp_ast vs. bl_ast race does not evict client" +test_36() { #bug 16417 + local SIZE + mkdir -p $MOUNT1/$tdir + lfs setstripe -c -1 $MOUNT1/$tdir + i=0 + SIZE=100 + + while [ $i -le 10 ]; do + lctl mark "start test" + before=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }') + dd if=/dev/zero of=$MOUNT1/$tdir/file000 bs=1M count=$SIZE + dd if=$MOUNT2/$tdir/file000 of=/dev/null bs=1M count=$SIZE & + read_pid=$! + sleep 0.1 + rm -f $MOUNT1/$tdir/file000 + wait $read_pid + after=$($LFS df | awk '{if ($1 ~/^filesystem/) {print $5; exit} }') + if [ $before -gt $after ]; then + error "space leaked" + exit; + fi + let i=i+1 + done +} +run_test 36 "handle ESTALE/open-unlink corectly" + log "cleanup: ======================================================" check_and_cleanup_lustre -- 1.8.3.1