X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmds%2Fmds_lib.c;h=bc0fb6f73fbd905e7bbb0943f3cb0896cc950c23;hb=02be224ce61aa34c95d5c6323027de99d4485e6b;hp=a71bc9970eeb9035ee3dd5b2990171364c501a89;hpb=2c7bcb60531e597ecbbe92636930f6d9b28815cd;p=fs%2Flustre-release.git diff --git a/lustre/mds/mds_lib.c b/lustre/mds/mds_lib.c index a71bc99..bc0fb6f 100644 --- a/lustre/mds/mds_lib.c +++ b/lustre/mds/mds_lib.c @@ -52,6 +52,7 @@ #include #include #include + #include "mds_internal.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) @@ -245,7 +246,7 @@ int mds_pack_gskey(struct obd_device *obd, struct lustre_msg *repmsg, void *buf; int size, rc = 0; ENTRY; - + sizep = lustre_msg_buf(repmsg, (*offset)++, 4); if (!sizep) { CERROR("can't locate returned ckey size buf\n"); @@ -254,12 +255,14 @@ int mds_pack_gskey(struct obd_device *obd, struct lustre_msg *repmsg, *sizep = cpu_to_le32(sizeof(*ckey)); OBD_ALLOC(md_key, sizeof(*md_key)); + if (!md_key) + RETURN(-ENOMEM); buflen = repmsg->buflens[*offset]; buf = lustre_msg_buf(repmsg, (*offset)++, buflen); size = fsfilt_get_md(obd, inode, md_key, sizeof(*md_key), - EA_KEY); + EA_KEY); if (size <= 0) { if (size < 0) CERROR("Can not get gskey from MDS ino %lu rc %d\n", @@ -307,9 +310,8 @@ int mds_set_gskey(struct obd_device *obd, void *handle, LASSERT(ckey->ck_type == MKS_TYPE || ckey->ck_type == GKS_TYPE); OBD_ALLOC(md_key, sizeof(*md_key)); - if (ckey->ck_type == MKS_TYPE) { + if (ckey->ck_type == MKS_TYPE) mds_get_gskey(inode, ckey); - } rc = fsfilt_get_md(obd, inode, md_key, sizeof(*md_key), EA_KEY); @@ -604,6 +606,7 @@ static int mds_open_unpack(struct ptlrpc_request *req, int offset, r->ur_rdev = rec->cr_rdev; r->ur_time = rec->cr_time; r->ur_flags = rec->cr_flags; + r->ur_ioepoch = rec->cr_ioepoch; LASSERT_REQSWAB(req, offset + 1); r->ur_name = lustre_msg_string(req->rq_reqmsg, offset + 1, 0); @@ -1051,6 +1054,34 @@ void mds_body_do_reverse_map(struct mds_export_data *med, EXIT; } +/* + * return error if can't find mapping, it's a error so should not + * fall into nllu/nllg. + */ +int mds_remote_perm_do_reverse_map(struct mds_export_data *med, + struct mds_remote_perm *perm) +{ + uid_t uid; + gid_t gid; + + LASSERT(med->med_remote); + + uid = mds_idmap_lookup_uid(med->med_idmap, 1, perm->mrp_auth_uid); + if (uid == MDS_IDMAP_NOTFOUND) { + CERROR("no map for uid %u\n", perm->mrp_auth_uid); + return -EPERM; + } + gid = mds_idmap_lookup_gid(med->med_idmap, 1, perm->mrp_auth_gid); + if (gid == MDS_IDMAP_NOTFOUND) { + CERROR("no map for uid %u\n", perm->mrp_auth_uid); + return -EPERM; + } + + perm->mrp_auth_uid = uid; + perm->mrp_auth_gid = gid; + return 0; +} + /********************** * MDS ucred handling * **********************/ @@ -1280,3 +1311,4 @@ void mds_exit_ucred(struct lvfs_ucred *ucred) drop_ucred_lsd(ucred); EXIT; } +