From: Yu Jian Date: Mon, 14 Jan 2013 06:29:14 +0000 (+0800) Subject: LU-1129 obdfilter: handle race condition of recreating objects X-Git-Tag: v1_8_9_WC1_RC1~15 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=271aa360cd5436600232c0e1517e73184bf36500;p=fs%2Flustre-release.git LU-1129 obdfilter: handle race condition of recreating objects During OST recovery, a race can happen while handling replayed OST_WRITE request during the MDS->OST orphan recovery period to recreate missing objects, which can trigger ASSERTION(diff >= 0) failure. This patch handles the above issue by adding obd->obd_recovering into the assertion to check whether the OST is in recovery or not. If it's in recovery and diff < 0, then no assertion failure occurs, the object has been recreated. If the OST is not in recovery and diff < 0, then the assertion failure occurs. Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes testlist=sanity-quota Signed-off-by: Jian Yu Change-Id: I346875378802385a95b0832b76d19f9957910cdf Reviewed-on: http://review.whamcloud.com/5013 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Fan Yong Reviewed-by: Johann Lombardi --- diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 828475c..cb2cf77 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -3221,8 +3221,15 @@ static int filter_handle_precreate(struct obd_export *exp, struct obdo *oa, CDEBUG(D_RPCTRACE, "filter_last_id() = "LPU64" -> diff = %d\n", filter_last_id(filter, group), diff); - LASSERTF(diff >= 0,"%s: "LPU64" - "LPU64" = %d\n",obd->obd_name, - oa->o_id, filter_last_id(filter, group), diff); + /* + * Check obd->obd_recovering to handle the race condition + * while recreating missing precreated objects through + * filter_preprw_write() and mds_lov_clear_orphans() + * at the same time. + */ + LASSERTF(ergo(!obd->obd_recovering, diff >= 0), + "%s: "LPU64" - "LPU64" = %d\n", obd->obd_name, + oa->o_id, filter_last_id(filter, group), diff); } if (diff > 0) {