X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fofd%2Fofd_obd.c;h=8bcbd06b09ea8ca9c0c08038e6cb07efdd079086;hp=c0a6fcd3f46fa770af475865ce00cfde2fae8560;hb=a4e8e2f71fb64e293cbf8db07f4608646fd7acd4;hpb=02a976b13d16fac7708fbd1827fcc6129b7e20f3 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; }