From: panda Date: Thu, 19 Nov 2009 11:28:16 +0000 (+0000) Subject: b=21150 X-Git-Tag: GIT_EPOCH_B_HD_KDMU~70 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=af8bcd8339128470065d4b2e06bda94a1ce4adad;p=fs%2Flustre-release.git b=21150 i=Johann Lombardi i=ZhiYong Tian avoid mds-lov cleanup during dqacq --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 03ef1b3..0353146 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1073,6 +1073,7 @@ struct obd_device { struct lvfs_run_ctxt obd_lvfs_ctxt; struct obd_llog_group obd_olg; /* default llog group */ struct obd_device *obd_observer; + struct rw_semaphore obd_observer_link_sem; struct obd_notify_upcall obd_upcall; struct obd_export *obd_self_export; /* list of exports in LRU order, for ping evictor, with obd_dev_lock */ diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 9cadd6b..e1e4bc5 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1643,9 +1643,34 @@ static inline int obd_register_observer(struct obd_device *obd, { ENTRY; OBD_CHECK_DEV(obd); - if (obd->obd_observer && observer) + down_write(&obd->obd_observer_link_sem); + if (obd->obd_observer && observer) { + up_write(&obd->obd_observer_link_sem); RETURN(-EALREADY); + } obd->obd_observer = observer; + up_write(&obd->obd_observer_link_sem); + RETURN(0); +} + +static inline int obd_pin_observer(struct obd_device *obd, + struct obd_device **observer) +{ + ENTRY; + down_read(&obd->obd_observer_link_sem); + if (!obd->obd_observer) { + *observer = NULL; + up_read(&obd->obd_observer_link_sem); + RETURN(-ENOENT); + } + *observer = obd->obd_observer; + RETURN(0); +} + +static inline int obd_unpin_observer(struct obd_device *obd) +{ + ENTRY; + up_read(&obd->obd_observer_link_sem); RETURN(0); } diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 5ee1516..a889f18 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -2252,7 +2252,7 @@ int target_handle_dqacq_callback(struct ptlrpc_request *req) { #ifdef __KERNEL__ struct obd_device *obd = req->rq_export->exp_obd; - struct obd_device *master_obd; + struct obd_device *master_obd = NULL, *lov_obd = NULL; struct obd_device_target *obt; struct lustre_quota_ctxt *qctxt; struct qunit_data *qdata = NULL; @@ -2279,13 +2279,13 @@ int target_handle_dqacq_callback(struct ptlrpc_request *req) } /* we use the observer */ - if (!obd->obd_observer || !obd->obd_observer->obd_observer) { + if (obd_pin_observer(obd, &lov_obd) || + obd_pin_observer(lov_obd, &master_obd)) { CERROR("Can't find the observer, it is recovering\n"); req->rq_status = -EAGAIN; GOTO(out, rc); } - master_obd = obd->obd_observer->obd_observer; obt = &master_obd->u.obt; qctxt = &obt->obt_qctxt; @@ -2331,6 +2331,11 @@ int target_handle_dqacq_callback(struct ptlrpc_request *req) EXIT; out: + if (master_obd) + obd_unpin_observer(lov_obd); + if (lov_obd) + obd_unpin_observer(obd); + rc = ptlrpc_reply(req); return rc; #else diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 2ee0fe3..779d0d3 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -268,6 +268,7 @@ int class_attach(struct lustre_cfg *lcfg) obd->obd_osfs_age = cfs_time_shift_64(-1000); /* XXX belongs in setup not attach */ + init_rwsem(&obd->obd_observer_link_sem); /* recovery data */ cfs_init_timer(&obd->obd_recovery_timer); spin_lock_init(&obd->obd_processing_task_lock);