__u64 try_bits = 0;
bool is_resent;
int ma_need = 0;
- bool deal_with_dom = false;
int rc;
ENTRY;
GOTO(out_child, rc);
}
- 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);
- GOTO(out_lock, rc);
- } else if (lock) {
+ GOTO(out_child, rc);
+ }
+
+ mdt_pack_secctx_in_reply(info, child);
+
+ lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
+ if (lock) {
/* Debugging code. */
LDLM_DEBUG(lock, "Returning lock to client");
LASSERTF(fid_res_name_eq(mdt_object_fid(child),
if (S_ISREG(lu_object_attr(&child->mot_obj)) &&
mdt_object_exists(child) && !mdt_object_remote(child) &&
- child != parent)
- deal_with_dom = true;
- }
-
- mdt_pack_secctx_in_reply(info, child);
-
-out_lock:
- if (lock)
+ child != parent) {
+ mdt_object_put(info->mti_env, child);
+ 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);
+ }
+ LDLM_LOCK_PUT(lock);
+ GOTO(out_parent, rc = 0);
+ }
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);
req_capsule_shrink(pill, &RMF_LOGCOOKIES, acl_size, RCL_SERVER);
}
+ /* Shrink optional SECCTX buffer if it is not used */
+ if (req_capsule_has_field(pill, &RMF_FILE_SECCTX, RCL_SERVER) &&
+ req_capsule_get_size(pill, &RMF_FILE_SECCTX, RCL_SERVER) != 0 &&
+ !(body->mbo_valid & OBD_MD_SECCTX))
+ req_capsule_shrink(pill, &RMF_FILE_SECCTX, 0, RCL_SERVER);
+
/*
* Some more field should be shrinked if needed.
* This should be done by those who added fields to reply message.