From 44cc49ddca95c130f4e165e0f567a6d339d3bf18 Mon Sep 17 00:00:00 2001 From: zam <zam> Date: Tue, 2 Dec 2008 19:51:31 +0000 Subject: [PATCH] Branch HEAD b=17742 i=h.huang i=alexey.lyashkov Add necessary spin-lock protection to dump_exports(). --- lustre/obdclass/obd_config.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index f0c7f9fbd0..36cb74ceae 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -448,19 +448,22 @@ int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg) static void dump_exports(struct obd_device *obd) { - struct obd_export *exp, *n; + struct obd_export *exp; - list_for_each_entry_safe(exp, n, &obd->obd_exports, exp_obd_chain) { + spin_lock(&obd->obd_dev_lock); + list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) { struct ptlrpc_reply_state *rs; struct ptlrpc_reply_state *first_reply = NULL; int nreplies = 0; + spin_lock(&exp->exp_lock); list_for_each_entry (rs, &exp->exp_outstanding_replies, rs_exp_list) { if (nreplies == 0) first_reply = rs; nreplies++; } + spin_unlock(&exp->exp_lock); CDEBUG(D_IOCTL, "%s: %p %s %s %d %d %d: %p %s\n", obd->obd_name, exp, exp->exp_client_uuid.uuid, @@ -469,6 +472,7 @@ static void dump_exports(struct obd_device *obd) exp->exp_failed, nreplies, first_reply, nreplies > 3 ? "..." : ""); } + spin_unlock(&obd->obd_dev_lock); } int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) -- GitLab