From: Alex Zhuravlev Date: Sat, 28 Sep 2013 13:58:45 +0000 (+0400) Subject: LU-4019 ofd: setattr don't udpate lvbo with object referenced X-Git-Tag: 2.5.0~19 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a4e8e2f71fb64e293cbf8db07f4608646fd7acd4;hp=02a976b13d16fac7708fbd1827fcc6129b7e20f3 LU-4019 ofd: setattr don't udpate lvbo with object referenced we shouldn't allow recursive lu_object_find() while object can be destroyed. so release the reference to the object before calling to ldlm_res_lvbo_update() which lookups the object on its own. Signed-off-by: Alex Zhuravlev Change-Id: If34d89834e352b6d0b8129a6fb4377317833a78a Reviewed-on: http://review.whamcloud.com/7795 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Tested-by: Hudson Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index c0a6fcd..8bcbd06 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -887,12 +887,6 @@ int ofd_setattr(const struct lu_env *env, struct obd_export *exp, if (rc) GOTO(out_unlock, rc); - res = ldlm_resource_get(ns, NULL, &info->fti_resid, LDLM_EXTENT, 0); - if (res != NULL) { - ldlm_res_lvbo_update(res, NULL, 0); - ldlm_resource_putref(res); - } - ofd_info2oti(info, oti); ofd_counter_incr(exp, LPROC_OFD_STATS_SETATTR, oti->oti_jobid, 1); @@ -900,6 +894,19 @@ int ofd_setattr(const struct lu_env *env, struct obd_export *exp, out_unlock: ofd_object_put(env, fo); out: + if (rc == 0) { + /* we do not call this before to avoid lu_object_find() in + * ->lvbo_update() holding another reference on the object. + * otherwise concurrent destroy can make the object unavailable + * for 2nd lu_object_find() waiting for the first reference + * to go... deadlock! */ + res = ldlm_resource_get(ns, NULL, &info->fti_resid, LDLM_EXTENT, 0); + if (res != NULL) { + ldlm_res_lvbo_update(res, NULL, 0); + ldlm_resource_putref(res); + } + } + return rc; }