struct lu_name *lname = NULL;
struct mdt_lock_handle *lhp = NULL;
struct ldlm_lock *lock;
+ struct req_capsule *pill = info->mti_pill;
__u64 try_bits = 0;
bool is_resent;
int ma_need = 0;
+ bool deal_with_dom = false;
int rc;
ENTRY;
if (unlikely(rc != 0))
mdt_object_unlock(info, child, lhc, 1);
- RETURN(rc);
- }
+ mdt_pack_secctx_in_reply(info, child);
+
+ RETURN(rc);
+ }
lname = &info->mti_name;
- mdt_name_unpack(info->mti_pill, &RMF_NAME, lname, MNF_FIX_ANON);
+ mdt_name_unpack(pill, &RMF_NAME, lname, MNF_FIX_ANON);
if (lu_name_is_valid(lname)) {
CDEBUG(D_INODE, "getattr with lock for "DFID"/"DNAME", "
"ldlm_rep = %p\n", PFID(mdt_object_fid(parent)),
PNAME(lname), ldlm_rep);
} else {
- reqbody = req_capsule_client_get(info->mti_pill, &RMF_MDT_BODY);
+ reqbody = req_capsule_client_get(pill, &RMF_MDT_BODY);
if (unlikely(reqbody == NULL))
RETURN(err_serious(-EPROTO));
child_bits &= ~MDS_INODELOCK_UPDATE;
rc = mdt_object_lock(info, child, lhc, child_bits);
}
- if (unlikely(rc != 0))
- GOTO(out_child, rc);
- }
+ if (unlikely(rc != 0))
+ GOTO(out_child, rc);
+ }
- lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
+ lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
- /* finally, we can get attr for child. */
- rc = mdt_getattr_internal(info, child, ma_need);
- if (unlikely(rc != 0)) {
- mdt_object_unlock(info, child, lhc, 1);
+ /* finally, we can get attr for child. */
+ rc = mdt_getattr_internal(info, child, ma_need);
+ if (unlikely(rc != 0)) {
+ mdt_object_unlock(info, child, lhc, 1);
+ GOTO(out_lock, rc);
} else if (lock) {
/* Debugging code. */
LDLM_DEBUG(lock, "Returning lock to client");
if (S_ISREG(lu_object_attr(&child->mot_obj)) &&
mdt_object_exists(child) && !mdt_object_remote(child) &&
- child != parent) {
- LDLM_LOCK_PUT(lock);
- mdt_object_put(info->mti_env, child);
- /* NB: call the mdt_pack_size2body always after
- * mdt_object_put(), that is why this special
- * exit path is used. */
- rc = mdt_pack_size2body(info, child_fid,
- &lhc->mlh_reg_lh);
- if (rc != 0 && child_bits & MDS_INODELOCK_DOM) {
- /* DOM lock was taken in advance but this is
- * not DoM file. Drop the lock. */
- lock_res_and_lock(lock);
- ldlm_inodebits_drop(lock, MDS_INODELOCK_DOM);
- unlock_res_and_lock(lock);
- }
-
- GOTO(out_parent, rc = 0);
- }
+ child != parent)
+ deal_with_dom = true;
}
+
+ mdt_pack_secctx_in_reply(info, child);
+
+out_lock:
if (lock)
LDLM_LOCK_PUT(lock);
EXIT;
out_child:
mdt_object_put(info->mti_env, child);
+ if (deal_with_dom) {
+ rc = mdt_pack_size2body(info, child_fid,
+ &lhc->mlh_reg_lh);
+ if (rc != 0 && child_bits & MDS_INODELOCK_DOM) {
+ /* DOM lock was taken in advance but this is
+ * not DoM file. Drop the lock.
+ */
+ lock_res_and_lock(lock);
+ ldlm_inodebits_drop(lock, MDS_INODELOCK_DOM);
+ unlock_res_and_lock(lock);
+ }
+ rc = 0;
+ }
out_parent:
if (lhp)
mdt_object_unlock(info, parent, lhp, 1);
!(info->mti_spec.sp_cr_flags & (MDS_FMODE_WRITE | MDS_OPEN_CREAT));
}
+static void mdt_preset_secctx_size(struct mdt_thread_info *info)
+{
+ struct req_capsule *pill = info->mti_pill;
+
+ if (req_capsule_has_field(pill, &RMF_FILE_SECCTX,
+ RCL_SERVER) &&
+ req_capsule_has_field(pill, &RMF_FILE_SECCTX_NAME,
+ RCL_CLIENT)) {
+ if (req_capsule_get_size(pill, &RMF_FILE_SECCTX_NAME,
+ RCL_CLIENT) != 0) {
+ /* pre-set size in server part with max size */
+ req_capsule_set_size(pill, &RMF_FILE_SECCTX,
+ RCL_SERVER,
+ info->mti_mdt->mdt_max_ea_size);
+ } else {
+ req_capsule_set_size(pill, &RMF_FILE_SECCTX,
+ RCL_SERVER, 0);
+ }
+ }
+
+}
+
static int mdt_reint_internal(struct mdt_thread_info *info,
struct mdt_lock_handle *lhc,
__u32 op)
DEF_REP_MD_SIZE);
/* llog cookies are always 0, the field is kept for compatibility */
- if (req_capsule_has_field(pill, &RMF_LOGCOOKIES, RCL_SERVER))
+ if (req_capsule_has_field(pill, &RMF_LOGCOOKIES, RCL_SERVER))
req_capsule_set_size(pill, &RMF_LOGCOOKIES, RCL_SERVER, 0);
/* Set ACL reply buffer size as LUSTRE_POSIX_ACL_MAX_SIZE_OLD
req_capsule_set_size(pill, &RMF_ACL, RCL_SERVER,
LUSTRE_POSIX_ACL_MAX_SIZE_OLD);
- rc = req_capsule_server_pack(pill);
- if (rc != 0) {
- CERROR("Can't pack response, rc %d\n", rc);
- RETURN(err_serious(rc));
- }
+ mdt_preset_secctx_size(info);
- if (req_capsule_has_field(pill, &RMF_MDT_BODY, RCL_SERVER)) {
- repbody = req_capsule_server_get(pill, &RMF_MDT_BODY);
- LASSERT(repbody);
+ rc = req_capsule_server_pack(pill);
+ if (rc != 0) {
+ CERROR("Can't pack response, rc %d\n", rc);
+ RETURN(err_serious(rc));
+ }
+
+ if (req_capsule_has_field(pill, &RMF_MDT_BODY, RCL_SERVER)) {
+ repbody = req_capsule_server_get(pill, &RMF_MDT_BODY);
+ LASSERT(repbody);
repbody->mbo_eadatasize = 0;
repbody->mbo_aclsize = 0;
- }
+ }
- OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_REINT_DELAY, 10);
+ OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_REINT_DELAY, 10);
- /* for replay no cookkie / lmm need, because client have this already */
- if (info->mti_spec.no_create)
- if (req_capsule_has_field(pill, &RMF_MDT_MD, RCL_SERVER))
- req_capsule_set_size(pill, &RMF_MDT_MD, RCL_SERVER, 0);
+ /* for replay no cookkie / lmm need, because client have this already */
+ if (info->mti_spec.no_create)
+ if (req_capsule_has_field(pill, &RMF_MDT_MD, RCL_SERVER))
+ req_capsule_set_size(pill, &RMF_MDT_MD, RCL_SERVER, 0);
- rc = mdt_init_ucred_reint(info);
- if (rc)
- GOTO(out_shrink, rc);
+ rc = mdt_init_ucred_reint(info);
+ if (rc)
+ GOTO(out_shrink, rc);
- rc = mdt_fix_attr_ucred(info, op);
- if (rc != 0)
- GOTO(out_ucred, rc = err_serious(rc));
+ rc = mdt_fix_attr_ucred(info, op);
+ if (rc != 0)
+ GOTO(out_ucred, rc = err_serious(rc));
rc = mdt_check_resent(info, mdt_reconstruct, lhc);
if (rc < 0) {
} else if (rc == 1) {
DEBUG_REQ(D_INODE, mdt_info_req(info), "resent opt.");
rc = lustre_msg_get_status(mdt_info_req(info)->rq_repmsg);
- GOTO(out_ucred, rc);
- }
- rc = mdt_reint_rec(info, lhc);
- EXIT;
+ GOTO(out_ucred, rc);
+ }
+ rc = mdt_reint_rec(info, lhc);
+ EXIT;
out_ucred:
- mdt_exit_ucred(info);
+ mdt_exit_ucred(info);
out_shrink:
mdt_client_compatibility(info);
req_capsule_set_size(pill, &RMF_ACL, RCL_SERVER,
LUSTRE_POSIX_ACL_MAX_SIZE_OLD);
+ mdt_preset_secctx_size(info);
+
rc = req_capsule_server_pack(pill);
+ if (rc)
+ CWARN("%s: cannot pack response: rc = %d\n",
+ mdt_obd_name(info->mti_mdt), rc);
}
RETURN(rc);
}
if (ldlm_rep == NULL ||
OBD_FAIL_CHECK(OBD_FAIL_MDS_XATTR_REP)) {
mdt_object_unlock(info, info->mti_object, lhc, 1);
- RETURN(err_serious(-EFAULT));
+ if (is_serious(rc))
+ RETURN(rc);
+ else
+ RETURN(err_serious(-EFAULT));
}
ldlm_rep->lock_policy_res2 = clear_serious(rc);
rc = mdt_reint_internal(info, lhc, opc);
- /* Check whether the reply has been packed successfully. */
- if (mdt_info_req(info)->rq_repmsg != NULL)
- rep = req_capsule_server_get(info->mti_pill, &RMF_DLM_REP);
- if (rep == NULL)
- RETURN(err_serious(-EFAULT));
+ /* Check whether the reply has been packed successfully. */
+ if (mdt_info_req(info)->rq_repmsg != NULL)
+ rep = req_capsule_server_get(info->mti_pill, &RMF_DLM_REP);
+ if (rep == NULL) {
+ if (is_serious(rc))
+ RETURN(rc);
+ else
+ RETURN(err_serious(-EFAULT));
+ }
/* MDC expects this in any case */
if (rc != 0)
m->mdt_enable_striped_dir = 1;
m->mdt_enable_dir_migration = 1;
m->mdt_enable_remote_dir_gid = 0;
+ m->mdt_enable_remote_rename = 1;
atomic_set(&m->mdt_mds_mds_conns, 0);
atomic_set(&m->mdt_async_commit_count, 0);