From 82d52a7fe8a02b133cbca04357be360570dd60f1 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 18 Jun 2004 17:55:56 +0000 Subject: [PATCH] Don't clean up request reference if we had an MDS open error. b=3430 --- lustre/ChangeLog | 3 ++- lustre/llite/file.c | 11 ++++++----- lustre/mdc/mdc_locks.c | 10 +++++----- lustre/tests/llmount.sh | 5 +++++ lustre/tests/llmountcleanup.sh | 2 ++ lustre/tests/llrmount.sh | 5 +++++ lustre/tests/sanityN.sh | 29 ++++++++++++++++++++--------- 7 files changed, 45 insertions(+), 20 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 83a4551..e4358b7 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -1,6 +1,7 @@ tbd Cluster File Systems, Inc. - * version 1.2.3 + * version 1.2.4 * bug fixes + - don't cleanup request in ll_file_open() on failed MDS open (3430) * miscellania 2004-06-17 Cluster File Systems, Inc. diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 4918f98..a50f564 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -186,8 +186,8 @@ int ll_file_open(struct inode *inode, struct file *file) int rc = 0; ENTRY; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), flags %o\n", inode->i_ino, + inode->i_generation, inode, file->f_flags); /* don't do anything for / */ if (inode->i_sb->s_root == file->f_dentry) @@ -204,12 +204,13 @@ int ll_file_open(struct inode *inode, struct file *file) lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_OPEN); rc = it_open_error(DISP_OPEN_OPEN, it); + /* mdc_intent_lock() didn't get a request ref if there was an open + * error, so don't do cleanup on the request here (bug 3430) */ if (rc) - GOTO(out, rc); + RETURN(rc); rc = ll_local_open(file, it); - if (rc) - LBUG(); + LASSERTF(rc == 0, "rc = %d\n", rc); if (!S_ISREG(inode->i_mode)) GOTO(out, rc); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 25bb4bf..03e8299 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -424,8 +424,8 @@ int mdc_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt, ENTRY; LASSERT(it); - CDEBUG(D_DLMTRACE, "name: %*s in inode %ld, intent: %s\n", len, name, - (unsigned long)pfid->id, ldlm_it2str(it->it_op)); + CDEBUG(D_DLMTRACE, "name: %*s in inode "LPU64", intent: %s flags %#o\n", + len, name, pfid->id, ldlm_it2str(it->it_op), it->it_flags); if (cfid && (it->it_op == IT_LOOKUP || it->it_op == IT_GETATTR)) { /* We could just return 1 immediately, but since we should only @@ -521,13 +521,13 @@ int mdc_intent_lock(struct obd_export *exp, struct ll_uctxt *uctxt, */ if (it_disposition(it, DISP_OPEN_CREATE) && !it_open_error(DISP_OPEN_CREATE, it)) - ptlrpc_request_addref(request); + ptlrpc_request_addref(request); /* balanced in ll_create_node */ if (it_disposition(it, DISP_OPEN_OPEN) && !it_open_error(DISP_OPEN_OPEN, it)) - ptlrpc_request_addref(request); + ptlrpc_request_addref(request); /* balanced in ll_file_open */ if (it->it_op & IT_CREAT) { - /* XXX this belongs in ll_create_iit */ + /* XXX this belongs in ll_create_it */ } else if (it->it_op == IT_OPEN) { LASSERT(!it_disposition(it, DISP_OPEN_CREATE)); } else { diff --git a/lustre/tests/llmount.sh b/lustre/tests/llmount.sh index 9dd1ece..44649ee 100755 --- a/lustre/tests/llmount.sh +++ b/lustre/tests/llmount.sh @@ -5,6 +5,7 @@ export PATH=`dirname $0`/../utils:$PATH LCONF=${LCONF:-lconf} NAME=${NAME:-local} +LLMOUNT=${LLMOUNT:-llmount} config=$NAME.xml mkconfig=$NAME.sh @@ -28,3 +29,7 @@ fi ${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt ${REFORMAT:---reformat} $@ \ $conf_opt || exit 2 + +if [ "$MOUNT2" ]; then + $LLMOUNT -v `hostname`:/mds1/client $MOUNT2 || exit 3 +fi diff --git a/lustre/tests/llmountcleanup.sh b/lustre/tests/llmountcleanup.sh index 15277d6..a3ef1ad 100755 --- a/lustre/tests/llmountcleanup.sh +++ b/lustre/tests/llmountcleanup.sh @@ -29,6 +29,8 @@ fi [ "$NODE" ] && node_opt="--node $NODE" sync; sleep 2; sync +[ "$MOUNT2" ] && umount $MOUNT2 + ${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt --cleanup $@ \ --dump $TMP/debug $conf_opt rc=$? diff --git a/lustre/tests/llrmount.sh b/lustre/tests/llrmount.sh index 5aa8601..87419a0 100755 --- a/lustre/tests/llrmount.sh +++ b/lustre/tests/llrmount.sh @@ -4,6 +4,7 @@ export PATH=`dirname $0`/../utils:$PATH LCONF=${LCONF:-lconf} NAME=${NAME:-local} +LLMOUNT=${LLMOUNT:-llmount} config=$NAME.xml mkconfig=$NAME.sh @@ -28,3 +29,7 @@ fi [ "$NODE" ] && node_opt="--node $NODE" ${LCONF} $NOMOD $portals_opt $lustre_opt $node_opt $@ $conf_opt || exit 2 + +if [ "$MOUNT2" ]; then + $LLMOUNT -v `hostname`:/mds1/client $MOUNT2 || exit 3 +fi diff --git a/lustre/tests/sanityN.sh b/lustre/tests/sanityN.sh index 972d548..1c47779 100644 --- a/lustre/tests/sanityN.sh +++ b/lustre/tests/sanityN.sh @@ -31,22 +31,20 @@ else RUNAS=${RUNAS:-"runas -u $RUNAS_ID"} fi -export NAME=${NAME:-mount2} - SAVE_PWD=$PWD clean() { echo -n "cln.." sh llmountcleanup.sh > /dev/null || exit 20 } -CLEAN=${CLEAN:-clean} +CLEAN=${CLEAN:-} start() { echo -n "mnt.." sh llrmount.sh > /dev/null || exit 10 echo "done" } -START=${START:-start} +START=${START:-} log() { echo "$*" @@ -290,11 +288,11 @@ test_14() { $DIR2/d14/ls && error || true exec 100<&- } -run_test 14 "execution of file opened for write should return -ETXTBSY==" +run_test 14 "execution of file open for write returns -ETXTBSY =" test_14a() { mkdir -p $DIR1/d14 - cp -p `which multiop` $DIR1/d14/multiop + cp -p `which multiop` $DIR1/d14/multiop || error "cp failed" $DIR1/d14/multiop $TMP/test14.junk O_c & MULTIPID=$! sleep 1 @@ -302,11 +300,11 @@ test_14a() { kill -USR1 $MULTIPID || return 2 wait $MULTIPID || return 3 } -run_test 14a "open(RDWR) of file being executed should return -ETXTBSY" +run_test 14a "open(RDWR) of executing file returns -ETXTBSY ====" test_14b() { mkdir -p $DIR1/d14 - cp -p `which multiop` $DIR1/d14/multiop + cp -p `which multiop` $DIR1/d14/multiop || error "cp failed" $DIR1/d14/multiop $TMP/test14.junk O_c & MULTIPID=$! sleep 1 @@ -314,7 +312,20 @@ test_14b() { kill -USR1 $MULTIPID || return 2 wait $MULTIPID || return 3 } -run_test 14b "truncate of file being executed should return -ETXTBSY" +run_test 14b "truncate of executing file return -ETXTBSY ======" + +test_14c() { # bug 3430 + mkdir -p $DIR1/d14 + cp -p `which multiop` $DIR1/d14/multiop || error "cp failed" + $DIR1/d14/multiop $TMP/test14.junk O_c & + MULTIPID=$! + sleep 1 + cp /etc/hosts $DIR2/d14/multiop && error "expected error, got success" + kill -USR1 $MULTIPID || return 2 + wait $MULTIPID || return 3 + #cmp `which multiop` $DIR1/d14/multiop || error "binary changed" +} +run_test 14c "open(O_TRUNC) of executing file return -ETXTBSY ==" test_15() { # bug 974 - ENOSPC echo $PATH -- 1.8.3.1