From 7d62abd99b6343c1562a7d0159dc5397eb44449d Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Wed, 22 Jan 2014 23:09:54 -0500 Subject: [PATCH] LU-4529 quota: call qsd_op_end() after trasn stop qsd_op_end() shouldn't be called before the transaction stopped, because qsd_op_end() is a quite heavy operation which could probably allocate memory with standard allocator flag (__GFP_IO), and allocating memory could result in dirty flush on other filesystems, that will lead to opening transaction on different journal and trigger the assert in jbd2_journal_start(): J_ASSERT(handle->h_transaction->t_journal == journal) at the end. Signed-off-by: Niu Yawei Change-Id: I4ea3ff011fa7e44460b9912050e90b174813e01a Reviewed-on: http://review.whamcloud.com/8968 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Johann Lombardi --- lustre/osd-ldiskfs/osd_handler.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index c98797d..5c2fcc7 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1023,19 +1023,17 @@ out: */ static int osd_trans_stop(const struct lu_env *env, struct thandle *th) { - int rc = 0; - struct osd_thandle *oh; - struct osd_thread_info *oti = osd_oti_get(env); - struct osd_iobuf *iobuf = &oti->oti_iobuf; + int rc = 0; + struct osd_thandle *oh; + struct osd_thread_info *oti = osd_oti_get(env); + struct osd_iobuf *iobuf = &oti->oti_iobuf; struct qsd_instance *qsd = oti->oti_dev->od_quota_slave; - ENTRY; + struct lquota_trans *qtrans; + ENTRY; - oh = container_of0(th, struct osd_thandle, ot_super); + oh = container_of0(th, struct osd_thandle, ot_super); - if (qsd != NULL) - /* inform the quota slave device that the transaction is - * stopping */ - qsd_op_end(env, qsd, oh->ot_quota_trans); + qtrans = oh->ot_quota_trans; oh->ot_quota_trans = NULL; if (oh->ot_handle != NULL) { @@ -1067,6 +1065,9 @@ static int osd_trans_stop(const struct lu_env *env, struct thandle *th) OBD_FREE_PTR(oh); } + /* inform the quota slave device that the transaction is stopping */ + qsd_op_end(env, qsd, qtrans); + /* as we want IO to journal and data IO be concurrent, we don't block * awaiting data IO completion in osd_do_bio(), instead we wait here * once transaction is submitted to the journal. all reqular requests -- 1.8.3.1