+ do_facet client multiop $f or || return 3
+ drop_ldlm_cancel multiop $f Ow || echo "client evicted, as expected"
+
+ do_facet client munlink $f || return 4
+}
+run_test 19b "test expired_lock_main on ost (2867)"
+
+test_20a() { # bug 2983 - ldlm_handle_enqueue cleanup
+ mkdir -p $DIR/$tdir
+ multiop $DIR/$tdir/${tfile} O_wc &
+ MULTI_PID=$!
+ sleep 1
+ cancel_lru_locks OSC
+#define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
+ do_facet ost sysctl -w lustre.fail_loc=0x80000308
+ kill -USR1 $MULTI_PID
+ wait $MULTI_PID
+ rc=$?
+ [ $rc -eq 0 ] && error "multiop didn't fail enqueue: rc $rc" || true
+}
+run_test 20a "ldlm_handle_enqueue error (should return error)"
+
+test_20b() { # bug 2986 - ldlm_handle_enqueue error during open
+ mkdir -p $DIR/$tdir
+ touch $DIR/$tdir/${tfile}
+ cancel_lru_locks OSC
+#define OBD_FAIL_LDLM_ENQUEUE_EXTENT_ERR 0x308
+ do_facet ost sysctl -w lustre.fail_loc=0x80000308
+ dd if=/etc/hosts of=$DIR/$tdir/$tfile && \
+ error "didn't fail open enqueue" || true
+}
+run_test 20b "ldlm_handle_enqueue error (should return error)"
+
+test_21a() {
+ mkdir -p $DIR/$tdir-1
+ mkdir -p $DIR/$tdir-2
+ multiop $DIR/$tdir-1/f O_c &
+ close_pid=$!
+
+ do_facet mds "sysctl -w lustre.fail_loc=0x80000129"
+ multiop $DIR/$tdir-2/f Oc &
+ open_pid=$!
+ sleep 1
+ do_facet mds "sysctl -w lustre.fail_loc=0"
+
+ do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
+ kill -USR1 $close_pid
+ cancel_lru_locks MDC # force the close
+ wait $close_pid || return 1
+ wait $open_pid || return 2
+ do_facet mds "sysctl -w lustre.fail_loc=0"
+
+ $CHECKSTAT -t file $DIR/$tdir-1/f || return 3
+ $CHECKSTAT -t file $DIR/$tdir-2/f || return 4
+
+ rm -rf $DIR/$tdir-*
+}
+run_test 21a "drop close request while close and open are both in flight"
+
+test_21b() {
+ mkdir -p $DIR/$tdir-1
+ mkdir -p $DIR/$tdir-2
+ multiop $DIR/$tdir-1/f O_c &
+ close_pid=$!
+
+ do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
+ mcreate $DIR/$tdir-2/f &
+ open_pid=$!
+ sleep 1
+ do_facet mds "sysctl -w lustre.fail_loc=0"
+
+ kill -USR1 $close_pid
+ cancel_lru_locks MDC # force the close
+ wait $close_pid || return 1
+ wait $open_pid || return 3
+
+ $CHECKSTAT -t file $DIR/$tdir-1/f || return 4
+ $CHECKSTAT -t file $DIR/$tdir-2/f || return 5
+ rm -rf $DIR/$tdir-*
+}
+run_test 21b "drop open request while close and open are both in flight"
+
+test_21c() {
+ mkdir -p $DIR/$tdir-1
+ mkdir -p $DIR/$tdir-2
+ multiop $DIR/$tdir-1/f O_c &
+ close_pid=$!
+
+ do_facet mds "sysctl -w lustre.fail_loc=0x80000107"
+ mcreate $DIR/$tdir-2/f &
+ open_pid=$!
+ sleep 3
+ do_facet mds "sysctl -w lustre.fail_loc=0"
+
+ do_facet mds "sysctl -w lustre.fail_loc=0x80000115"
+ kill -USR1 $close_pid
+ cancel_lru_locks MDC # force the close
+ wait $close_pid || return 1
+ wait $open_pid || return 2
+
+ do_facet mds "sysctl -w lustre.fail_loc=0"
+
+ $CHECKSTAT -t file $DIR/$tdir-1/f || return 2
+ $CHECKSTAT -t file $DIR/$tdir-2/f || return 3
+ rm -rf $DIR/$tdir-*
+}
+run_test 21c "drop both request while close and open are both in flight"