diff --git a/lustre/obdclass/fsfilt_ext3.c b/lustre/obdclass/fsfilt_ext3.c index 5dd196d51c064f1177d347d6778015651b56ab88..24844ffc2442c295c871ce12e8b85a7051f5d642 100644 --- a/lustre/obdclass/fsfilt_ext3.c +++ b/lustre/obdclass/fsfilt_ext3.c @@ -71,6 +71,8 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private) int nblocks = EXT3_DATA_TRANS_BLOCKS; void *handle; + LASSERT(current->journal_info == NULL); + switch(op) { case FSFILT_OP_CREATE_LOG: nblocks += EXT3_INDEX_EXTRA_TRANS_BLOCKS+EXT3_DATA_TRANS_BLOCKS; @@ -118,6 +120,8 @@ static void *fsfilt_ext3_start(struct inode *inode, int op, void *desc_private) handle = journal_start(EXT3_JOURNAL(inode), nblocks); unlock_kernel(); + if (!IS_ERR(handle)) + LASSERT(current->journal_info == handle); return handle; } @@ -233,11 +237,13 @@ static void *fsfilt_ext3_brw_start(int objcount, struct fsfilt_objinfo *fso, lock_kernel(); handle = journal_start(journal, needed); unlock_kernel(); - if (IS_ERR(handle)) + if (IS_ERR(handle)) { CERROR("can't get handle for %d credits: rc = %ld\n", needed, PTR_ERR(handle)); - else + } else { LASSERT(handle->h_buffer_credits >= needed); + LASSERT(current->journal_info == handle); + } RETURN(handle); } @@ -247,6 +253,7 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync) int rc; handle_t *handle = h; + LASSERT(current->journal_info == handle); if (force_sync) handle->h_sync = 1; /* recovery likes this */ @@ -254,6 +261,7 @@ static int fsfilt_ext3_commit(struct inode *inode, void *h, int force_sync) rc = journal_stop(handle); unlock_kernel(); + LASSERT(current->journal_info == NULL); return rc; } diff --git a/lustre/obdclass/fsfilt_extN.c b/lustre/obdclass/fsfilt_extN.c index 80f7e508ec6066564a7965fa59a47e99dc5754d7..d167ce9c2b2425efb1c5fe0bf8a738ab0daa8225 100644 --- a/lustre/obdclass/fsfilt_extN.c +++ b/lustre/obdclass/fsfilt_extN.c @@ -65,6 +65,8 @@ static void *fsfilt_extN_start(struct inode *inode, int op, void *desc_private) int nblocks = EXTN_DATA_TRANS_BLOCKS; void *handle; + LASSERT(current->journal_info == NULL); + switch(op) { case FSFILT_OP_CREATE_LOG: nblocks += EXTN_INDEX_EXTRA_TRANS_BLOCKS+EXTN_DATA_TRANS_BLOCKS; @@ -112,6 +114,8 @@ static void *fsfilt_extN_start(struct inode *inode, int op, void *desc_private) handle = journal_start(EXTN_JOURNAL(inode), nblocks); unlock_kernel(); + if (!IS_ERR(handle)) + LASSERT(current->journal_info == handle); return handle; } @@ -227,11 +231,13 @@ static void *fsfilt_extN_brw_start(int objcount, struct fsfilt_objinfo *fso, lock_kernel(); handle = journal_start(journal, needed); unlock_kernel(); - if (IS_ERR(handle)) + if (IS_ERR(handle)) { CERROR("can't get handle for %d credits: rc = %ld\n", needed, PTR_ERR(handle)); - else + } else { LASSERT(handle->h_buffer_credits >= needed); + LASSERT(current->journal_info == handle); + } RETURN(handle); } @@ -241,6 +247,7 @@ static int fsfilt_extN_commit(struct inode *inode, void *h, int force_sync) int rc; handle_t *handle = h; + LASSERT(current->journal_info == handle); if (force_sync) handle->h_sync = 1; /* recovery likes this */ @@ -248,6 +255,7 @@ static int fsfilt_extN_commit(struct inode *inode, void *h, int force_sync) rc = journal_stop(handle); unlock_kernel(); + LASSERT(current->journal_info == NULL); return rc; } diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index b6c1bd9716839ef951715128276d261e79e87fc1..41eb1401f9046100c4f74e2481ab6212f7cf454a 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1207,6 +1207,7 @@ static int filter_close_internal(struct obd_export *exp, int rc, rc2, cleanup_phase = 0; struct dentry *dparent = NULL; struct obd_run_ctxt saved; + int nested_trans = (current->journal_info != NULL); ENTRY; LASSERT(filp->private_data == ffd); @@ -1258,6 +1259,11 @@ static int filter_close_internal(struct obd_export *exp, if (!rc) rc = rc2; } + if (nested_trans == 0) { + LASSERT(current->journal_info == NULL); + if (oti != NULL) + oti->oti_handle = NULL; + } } cleanup: diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index c13b9868c1687527d59affa08bbba13563cebe70..001dc0f061a76d6edb9921ba132f0b8bfda6eeec 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -427,6 +427,11 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa, ENTRY; LASSERT(objcount == 1); + /* We should never be called during a transaction */ + LASSERT(oti != NULL); + LASSERT(oti->oti_handle == NULL); + LASSERT(current->journal_info == NULL); + OBD_ALLOC(fso, objcount * sizeof(*fso)); if (fso == NULL) RETURN(-ENOMEM); @@ -462,7 +467,6 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa, if (time_after(jiffies, now + 15 * HZ)) CERROR("slow prep setup %lus\n", (jiffies - now) / HZ); - LASSERT(oti != NULL); oti->oti_handle = fsfilt_brw_start(exp->exp_obd, objcount, fso, niocount, oti); if (IS_ERR(oti->oti_handle)) { @@ -527,6 +531,8 @@ out_pages: fsfilt_commit(exp->exp_obd, filter_parent(exp->exp_obd,S_IFREG,obj->ioo_id)->d_inode, oti->oti_handle, 0); + LASSERT(current->journal_info == NULL); + oti->oti_handle = NULL; goto out; /* dropped the dentry refs already (one per page) */ out_objinfo: @@ -631,16 +637,15 @@ filter_commitrw_write(int cmd, struct obd_export *exp, struct obdo *oa, struct niobuf_local *lnb; struct obd_device *obd = exp->exp_obd; int found_locked = 0, rc = 0, i; - int nested_trans = current->journal_info != NULL; unsigned long now = jiffies; /* DEBUGGING OST TIMEOUTS */ ENTRY; push_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL); + LASSERT(current->journal_info == NULL); if (cmd & OBD_BRW_WRITE) { - LASSERT(oti); - LASSERT(current->journal_info == NULL || - current->journal_info == oti->oti_handle); + LASSERT(oti != NULL); + LASSERT(oti->oti_handle != NULL); current->journal_info = oti->oti_handle; } @@ -748,6 +753,8 @@ filter_commitrw_write(int cmd, struct obd_export *exp, struct obdo *oa, rc = filter_finish_transno(exp, oti, rc); err = fsfilt_commit(obd, dparent->d_inode, oti->oti_handle, obd_sync_filter); + LASSERT(current->journal_info == NULL); + oti->oti_handle = NULL; if (err) rc = err; if (obd_sync_filter) @@ -756,7 +763,6 @@ filter_commitrw_write(int cmd, struct obd_export *exp, struct obdo *oa, CERROR("slow commitrw commit %lus\n", (jiffies-now)/HZ); } - LASSERT(nested_trans || current->journal_info == NULL); pop_ctxt(&saved, &obd->u.filter.fo_ctxt, NULL); RETURN(rc); } diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index aebcc576b8ce7cbc892c25d7dbcb5e03a94df2a1..20db4866f87b5778a123c87c9eadff66b9b64744 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -927,6 +927,7 @@ static int ost_handle(struct ptlrpc_request *req) int should_process, fail = OBD_FAIL_OST_ALL_REPLY_NET, rc = 0; ENTRY; + LASSERT(current->journal_info == NULL); /* XXX identical to MDS */ if (req->rq_reqmsg->opc != OST_CONNECT) { struct obd_device *obd; @@ -1005,12 +1006,14 @@ static int ost_handle(struct ptlrpc_request *req) CDEBUG(D_INODE, "write\n"); OBD_FAIL_RETURN(OBD_FAIL_OST_BRW_NET, 0); rc = ost_brw_write(req, oti); + LASSERT(current->journal_info == NULL); /* ost_brw sends its own replies */ RETURN(rc); case OST_READ: CDEBUG(D_INODE, "read\n"); OBD_FAIL_RETURN(OBD_FAIL_OST_BRW_NET, 0); rc = ost_brw_read(req); + LASSERT(current->journal_info == NULL); /* ost_brw sends its own replies */ RETURN(rc); case OST_SAN_READ: @@ -1081,6 +1084,8 @@ static int ost_handle(struct ptlrpc_request *req) RETURN(rc); } + LASSERT(current->journal_info == NULL); + EXIT; /* If we're DISCONNECTing, the export_data is already freed */ if (!rc && req->rq_reqmsg->opc != OST_DISCONNECT) {