EXIT;
}
+/**
+ * Check whether \a o is directory stripe object.
+ *
+ * \param[in] info thread environment
+ * \param[in] o MDT object
+ *
+ * \retval 1 is directory stripe.
+ * \retval 0 isn't directory stripe.
+ * \retval < 1 error code
+ */
+static int mdt_is_dir_stripe(struct mdt_thread_info *info,
+ struct mdt_object *o)
+{
+ struct md_attr *ma = &info->mti_attr;
+ struct lmv_mds_md_v1 *lmv;
+ int rc;
+
+ rc = mdt_stripe_get(info, o, ma, XATTR_NAME_LMV);
+ if (rc < 0)
+ return rc;
+
+ if (!(ma->ma_valid & MA_LMV))
+ return 0;
+
+ lmv = &ma->ma_lmv->lmv_md_v1;
+
+ if (!lmv_is_sane2(lmv))
+ return -EBADF;
+
+ if (le32_to_cpu(lmv->lmv_magic) == LMV_MAGIC_STRIPE)
+ return 1;
+
+ return 0;
+}
+
static int mdt_lookup_fileset(struct mdt_thread_info *info, const char *fileset,
struct lu_fid *fid)
{
if (mdt_body_has_lov(la, reqbody)) {
u32 stripe_count = 1;
+ bool fixed_layout = false;
if (ma->ma_valid & MA_LOV) {
LASSERT(ma->ma_lmm_size);
repbody->mbo_valid |= (OBD_MD_FLDIREA|OBD_MD_MEA);
stripe_count = le32_to_cpu(lmv->lmv_stripe_count);
+ fixed_layout = lmv_is_fixed(lmv);
if (magic == LMV_MAGIC_STRIPE && lmv_is_restriping(lmv))
mdt_restripe_migrate_add(info, o);
else if (magic == LMV_MAGIC_V1 &&
!fid_is_root(mdt_object_fid(o)) &&
mdt->mdt_enable_dir_auto_split &&
!o->mot_restriping &&
- stripe_count < atomic_read(&mdt->mdt_mds_mds_conns) + 1)
+ stripe_count < atomic_read(&mdt->mdt_mds_mds_conns) + 1 &&
+ !fixed_layout)
mdt_auto_split_add(info, o);
} else if (S_ISLNK(la->la_mode) &&
reqbody->mbo_valid & OBD_MD_LINKNAME) {
static int mdt_raw_lookup(struct mdt_thread_info *info,
struct mdt_object *parent,
- const struct lu_name *lname,
- struct ldlm_reply *ldlm_rep)
+ const struct lu_name *lname)
{
- struct lu_fid *child_fid = &info->mti_tmp_fid1;
- int rc;
+ struct lu_fid *fid = &info->mti_tmp_fid1;
+ struct mdt_body *repbody;
+ bool is_dotdot = false;
+ bool is_old_parent_stripe = false;
+ bool is_new_parent_checked = false;
+ int rc;
+
ENTRY;
LASSERT(!info->mti_cross_ref);
+ /* Always allow to lookup ".." */
+ if (lname->ln_namelen == 2 &&
+ lname->ln_name[0] == '.' && lname->ln_name[1] == '.') {
+ info->mti_spec.sp_permitted = 1;
+ is_dotdot = true;
+ if (mdt_is_dir_stripe(info, parent) == 1)
+ is_old_parent_stripe = true;
+ }
+ mdt_object_get(info->mti_env, parent);
+lookup:
/* Only got the fid of this obj by name */
- fid_zero(child_fid);
- rc = mdo_lookup(info->mti_env, mdt_object_child(info->mti_object),
- lname, child_fid, &info->mti_spec);
- if (rc == 0) {
- struct mdt_body *repbody;
+ fid_zero(fid);
+ rc = mdo_lookup(info->mti_env, mdt_object_child(parent), lname, fid,
+ &info->mti_spec);
+ mdt_object_put(info->mti_env, parent);
+ if (rc)
+ RETURN(rc);
+
+ /* getattr_name("..") should return master object FID for striped dir */
+ if (is_dotdot && (is_old_parent_stripe || !is_new_parent_checked)) {
+ parent = mdt_object_find(info->mti_env, info->mti_mdt, fid);
+ if (IS_ERR(parent))
+ RETURN(PTR_ERR(parent));
+
+ /* old client getattr_name("..") with stripe FID */
+ if (unlikely(is_old_parent_stripe)) {
+ is_old_parent_stripe = false;
+ goto lookup;
+ }
+
+ /* ".." may be a stripe */
+ if (unlikely(mdt_is_dir_stripe(info, parent) == 1)) {
+ is_new_parent_checked = true;
+ goto lookup;
+ }
- repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
- repbody->mbo_fid1 = *child_fid;
- repbody->mbo_valid = OBD_MD_FLID;
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS);
- } else if (rc == -ENOENT) {
- mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_NEG);
+ mdt_object_put(info->mti_env, parent);
}
+ repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
+ repbody->mbo_fid1 = *fid;
+ repbody->mbo_valid = OBD_MD_FLID;
+
RETURN(rc);
}
}
if (lu_name_is_valid(lname)) {
- /* Always allow to lookup ".." */
- if (unlikely(lname->ln_namelen == 2 &&
- lname->ln_name[0] == '.' &&
- lname->ln_name[1] == '.'))
- info->mti_spec.sp_permitted = 1;
-
if (info->mti_body->mbo_valid == OBD_MD_FLID) {
- rc = mdt_raw_lookup(info, parent, lname, ldlm_rep);
+ rc = mdt_raw_lookup(info, parent, lname);
RETURN(rc);
}
if (la->la_flags & LUSTRE_IMMUTABLE_FL)
rc = -EACCES;
- if (md_capable(uc, CAP_DAC_OVERRIDE))
+ if (cap_raised(uc->uc_cap, CAP_DAC_OVERRIDE))
RETURN(0);
if (uc->uc_fsuid == la->la_uid) {
if ((la->la_mode & S_IWUSR) == 0)
tgt_name(tsi->tsi_tgt), vallen);
RETURN(-EINVAL);
}
- if (ptlrpc_req_need_swab(req)) {
+ if (req_capsule_req_need_swab(&req->rq_pill)) {
__swab64s(&cs->cs_recno);
__swab32s(&cs->cs_id);
}
OST_PUNCH, mdt_punch_hdl,
mdt_hp_punch),
TGT_OST_HDL(HAS_BODY | HAS_REPLY, OST_SYNC, mdt_data_sync),
+TGT_OST_HDL(HAS_BODY | HAS_REPLY | IS_MUTABLE, OST_FALLOCATE,
+ mdt_fallocate_hdl),
TGT_OST_HDL(HAS_BODY | HAS_REPLY, OST_SEEK, tgt_lseek),
};
rc = mdt_ctxt_add_dirty_flag(&env, info, mfd);
/* Don't unlink orphan on failover umount, LU-184 */
- if (exp->exp_flags & OBD_OPT_FAILOVER) {
+ if (exp->exp_flags & OBD_OPT_FAILOVER ||
+ exp->exp_obd->obd_stopping) {
ma->ma_valid = MA_FLAGS;
ma->ma_attr_flags |= MDS_KEEP_ORPHAN;
}
struct lu_name *tmpname = &info->mti_name;
struct lu_fid *tmpfid = &info->mti_tmp_fid1;
struct lu_buf *buf = &info->mti_big_buf;
- struct md_attr *ma = &info->mti_attr;
struct linkea_data ldata = { NULL };
bool first = true;
struct mdt_object *mdt_obj;
}
/* Check if it is slave stripes */
- rc = mdt_stripe_get(info, mdt_obj, ma, XATTR_NAME_LMV);
+ rc = mdt_is_dir_stripe(info, mdt_obj);
mdt_object_put(info->mti_env, mdt_obj);
if (rc < 0)
GOTO(out, rc);
-
- if (ma->ma_valid & MA_LMV) {
- struct lmv_mds_md_v1 *lmv = &ma->ma_lmv->lmv_md_v1;
-
- if (!lmv_is_sane2(lmv))
- GOTO(out, rc = -EBADF);
-
- /* For slave stripes, get its master */
- if (le32_to_cpu(lmv->lmv_magic) == LMV_MAGIC_STRIPE) {
- fp->gf_fid = *tmpfid;
- continue;
- }
+ if (rc == 1) {
+ fp->gf_fid = *tmpfid;
+ continue;
}
/* Pack the name in the end of the buffer */
fpin = key + cfs_size_round(sizeof(KEY_FID2PATH));
fpout = val;
- if (ptlrpc_req_need_swab(info->mti_pill->rc_req))
+ if (req_capsule_req_need_swab(info->mti_pill))
lustre_swab_fid2path(fpin);
memcpy(fpout, fpin, sizeof(*fpin));
sizeof(struct lu_fid)) {
/* client sent its root FID, which is normally fileset FID */
root_fid = fpin->gf_u.gf_root_fid;
- if (ptlrpc_req_need_swab(info->mti_pill->rc_req))
+ if (req_capsule_req_need_swab(info->mti_pill))
lustre_swab_lu_fid(root_fid);
if (root_fid != NULL && !fid_is_sane(root_fid))
struct obd_ioctl_data *data = karg;
CERROR("%s: Aborting recovery for device\n", mdt_obd_name(mdt));
- if (data->ioc_type & OBD_FLG_ABORT_RECOV_MDT)
+ if (data->ioc_type & OBD_FLG_ABORT_RECOV_MDT) {
obd->obd_abort_recov_mdt = 1;
- else /* if (data->ioc_type & OBD_FLG_ABORT_RECOV_OST) */
+ wake_up(&obd->obd_next_transno_waitq);
+ } else { /* if (data->ioc_type & OBD_FLG_ABORT_RECOV_OST) */
/* lctl didn't set OBD_FLG_ABORT_RECOV_OST < 2.13.57 */
obd->obd_abort_recovery = 1;
-
- target_stop_recovery_thread(obd);
+ target_stop_recovery_thread(obd);
+ }
rc = 0;
break;
}