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);
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)
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. */
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);
}
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) {
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);
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;
}
}
}
+ /* 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);
struct ofd_device *ofd = ofd_exp(exp);
struct ofd_thread_info *info;
struct ofd_object *fo;
- __u64 curr_version;
int rc = 0;
ENTRY;
fo = ofd_object_find(env, ofd, &info->fti_fid);
if (IS_ERR(fo))
GOTO(out, rc = PTR_ERR(fo));
+ if (!ofd_object_exists(fo))
+ GOTO(out_put, rc = -ENOENT);
+
LASSERT(fo != NULL);
rc = ofd_attr_get(env, fo, &info->fti_attr);
oinfo->oi_oa->o_valid = OBD_MD_FLID;
- if (rc == 0)
+ if (rc == 0) {
+ __u64 curr_version;
+
obdo_from_la(oinfo->oi_oa, &info->fti_attr,
OFD_VALID_FLAGS | LA_UID | LA_GID);
- /* Store object version in reply */
- curr_version = dt_version_get(env, ofd_object_child(fo));
- if ((__s64)curr_version != -EOPNOTSUPP) {
- oinfo->oi_oa->o_valid |= OBD_MD_FLDATAVERSION;
- oinfo->oi_oa->o_data_version = curr_version;
+ /* Store object version in reply */
+ curr_version = dt_version_get(env, ofd_object_child(fo));
+ if ((__s64)curr_version != -EOPNOTSUPP) {
+ oinfo->oi_oa->o_valid |= OBD_MD_FLDATAVERSION;
+ oinfo->oi_oa->o_data_version = curr_version;
+ }
}
+
+out_put:
ofd_object_put(env, fo);
out:
RETURN(rc);