From: zam Date: Thu, 22 Oct 2009 07:35:58 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_290~5 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=28a4dc177465b6ba6ac16def212578ad14b742e6;p=fs%2Flustre-release.git Branch HEAD b=20831 i=nathan.rutman i=robert.read Fix a race between do_requeue and client_disconnect_export by protecting the check for cl_conn_count by the client semaphore. --- diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 337418b..8652566 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -374,6 +374,10 @@ static void do_requeue(struct config_llog_data *cld) { LASSERT(atomic_read(&cld->cld_refcount) > 0); + /* Do not run mgc_process_log on a disconnected export or an + export which is being disconnected. Take the client + semaphore to make the check non-racy. */ + down_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem); if (cld->cld_mgcexp->exp_obd->u.cli.cl_conn_count != 0) { CDEBUG(D_MGC, "updating log %s\n", cld->cld_logname); mgc_process_log(cld->cld_mgcexp->exp_obd, cld); @@ -381,6 +385,7 @@ static void do_requeue(struct config_llog_data *cld) CDEBUG(D_MGC, "disconnecting, won't update log %s\n", cld->cld_logname); } + up_read(&cld->cld_mgcexp->exp_obd->u.cli.cl_sem); /* Whether we enqueued again or not in mgc_process_log, we're done * with the ref from the old enqueue */