static int mdt_root_squash(struct mdt_thread_info *info, lnet_nid_t peernid)
{
struct lu_ucred *ucred = mdt_ucred(info);
+ struct root_squash_info *squash = &info->mti_mdt->mdt_squash;
ENTRY;
LASSERT(ucred != NULL);
- if (!info->mti_mdt->mdt_squash_uid || ucred->uc_fsuid)
+ if (!squash->rsi_uid || ucred->uc_fsuid)
RETURN(0);
- if (match_nosquash_list(&info->mti_mdt->mdt_squash_sem,
- &info->mti_mdt->mdt_nosquash_nids,
- peernid)) {
- CDEBUG(D_OTHER, "%s is in nosquash_nids list\n",
- libcfs_nid2str(peernid));
- RETURN(0);
- }
+ if (match_nosquash_list(&squash->rsi_sem,
+ &squash->rsi_nosquash_nids,
+ peernid)) {
+ CDEBUG(D_OTHER, "%s is in nosquash_nids list\n",
+ libcfs_nid2str(peernid));
+ RETURN(0);
+ }
CDEBUG(D_OTHER, "squash req from %s, (%d:%d/%x)=>(%d:%d/%x)\n",
libcfs_nid2str(peernid),
ucred->uc_fsuid, ucred->uc_fsgid, ucred->uc_cap,
- info->mti_mdt->mdt_squash_uid, info->mti_mdt->mdt_squash_gid,
- 0);
+ squash->rsi_uid, squash->rsi_gid, 0);
- ucred->uc_fsuid = info->mti_mdt->mdt_squash_uid;
- ucred->uc_fsgid = info->mti_mdt->mdt_squash_gid;
+ ucred->uc_fsuid = squash->rsi_uid;
+ ucred->uc_fsgid = squash->rsi_gid;
ucred->uc_cap = 0;
ucred->uc_suppgids[0] = -1;
ucred->uc_suppgids[1] = -1;
ucred->uc_suppgids[1] = -1;
}
- /* sanity check: we expect the uid which client claimed is true */
- if (remote) {
- if (req->rq_auth_mapped_uid == INVALID_UID) {
- CDEBUG(D_SEC, "remote user not mapped, deny access!\n");
- RETURN(-EACCES);
- }
+ /* sanity check: we expect the uid which client claimed is true */
+ if (remote) {
+ if (!uid_valid(make_kuid(&init_user_ns, req->rq_auth_mapped_uid))) {
+ CDEBUG(D_SEC, "remote user not mapped, deny access!\n");
+ CDEBUG(D_SEC, "remote user not mapped, deny access!\n");
+ RETURN(-EACCES);
+ }
- if (ptlrpc_user_desc_do_idmap(req, pud))
- RETURN(-EACCES);
+ if (ptlrpc_user_desc_do_idmap(req, pud))
+ RETURN(-EACCES);
if (req->rq_auth_mapped_uid != pud->pud_uid) {
CDEBUG(D_SEC, "remote client %s: auth/mapped uid %u/%u "
/* sanity check: if we use strong authentication, we expect the
* uid which client claimed is true */
if (remote) {
- if (req->rq_auth_mapped_uid == INVALID_UID) {
+ if (!uid_valid(make_kuid(&init_user_ns, req->rq_auth_mapped_uid))) {
CDEBUG(D_SEC, "remote user not mapped, deny access!\n");
RETURN(-EACCES);
}
}
/* copied from lov/lov_ea.c, just for debugging, will be removed later */
-void mdt_dump_lmm(int level, const struct lov_mds_md *lmm)
+void mdt_dump_lmm(int level, const struct lov_mds_md *lmm, __u64 valid)
{
- const struct lov_ost_data_v1 *lod;
- int i;
- __u16 count;
+ const struct lov_ost_data_v1 *lod;
+ int i;
+ __u16 count;
+
+ if (likely(!cfs_cdebug_show(level, DEBUG_SUBSYSTEM)))
+ return;
- count = le16_to_cpu(((struct lov_user_md*)lmm)->lmm_stripe_count);
+ count = le16_to_cpu(((struct lov_user_md *)lmm)->lmm_stripe_count);
CDEBUG(level, "objid "DOSTID", magic 0x%08X, pattern %#X\n",
POSTID(&lmm->lmm_oi), le32_to_cpu(lmm->lmm_magic),
le32_to_cpu(lmm->lmm_pattern));
- CDEBUG(level,"stripe_size=0x%x, stripe_count=0x%x\n",
- le32_to_cpu(lmm->lmm_stripe_size), count);
- if (count == LOV_ALL_STRIPES ||
+ CDEBUG(level, "stripe_size=0x%x, stripe_count=0x%x\n",
+ le32_to_cpu(lmm->lmm_stripe_size), count);
+
+ /* If it's a directory or a released file, then there are
+ * no actual objects to print, so bail out. */
+ if (valid & OBD_MD_FLDIREA ||
le32_to_cpu(lmm->lmm_pattern) & LOV_PATTERN_F_RELEASED)
- return;
+ return;
LASSERT(count <= LOV_MAX_STRIPE_COUNT);
for (i = 0, lod = lmm->lmm_objects; i < count; i++, lod++) {
- struct ost_id oi;
+ struct ost_id oi;
+
ostid_le_to_cpu(&lod->l_ost_oi, &oi);
CDEBUG(level, "stripe %u idx %u subobj "DOSTID"\n",
i, le32_to_cpu(lod->l_ost_idx), POSTID(&oi));
const struct lmv_mds_md_v1 *lmm1;
int i;
+ if (likely(!cfs_cdebug_show(level, DEBUG_SUBSYSTEM)))
+ return;
+
lmm1 = &lmv->lmv_md_v1;
CDEBUG(level, "magic 0x%08X, master %#X stripe_count %#x\n",
le32_to_cpu(lmm1->lmv_magic),
le32_to_cpu(lmm1->lmv_master_mdt_index),
le32_to_cpu(lmm1->lmv_stripe_count));
+
+ if (le32_to_cpu(lmm1->lmv_magic) == LMV_MAGIC_STRIPE)
+ return;
+
for (i = 0; i < le32_to_cpu(lmm1->lmv_stripe_count); i++) {
struct lu_fid fid;
/* MDT_MD buffer may be bigger than packed value, let's shrink all
* buffers before growing it */
if (info->mti_big_lmm_used) {
- LASSERT(req_capsule_has_field(pill, &RMF_MDT_MD, RCL_SERVER));
- md_packed = req_capsule_get_size(pill, &RMF_MDT_MD,
- RCL_SERVER);
- LASSERT(md_packed > 0);
- /* buffer must be allocated separately */
- LASSERT(info->mti_attr.ma_lmm !=
- req_capsule_server_get(pill, &RMF_MDT_MD));
- req_capsule_shrink(pill, &RMF_MDT_MD, 0, RCL_SERVER);
- /* free big lmm if md_size is not needed */
- if (md_size == 0)
+ /* big_lmm buffer may be used even without packing the result
+ * into reply, just for internal server needs */
+ if (req_capsule_has_field(pill, &RMF_MDT_MD, RCL_SERVER))
+ md_packed = req_capsule_get_size(pill, &RMF_MDT_MD,
+ RCL_SERVER);
+
+ /* free big lmm if md_size is not needed */
+ if (md_size == 0 || md_packed == 0) {
info->mti_big_lmm_used = 0;
+ } else {
+ /* buffer must be allocated separately */
+ LASSERT(info->mti_attr.ma_lmm !=
+ req_capsule_server_get(pill, &RMF_MDT_MD));
+ req_capsule_shrink(pill, &RMF_MDT_MD, 0, RCL_SERVER);
+ }
} else if (req_capsule_has_field(pill, &RMF_MDT_MD, RCL_SERVER)) {
req_capsule_shrink(pill, &RMF_MDT_MD, md_size, RCL_SERVER);
}
}
repbody->eadatasize = 0;
- if (ma->ma_cookie_size && (ma->ma_valid & MA_COOKIE)) {
- repbody->aclsize = ma->ma_cookie_size;
- repbody->valid |= OBD_MD_FLCOOKIE;
- }
-
if (info->mti_mdt->mdt_lut.lut_oss_capa &&
exp_connect_flags(info->mti_exp) & OBD_CONNECT_OSS_CAPA &&
repbody->valid & OBD_MD_FLEASIZE) {