#include <linux/lustre_ucache.h>
#include <linux/lustre_gs.h>
#include <linux/lustre_fsfilt.h>
+
#include "mds_internal.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4)
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");
*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",
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);
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);
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 *
**********************/
drop_ucred_lsd(ucred);
EXIT;
}
+