- namelen = req_capsule_get_size(info->mti_pill, &RMF_NAME,
- RCL_CLIENT) - 1;
- if (!info->mti_cross_ref) {
- /*
- * XXX: Check for "namelen == 0" is for getattr by fid
- * (OBD_CONNECT_ATTRFID), otherwise do not allow empty name,
- * that is the name must contain at least one character and
- * the terminating '\0'
- */
- if (namelen == 0) {
- reqbody = req_capsule_client_get(info->mti_pill,
- &RMF_MDT_BODY);
- if (unlikely(reqbody == NULL))
- RETURN(err_serious(-EFAULT));
-
- if (unlikely(!fid_is_sane(&reqbody->fid2)))
- RETURN(err_serious(-EINVAL));
-
- name = NULL;
- CDEBUG(D_INODE, "getattr with lock for "DFID"/"DFID", "
- "ldlm_rep = %p\n",
- PFID(mdt_object_fid(parent)),
- PFID(&reqbody->fid2), ldlm_rep);
- } else {
- lname = mdt_name(info->mti_env, (char *)name, namelen);
- CDEBUG(D_INODE, "getattr with lock for "DFID"/%s, "
- "ldlm_rep = %p\n", PFID(mdt_object_fid(parent)),
- name, ldlm_rep);
- }
- }
+ lname = &info->mti_name;
+ mdt_name_unpack(info->mti_pill, &RMF_NAME, lname, MNF_FIX_ANON);
+
+ if (!info->mti_cross_ref) {
+ /*
+ * XXX: Check for anonymous name is for getattr by fid
+ * (OBD_CONNECT_ATTRFID), otherwise do not allow empty name,
+ * that is the name must contain at least one character and
+ * the terminating '\0'.
+ */
+ if (!lu_name_is_valid(lname)) {
+ reqbody = req_capsule_client_get(info->mti_pill,
+ &RMF_MDT_BODY);
+ if (unlikely(reqbody == NULL))
+ RETURN(err_serious(-EFAULT));
+
+ if (unlikely(!fid_is_sane(&reqbody->fid2)))
+ RETURN(err_serious(-EINVAL));
+
+ CDEBUG(D_INODE, "getattr with lock for "DFID"/"DFID", "
+ "ldlm_rep = %p\n",
+ PFID(mdt_object_fid(parent)),
+ PFID(&reqbody->fid2), ldlm_rep);
+ } else {
+ CDEBUG(D_INODE, "getattr with lock for "DFID"/"DNAME", "
+ "ldlm_rep = %p\n", PFID(mdt_object_fid(parent)),
+ PNAME(lname), ldlm_rep);
+ }
+ }
+