X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fofd%2Fofd_obd.c;h=8bcbd06b09ea8ca9c0c08038e6cb07efdd079086;hb=a4e8e2f71fb64e293cbf8db07f4608646fd7acd4;hp=ab8c3f592bc9effdd424e009a5544c3dda30c51f;hpb=b36de486200154ca82194e2159ff0f96c41c7069;p=fs%2Flustre-release.git diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index ab8c3f5..8bcbd06 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -58,6 +58,8 @@ static int ofd_export_stats_init(struct ofd_device *ofd, ENTRY; + LASSERT(obd->obd_uses_nid_stats); + if (obd_uuid_equals(&exp->exp_client_uuid, &obd->obd_uuid)) /* Self-export gets no proc entry */ RETURN(0); @@ -77,9 +79,7 @@ static int ofd_export_stats_init(struct ofd_device *ofd, stats = exp->exp_nid_stats; LASSERT(stats != NULL); - num_stats = (sizeof(*obd->obd_type->typ_dt_ops) / sizeof(void *)) + - LPROC_OFD_LAST - 1; - + num_stats = NUM_OBD_STATS + LPROC_OFD_LAST; stats->nid_stats = lprocfs_alloc_stats(num_stats, LPROCFS_STATS_FLAG_NOPERCPU); if (stats->nid_stats == NULL) @@ -137,7 +137,6 @@ static int ofd_parse_connect_data(const struct lu_env *env, fed->fed_group = data->ocd_group; data->ocd_connect_flags &= OST_CONNECT_SUPPORTED; - exp->exp_connect_data = *data; data->ocd_version = LUSTRE_VERSION_CODE; /* Kindly make sure the SKIP_ORPHAN flag is from MDS. */ @@ -156,7 +155,7 @@ static int ofd_parse_connect_data(const struct lu_env *env, data->ocd_grant_extent = ofd->ofd_dt_conf.ddp_grant_frag >> 10; } - if (exp_connect_flags(exp) & OBD_CONNECT_GRANT) + if (data->ocd_connect_flags & OBD_CONNECT_GRANT) data->ocd_grant = ofd_grant_connect(env, exp, data->ocd_grant, new_connection); @@ -316,7 +315,7 @@ static int ofd_obd_connect(const struct lu_env *env, struct obd_export **_exp, } CDEBUG(D_HA, "%s: get connection from MDS %d\n", obd->obd_name, - data->ocd_group); + data ? data->ocd_group : -1); out: if (rc != 0) { @@ -888,18 +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); - } - - oinfo->oi_oa->o_valid = OBD_MD_FLID; - - /* Quota release needs uid/gid info */ - rc = ofd_attr_get(env, fo, &info->fti_attr); - obdo_from_la(oinfo->oi_oa, &info->fti_attr, - OFD_VALID_FLAGS | LA_UID | LA_GID); ofd_info2oti(info, oti); ofd_counter_incr(exp, LPROC_OFD_STATS_SETATTR, oti->oti_jobid, 1); @@ -907,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; } @@ -1305,6 +1305,22 @@ int ofd_create(const struct lu_env *env, struct obd_export *exp, } } + /* This can happen if a new OST is formatted and installed + * in place of an old one at the same index. Instead of + * precreating potentially millions of deleted old objects + * (possibly filling the OST), only precreate the last batch. + * LFSCK will eventually clean up any orphans. LU-14 */ + if (diff > 5 * OST_MAX_PRECREATE) { + diff = OST_MAX_PRECREATE / 2; + LCONSOLE_WARN("%s: precreate FID "DOSTID" is over %u " + "larger than the LAST_ID "DOSTID", only " + "precreating the last %u objects.\n", + ofd_name(ofd), POSTID(&oa->o_oi), + 5 * OST_MAX_PRECREATE, + POSTID(&oseq->os_oi), diff); + ofd_seq_last_oid_set(oseq, ostid_id(&oa->o_oi) - diff); + } + while (diff > 0) { next_id = ofd_seq_last_oid(oseq) + 1; count = ofd_precreate_batch(ofd, diff);