och->och_mod = NULL;
}
-static void mdc_commit_close(struct ptlrpc_request *req)
-{
- struct mdc_open_data *mod = req->rq_cb_data;
- struct ptlrpc_request *open_req;
- struct obd_import *imp = req->rq_import;
-
- DEBUG_REQ(D_RPCTRACE, req, "close req committed");
- if (mod == NULL)
- return;
-
- mod->mod_close_req = NULL;
- req->rq_cb_data = NULL;
- req->rq_commit_cb = NULL;
-
- open_req = mod->mod_open_req;
- LASSERT(open_req != NULL);
- LASSERT(open_req != LP_POISON);
- LASSERT(open_req->rq_type != LI_POISON);
-
- DEBUG_REQ(D_RPCTRACE, open_req, "open req balanced");
- LASSERT(open_req->rq_transno != 0);
- LASSERT(open_req->rq_import == imp);
-
- /* We no longer want to preserve this for transno-unconditional
- * replay. */
- spin_lock(&open_req->rq_lock);
- open_req->rq_replay = 0;
- spin_unlock(&open_req->rq_lock);
-}
-
int mdc_close(struct obd_export *exp, struct obdo *oa,
struct obd_client_handle *och, struct ptlrpc_request **request)
{
obd->u.cli.cl_max_mds_cookiesize };
int rc;
struct ptlrpc_request *req;
- struct mdc_open_data *mod;
ENTRY;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
/* Ensure that this close's handle is fixed up during replay. */
LASSERT(och != NULL);
LASSERT(och->och_magic == OBD_CLIENT_HANDLE_MAGIC);
- mod = och->och_mod;
- if (likely(mod != NULL)) {
- if (mod->mod_open_req->rq_type == LI_POISON) {
- CERROR("LBUG POISONED open %p!\n", mod->mod_open_req);
+ if (likely(och->och_mod != NULL)) {
+ struct ptlrpc_request *open_req = och->och_mod->mod_open_req;;
+
+ if (open_req->rq_type == LI_POISON) {
+ CERROR("LBUG POISONED open %p!\n", open_req);
LBUG();
ptlrpc_req_finished(req);
req = NULL;
GOTO(out, rc = -EIO);
}
- mod->mod_close_req = req;
- DEBUG_REQ(D_RPCTRACE, mod->mod_open_req, "matched open");
+ DEBUG_REQ(D_RPCTRACE, req, "close req");
+ DEBUG_REQ(D_RPCTRACE, open_req, "clear open replay");
+
+ /* We no longer want to preserve this open for replay even
+ * though the open was committed. b=3632, b=3633 */
+ spin_lock(&open_req->rq_lock);
+ open_req->rq_replay = 0;
+ spin_unlock(&open_req->rq_lock);
} else {
CDEBUG(D_RPCTRACE, "couldn't find open req; expecting error\n");
}
mdc_close_pack(req, REQ_REC_OFF, oa, oa->o_valid, och);
ptlrpc_req_set_repsize(req, 4, repsize);
- req->rq_commit_cb = mdc_commit_close;
- LASSERT(req->rq_cb_data == NULL);
- req->rq_cb_data = mod;
mdc_get_rpc_lock(obd->u.cli.cl_close_lock, NULL);
rc = ptlrpc_queue_wait(req);
"= %d", rc);
if (rc > 0)
rc = -rc;
- } else if (mod == NULL) {
+ } else if (och->och_mod == NULL) {
CERROR("Unexpected: can't find mdc_open_data, but the "
"close succeeded. Please tell <http://bugzilla.lustre.org/>.\n");
}
}
run_test 48 "MDS->OSC failure during precreate cleanup (2824)"
+test_49a() {
+ multiop $DIR/$tfile O_c &
+ pid=$!
+ sleep 1
+ rm -rf $DIR/$tfile
+
+#define OBD_FAIL_MDS_ALL_REPLY_NET 0x122
+ do_facet mds "lctl set_param fail_loc=0x80000122"
+ kill -USR1 $pid
+ do_facet mds "lctl set_param fail_loc=0"
+
+ replay_barrier_nodf mds
+ fail mds
+
+ wait $pid || return 1
+ $CHECKSTAT -t file $DIR/$tfile && return 2
+ return 0
+}
+run_test 49a "mds fail after close reply is dropped: open|create "
+
+test_49c() {
+ touch $DIR/$tfile
+ multiop $DIR/$tfile o_c &
+ pid=$!
+ sleep 1
+ rm -rf $DIR/$tfile
+
+#define OBD_FAIL_MDS_ALL_REPLY_NET 0x122
+ do_facet mds "lctl set_param fail_loc=0x80000122"
+ kill -USR1 $pid
+ do_facet mds "lctl set_param fail_loc=0"
+
+ replay_barrier_nodf mds
+ fail mds
+
+ wait $pid || return 1
+ $CHECKSTAT -t file $DIR/$tfile && return 2
+ return 0
+}
+run_test 49c "mds fail after close reply is dropped: open"
+
test_50() {
local oscdev=`do_facet mds lctl get_param -n devices | grep ${ost1_svc}-osc | awk '{print $1}' | head -1`
[ "$oscdev" ] || return 1