From 28a4dc177465b6ba6ac16def212578ad14b742e6 Mon Sep 17 00:00:00 2001 From: zam Date: Thu, 22 Oct 2009 07:35:58 +0000 Subject: [PATCH] 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. --- lustre/mgc/mgc_request.c | 5 +++++ 1 file changed, 5 insertions(+) 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 */ -- 1.8.3.1