* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 only,
* as published by the Free Software Foundation.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License version 2 for more details. A copy is
* included in the COPYING file that accompanied this code.
-
+ *
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.gnu.org/licenses/gpl-2.0.html
struct lod_tgt_descs *ltd;
struct obd_uuid obd_uuid;
bool for_ost;
+ bool lock = false;
ENTRY;
CDEBUG(D_CONFIG, "osp:%s idx:%d gen:%d\n", osp, index, gen);
OBD_CONNECT_LRU_RESIZE |
#endif
OBD_CONNECT_MDS |
- OBD_CONNECT_OSS_CAPA |
OBD_CONNECT_REQPORTAL |
OBD_CONNECT_SKIP_ORPHAN |
OBD_CONNECT_FID |
OBD_CONNECT_LVB_TYPE |
OBD_CONNECT_VERSION |
OBD_CONNECT_PINGLESS |
- OBD_CONNECT_LFSCK;
+ OBD_CONNECT_LFSCK |
+ OBD_CONNECT_BULK_MBITS;
data->ocd_group = tgt_index;
ltd = &lod->lod_ost_descs;
for_ost = false;
data->ocd_ibits_known = MDS_INODELOCK_UPDATE;
data->ocd_connect_flags |= OBD_CONNECT_ACL |
- OBD_CONNECT_MDS_CAPA |
- OBD_CONNECT_OSS_CAPA |
OBD_CONNECT_IBITS |
OBD_CONNECT_MDS_MDS |
OBD_CONNECT_FID |
OBD_CONNECT_AT |
OBD_CONNECT_FULL20 |
- OBD_CONNECT_LFSCK;
- /* XXX set MDS-MDS flags, remove this when running this
- * on client*/
- data->ocd_connect_flags |= OBD_CONNECT_MDS_MDS;
+ OBD_CONNECT_LFSCK |
+ OBD_CONNECT_BULK_MBITS;
spin_lock(&imp->imp_lock);
imp->imp_server_timeout = 1;
spin_unlock(&imp->imp_lock);
}
mutex_lock(<d->ltd_mutex);
+ lock = true;
if (cfs_bitmap_check(ltd->ltd_tgt_bitmap, index)) {
CERROR("%s: device %d is registered already\n", obd->obd_name,
index);
}
}
- if (!strcmp(LUSTRE_OSC_NAME, type)) {
+ if (for_ost) {
/* pool and qos are not supported for MDS stack yet */
rc = lod_ost_pool_add(&lod->lod_pool_info, index,
lod->lod_osts_size);
ltd->ltd_tgtnr++;
mutex_unlock(<d->ltd_mutex);
lod_putref(lod, ltd);
+ lock = false;
if (lod->lod_recovery_completed)
ldev->ld_ops->ldo_recovery_complete(env, ldev);
+ if (!for_ost && lod->lod_initialized) {
+ rc = lod_sub_init_llog(env, lod, tgt_desc->ltd_tgt);
+ if (rc != 0) {
+ CERROR("%s: cannot start llog on %s:rc = %d\n",
+ lod2obd(lod)->obd_name, osp, rc);
+ GOTO(out_ltd, rc);
+ }
+ }
+
rc = lfsck_add_target(env, lod->lod_child, d, exp, index, for_ost);
- if (rc != 0)
+ if (rc != 0) {
CERROR("Fail to add LFSCK target: name = %s, type = %s, "
"index = %u, rc = %d\n", osp, type, index, rc);
-
+ GOTO(out_fini_llog, rc);
+ }
RETURN(rc);
+out_fini_llog:
+ lod_sub_fini_llog(env, tgt_desc->ltd_tgt,
+ tgt_desc->ltd_recovery_thread);
+out_ltd:
+ lod_getref(ltd);
+ mutex_lock(<d->ltd_mutex);
+ lock = true;
+ if (!for_ost && LTD_TGT(ltd, index)->ltd_recovery_thread != NULL) {
+ struct ptlrpc_thread *thread;
+ thread = LTD_TGT(ltd, index)->ltd_recovery_thread;
+ OBD_FREE_PTR(thread);
+ }
+ ltd->ltd_tgtnr--;
+ cfs_bitmap_clear(ltd->ltd_tgt_bitmap, index);
+ LTD_TGT(ltd, index) = NULL;
out_pool:
lod_ost_pool_remove(&lod->lod_pool_info, index);
out_mutex:
- mutex_unlock(<d->ltd_mutex);
- lod_putref(lod, ltd);
+ if (lock) {
+ mutex_unlock(<d->ltd_mutex);
+ lod_putref(lod, ltd);
+ }
out_desc:
OBD_FREE_PTR(tgt_desc);
out_conn:
lfsck_del_target(env, lod->lod_child, LTD_TGT(ltd, idx)->ltd_tgt,
idx, for_ost);
+ if (!for_ost && LTD_TGT(ltd, idx)->ltd_recovery_thread != NULL) {
+ struct ptlrpc_thread *thread;
+
+ thread = LTD_TGT(ltd, idx)->ltd_recovery_thread;
+ OBD_FREE_PTR(thread);
+ }
+
if (LTD_TGT(ltd, idx)->ltd_reap == 0) {
LTD_TGT(ltd, idx)->ltd_reap = 1;
ltd->ltd_death_row++;
info->lti_buf.lb_buf = lmm;
info->lti_buf.lb_len = lmm_size;
- rc = dt_xattr_set(env, next, &info->lti_buf, XATTR_NAME_LOV, 0,
- th, BYPASS_CAPA);
- if (rc < 0)
+ rc = lod_sub_object_xattr_set(env, next, &info->lti_buf, XATTR_NAME_LOV,
+ 0, th);
+ if (rc < 0) {
lod_object_free_striping(env, lo);
+ RETURN(rc);
+ }
RETURN(rc);
}
repeat:
info->lti_buf.lb_buf = info->lti_ea_store;
info->lti_buf.lb_len = info->lti_ea_store_size;
- rc = dt_xattr_get(env, next, &info->lti_buf, name, BYPASS_CAPA);
+ rc = dt_xattr_get(env, next, &info->lti_buf, name);
}
/* if object is not striped or inaccessible */
if (rc == -ERANGE) {
/* EA doesn't fit, reallocate new buffer */
- rc = dt_xattr_get(env, next, &LU_BUF_NULL, name,
- BYPASS_CAPA);
+ rc = dt_xattr_get(env, next, &LU_BUF_NULL, name);
if (rc == -ENODATA || rc == -ENOENT)
RETURN(0);
else if (rc < 0)
}
/**
- * Store default striping.
- *
- * Store default striping for the files in the given directory. The data
- * are stored in the LOD-object representing the directory (ldo_def_* fields).
- * If default striping matches virtual fs-wide default striping, then we
- * store nothing. This mean that the files in the directory will be created
- * with filesystem-wide default striping. The transaction must be started.
- *
- * \param[in] env execution environment for this thread
- * \param[in] dt dt object representing directory in LOD layer
- * \param[in] th transaction handle
- *
- * \retval 0 if stored successfully or no need to store
- * \retval negative error number on failure
- */
-int lod_store_def_striping(const struct lu_env *env, struct dt_object *dt,
- struct thandle *th)
-{
- struct lod_thread_info *info = lod_env_info(env);
- struct lod_object *lo = lod_dt_obj(dt);
- struct dt_object *next = dt_object_child(dt);
- struct lov_user_md_v3 *v3;
- int rc;
- ENTRY;
-
- if (S_ISDIR(dt->do_lu.lo_header->loh_attr))
- RETURN(-ENOTDIR);
- /*
- * store striping defaults into new directory
- * used to implement defaults inheritance
- */
-
- /* probably nothing to inherite */
- if (lo->ldo_striping_cached == 0)
- RETURN(0);
-
- if (LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size, lo->ldo_def_stripenr,
- lo->ldo_def_stripe_offset))
- RETURN(0);
-
- v3 = info->lti_ea_store;
- if (info->lti_ea_store_size < sizeof(*v3)) {
- rc = lod_ea_store_resize(info, sizeof(*v3));
- if (rc != 0)
- RETURN(rc);
- v3 = info->lti_ea_store;
- }
- memset(v3, 0, sizeof(*v3));
- v3->lmm_magic = cpu_to_le32(LOV_USER_MAGIC_V3);
- v3->lmm_stripe_count = cpu_to_le16(lo->ldo_def_stripenr);
- v3->lmm_stripe_offset = cpu_to_le16(lo->ldo_def_stripe_offset);
- v3->lmm_stripe_size = cpu_to_le32(lo->ldo_def_stripe_size);
- if (lo->ldo_pool != NULL) {
- strlcpy(v3->lmm_pool_name, lo->ldo_pool,
- sizeof(v3->lmm_pool_name));
- v3->lmm_pool_name[sizeof(v3->lmm_pool_name) - 1] = '\0';
- }
- info->lti_buf.lb_buf = v3;
- info->lti_buf.lb_len = sizeof(*v3);
- rc = dt_xattr_set(env, next, &info->lti_buf, XATTR_NAME_LOV, 0, th,
- BYPASS_CAPA);
-
- RETURN(rc);
-}
-
-/**
* Verify the target index is present in the current configuration.
*
* \param[in] md LOD device where the target table is stored
*/
rc = lod_parse_dir_striping(env, lo, buf);
}
+
+ if (rc == 0)
+ lo->ldo_striping_cached = 1;
out:
RETURN(rc);
}
rc = lod_ost_pool_init(&lod->lod_pool_info, 0);
if (rc)
GOTO(out_hash, rc);
+ lod_qos_rr_init(&lod->lod_qos.lq_rr);
rc = lod_ost_pool_init(&lod->lod_qos.lq_rr.lqr_pool, 0);
if (rc)
GOTO(out_pool_info, rc);