* "EA" is used for lustre internal metadata ea. so change user ea's name to
"XATTR", including ACLs.
* remove a unnecessary param from md_getattr().
* various more fixes.
15 files changed:
}
static int cobd_md_getattr(struct obd_export *exp, struct lustre_id *id,
}
static int cobd_md_getattr(struct obd_export *exp, struct lustre_id *id,
- __u64 valid, const char *ea_name, int ea_namelen,
+ __u64 valid, const char *xattr_name,
unsigned int ea_size, struct ptlrpc_request **request)
{
struct obd_device *obd = class_exp2obd(exp);
unsigned int ea_size, struct ptlrpc_request **request)
{
struct obd_device *obd = class_exp2obd(exp);
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
return -EINVAL;
}
cobd_exp = cobd_get_exp(obd);
- return md_getattr(cobd_exp, id, valid, ea_name, ea_namelen,
- ea_size, request);
+ return md_getattr(cobd_exp, id, valid, xattr_name, ea_size, request);
}
static int cobd_md_req2lustre_md(struct obd_export *mdc_exp,
}
static int cobd_md_req2lustre_md(struct obd_export *mdc_exp,
#define OBD_MD_FLUID (0x0000000000000200LL) /* user ID */
#define OBD_MD_FLGID (0x0000000000000400LL) /* group ID */
#define OBD_MD_FLFLAGS (0x0000000000000800LL) /* flags word */
#define OBD_MD_FLUID (0x0000000000000200LL) /* user ID */
#define OBD_MD_FLGID (0x0000000000000400LL) /* group ID */
#define OBD_MD_FLFLAGS (0x0000000000000800LL) /* flags word */
-#define OBD_MD_FLEA (0x0000000000001000LL) /* extended attributes */
+#define OBD_MD_FLXATTR (0x0000000000001000LL) /* user xattr */
#define OBD_MD_FLNLINK (0x0000000000002000LL) /* link count */
#define OBD_MD_FLGENER (0x0000000000004000LL) /* generation number */
#define OBD_MD_FLINLINE (0x0000000000008000LL) /* inline data */
#define OBD_MD_FLNLINK (0x0000000000002000LL) /* link count */
#define OBD_MD_FLGENER (0x0000000000004000LL) /* generation number */
#define OBD_MD_FLINLINE (0x0000000000008000LL) /* inline data */
#define OBD_MD_REINT (0x0000000040000000LL) /* reintegrate oa */
#define OBD_MD_FID (0x0000000080000000LL) /* lustre_id data */
#define OBD_MD_MEA (0x0000000100000000LL) /* shows we are interested in MEA */
#define OBD_MD_REINT (0x0000000040000000LL) /* reintegrate oa */
#define OBD_MD_FID (0x0000000080000000LL) /* lustre_id data */
#define OBD_MD_MEA (0x0000000100000000LL) /* shows we are interested in MEA */
-#define OBD_MD_FLEALIST (0x0000000200000000LL) /* list extended attributes */
-#define OBD_MD_FLACL_ACCESS (0x0000000400000000LL) /* access acl */
-#define OBD_MD_RACL (0x0000000800000000LL) /* remote acl */
+#define OBD_MD_FLXATTRLIST (0x0000000200000000LL) /* user xattr list */
+#define OBD_MD_FLACL (0x0000000400000000LL) /* acl */
+#define OBD_MD_FLRMTACL (0x0000000800000000LL) /* remote acl */
#define OBD_MD_FLNOTOBD (~(OBD_MD_FLBLOCKS | OBD_MD_LINKNAME | \
OBD_MD_FLEASIZE | OBD_MD_FLHANDLE | \
OBD_MD_FLCKSUM | OBD_MD_FLQOS | \
OBD_MD_FLOSCOPQ | OBD_MD_FLCOOKIE | \
#define OBD_MD_FLNOTOBD (~(OBD_MD_FLBLOCKS | OBD_MD_LINKNAME | \
OBD_MD_FLEASIZE | OBD_MD_FLHANDLE | \
OBD_MD_FLCKSUM | OBD_MD_FLQOS | \
OBD_MD_FLOSCOPQ | OBD_MD_FLCOOKIE | \
- OBD_MD_FLEA | OBD_MD_FLEALIST | \
- OBD_MD_FLACL_ACCESS | OBD_MD_MDS))
+ OBD_MD_FLXATTR | OBD_MD_FLXATTRLIST | \
+ OBD_MD_FLACL | OBD_MD_MDS))
static inline struct lustre_handle *obdo_handle(struct obdo *oa)
{
static inline struct lustre_handle *obdo_handle(struct obdo *oa)
{
struct lustre_md *md);
int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid);
int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
struct lustre_md *md);
int mdc_getstatus(struct obd_export *exp, struct lustre_id *rootid);
int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
- __u64 valid, const char *ea_name, int ea_namelen,
- unsigned int ea_size, struct ptlrpc_request **request);
+ __u64 valid, const char *xattr_name, unsigned int ea_size,
+ struct ptlrpc_request **request);
int mdc_getattr_lock(struct obd_export *exp, struct lustre_id *id,
char *filename, int namelen, __u64 valid,
unsigned int ea_size, struct ptlrpc_request **request);
int mdc_getattr_lock(struct obd_export *exp, struct lustre_id *id,
char *filename, int namelen, __u64 valid,
unsigned int ea_size, struct ptlrpc_request **request);
void *, int, ldlm_completion_callback,
ldlm_blocking_callback, void *);
int (*m_getattr)(struct obd_export *, struct lustre_id *,
void *, int, ldlm_completion_callback,
ldlm_blocking_callback, void *);
int (*m_getattr)(struct obd_export *, struct lustre_id *,
- __u64, const char *, int,
- unsigned int, struct ptlrpc_request **);
+ __u64, const char *, unsigned int,
+ struct ptlrpc_request **);
int (*m_access_check)(struct obd_export *, struct lustre_id *,
struct ptlrpc_request **);
int (*m_getattr_lock)(struct obd_export *, struct lustre_id *,
int (*m_access_check)(struct obd_export *, struct lustre_id *,
struct ptlrpc_request **);
int (*m_getattr_lock)(struct obd_export *, struct lustre_id *,
}
static inline int md_getattr(struct obd_export *exp, struct lustre_id *id,
}
static inline int md_getattr(struct obd_export *exp, struct lustre_id *id,
- __u64 valid, const char *ea_name, int ea_namelen,
- unsigned int ea_size, struct ptlrpc_request **request)
+ __u64 valid, const char *xattr_name,
+ unsigned int ea_size,
+ struct ptlrpc_request **request)
{
int rc;
ENTRY;
EXP_CHECK_MD_OP(exp, getattr);
MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
{
int rc;
ENTRY;
EXP_CHECK_MD_OP(exp, getattr);
MD_COUNTER_INCREMENT(exp->exp_obd, getattr);
- rc = MDP(exp->exp_obd, getattr)(exp, id, valid, ea_name, ea_namelen, ea_size, request);
+ rc = MDP(exp->exp_obd, getattr)(exp, id, valid, xattr_name,
+ ea_size, request);
valid |= OBD_MD_FLDIREA;
ll_inode2id(&id, inode);
valid |= OBD_MD_FLDIREA;
ll_inode2id(&id, inode);
- rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL, 0,
+ rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL,
obd_size_diskmd(sbi->ll_dt_exp, NULL),
&request);
if (rc < 0) {
obd_size_diskmd(sbi->ll_dt_exp, NULL),
&request);
if (rc < 0) {
-int ll_getxattr_internal(struct inode *inode, const char *name, int namelen,
+int ll_getxattr_internal(struct inode *inode, const char *name,
void *value, size_t size, __u64 valid)
{
struct ptlrpc_request *request = NULL;
void *value, size_t size, __u64 valid)
{
struct ptlrpc_request *request = NULL;
lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_GETXATTR);
ll_inode2id(&id, inode);
lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_GETXATTR);
ll_inode2id(&id, inode);
- rc = md_getattr(sbi->ll_md_exp, &id, valid, name, namelen,
- size, &request);
+ rc = md_getattr(sbi->ll_md_exp, &id, valid, name,
+ size, &request);
if (rc) {
if (rc != -ENODATA && rc != -EOPNOTSUPP)
CERROR("md_getattr fails: rc = %d\n", rc);
if (rc) {
if (rc != -ENODATA && rc != -EOPNOTSUPP)
CERROR("md_getattr fails: rc = %d\n", rc);
int ll_getxattr(struct dentry *dentry, const char *name, void *value,
size_t size)
{
int ll_getxattr(struct dentry *dentry, const char *name, void *value,
size_t size)
{
- return ll_getxattr_internal(dentry->d_inode, name, strlen(name) + 1,
- value, size, OBD_MD_FLEA);
+ return ll_getxattr_internal(dentry->d_inode, name,
+ value, size, OBD_MD_FLXATTR);
}
int ll_listxattr(struct dentry *dentry, char *list, size_t size)
{
}
int ll_listxattr(struct dentry *dentry, char *list, size_t size)
{
- return ll_getxattr_internal(dentry->d_inode, NULL, 0, list, size,
- OBD_MD_FLEALIST);
+ return ll_getxattr_internal(dentry->d_inode, NULL, list, size,
+ OBD_MD_FLXATTRLIST);
/* make root inode */
err = md_getattr(sbi->ll_md_exp, &sbi->ll_rootid,
(OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS | OBD_MD_FID),
/* make root inode */
err = md_getattr(sbi->ll_md_exp, &sbi->ll_rootid,
(OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS | OBD_MD_FID),
if (err) {
CERROR("md_getattr failed for root: rc = %d\n", err);
GOTO(out_lov, err);
if (err) {
CERROR("md_getattr failed for root: rc = %d\n", err);
GOTO(out_lov, err);
struct mds_body *body;
ll_inode2id(&id, inode);
struct mds_body *body;
ll_inode2id(&id, inode);
- rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL, 0, 0, &req);
+ rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL, 0, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, inode->i_ino);
RETURN(-abs(rc));
if (rc) {
CERROR("failure %d inode %lu\n", rc, inode->i_ino);
RETURN(-abs(rc));
id_ino(&id) = (__u64)ino;
id_gen(&id) = generation;
id_ino(&id) = (__u64)ino;
id_gen(&id) = generation;
- rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL, 0,
+ rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL,
eadatalen, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, ino);
eadatalen, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, ino);
}
ll_inode2id(&id, inode);
}
ll_inode2id(&id, inode);
- rc = md_getattr(sbi->ll_md_exp, &id, OBD_MD_LINKNAME, NULL, 0, symlen,
+ rc = md_getattr(sbi->ll_md_exp, &id, OBD_MD_LINKNAME, NULL, symlen,
}
static int lmv_getattr(struct obd_export *exp, struct lustre_id *id,
}
static int lmv_getattr(struct obd_export *exp, struct lustre_id *id,
- __u64 valid, const char *ea_name, int ea_namelen,
+ __u64 valid, const char *xattr_name,
unsigned int ea_size, struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
unsigned int ea_size, struct ptlrpc_request **request)
{
struct obd_device *obd = exp->exp_obd;
LASSERT(i < lmv->desc.ld_tgt_count);
LASSERT(i < lmv->desc.ld_tgt_count);
- rc = md_getattr(lmv->tgts[i].ltd_exp, id, valid,
- ea_name, ea_namelen, ea_size, request);
+ rc = md_getattr(lmv->tgts[i].ltd_exp, id, valid, xattr_name,
+ ea_size, request);
/* time to update mea of parent id */
rc = md_getattr(lmv->tgts[id_group(id)].ltd_exp,
/* time to update mea of parent id */
rc = md_getattr(lmv->tgts[id_group(id)].ltd_exp,
- id, valid, NULL, 0, mealen, &req);
+ id, valid, NULL, mealen, &req);
if (rc) {
CERROR("md_getattr() failed, error %d\n", rc);
GOTO(cleanup, rc);
if (rc) {
CERROR("md_getattr() failed, error %d\n", rc);
GOTO(cleanup, rc);
valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA | OBD_MD_MEA;
rc = md_getattr(lmv->tgts[id_group(id)].ltd_exp,
valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA | OBD_MD_MEA;
rc = md_getattr(lmv->tgts[id_group(id)].ltd_exp,
- id, valid, NULL, 0, mealen, &req);
+ id, valid, NULL, mealen, &req);
if (rc) {
CERROR("md_getattr() failed, error %d\n", rc);
GOTO(cleanup, obj = ERR_PTR(rc));
if (rc) {
CERROR("md_getattr() failed, error %d\n", rc);
GOTO(cleanup, obj = ERR_PTR(rc));
req->rq_replen = lustre_msg_size(5, repsize);
} else if (it->it_op & (IT_GETATTR | IT_LOOKUP | IT_CHDIR)) {
__u64 valid = data->valid | OBD_MD_FLNOTOBD | OBD_MD_FLEASIZE |
req->rq_replen = lustre_msg_size(5, repsize);
} else if (it->it_op & (IT_GETATTR | IT_LOOKUP | IT_CHDIR)) {
__u64 valid = data->valid | OBD_MD_FLNOTOBD | OBD_MD_FLEASIZE |
+ OBD_MD_FLACL;
+
+ /* we don't expect xattr retrieve could reach here */
+ LASSERT(!(valid & (OBD_MD_FLXATTR | OBD_MD_FLXATTRLIST)));
reqsize[req_buffers++] = sizeof(struct mds_body);
reqsize[req_buffers++] = data->namelen + 1;
reqsize[req_buffers++] = sizeof(struct mds_body);
reqsize[req_buffers++] = data->namelen + 1;
struct mds_body *body, *reqbody;
void *eadata;
int rc;
struct mds_body *body, *reqbody;
void *eadata;
int rc;
- int repsize[4] = {sizeof(*body)};
+ int repsize[2] = {sizeof(*body)};
}
reqbody = lustre_msg_buf(req->rq_reqmsg, 1, sizeof(*reqbody));
}
reqbody = lustre_msg_buf(req->rq_reqmsg, 1, sizeof(*reqbody));
-
- if (reqbody->valid & OBD_MD_FLACL_ACCESS) {
- repsize[bufcount++] = 4;
- repsize[bufcount++] = xattr_acl_size(LL_ACL_MAX_ENTRIES);
- }
+ LASSERT(!(reqbody->valid & OBD_MD_FLACL));
req->rq_replen = lustre_msg_size(bufcount, repsize);
req->rq_replen = lustre_msg_size(bufcount, repsize);
LASSERT_REPSWAB (req, 1);
/* Skip the check if getxattr/listxattr are called with no buffers */
LASSERT_REPSWAB (req, 1);
/* Skip the check if getxattr/listxattr are called with no buffers */
- if ((reqbody->valid & (OBD_MD_FLEA | OBD_MD_FLEALIST)) &&
- (reqbody->eadatasize != 0)){
- if (body->eadatasize != 0) {
+ if ((reqbody->eadatasize != 0) &&
+ !(reqbody->valid & (OBD_MD_FLXATTR | OBD_MD_FLXATTRLIST))) {
/* reply indicates presence of eadata; check it's there... */
/* reply indicates presence of eadata; check it's there... */
- eadata = lustre_msg_buf (req->rq_repmsg, 1,
- body->eadatasize);
- if (eadata == NULL) {
- CERROR ("Missing/short eadata\n");
- RETURN (-EPROTO);
- }
- }
+ eadata = lustre_msg_buf (req->rq_repmsg, 1,
+ body->eadatasize);
+ if (eadata == NULL) {
+ CERROR ("Missing/short eadata\n");
+ RETURN (-EPROTO);
+ }
}
int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
}
int mdc_getattr(struct obd_export *exp, struct lustre_id *id,
- __u64 valid, const char *ea_name, int ea_namelen,
+ __u64 valid, const char *xattr_name,
unsigned int ea_size, struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
struct mds_body *body;
unsigned int ea_size, struct ptlrpc_request **request)
{
struct ptlrpc_request *req;
struct mds_body *body;
+ int xattr_namelen = xattr_name ? strlen(xattr_name) + 1 : 0;
int bufcount = 2;
int size[3] = {0, sizeof(*body)};
int rc;
ENTRY;
int bufcount = 2;
int size[3] = {0, sizeof(*body)};
int rc;
ENTRY;
- /* XXX do we need to make another request here? We just did a getattr
- * to do the lookup in the first place.
- */
size[0] = lustre_secdesc_size();
size[0] = lustre_secdesc_size();
- LASSERT((ea_name != NULL) == (ea_namelen != 0));
- if (valid & (OBD_MD_FLEA | OBD_MD_FLEALIST)) {
- size[bufcount] = ea_namelen;
- bufcount++;
- }
+ if (valid & OBD_MD_FLXATTR)
+ size[bufcount++] = xattr_namelen;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
MDS_GETATTR, bufcount, size, NULL);
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_MDS_VERSION,
MDS_GETATTR, bufcount, size, NULL);
body->eadatasize = ea_size;
body->eadatasize = ea_size;
- if (valid & OBD_MD_FLEA) {
- LASSERT(strnlen(ea_name, ea_namelen) == (ea_namelen - 1));
- memcpy(lustre_msg_buf(req->rq_reqmsg, 2, ea_namelen),
- ea_name, ea_namelen);
- }
+ if (valid & OBD_MD_FLXATTR)
+ memcpy(lustre_msg_buf(req->rq_reqmsg, 2, xattr_namelen),
+ xattr_name, xattr_namelen);
rc = mdc_getattr_common(exp, ea_size, req);
if (rc != 0) {
rc = mdc_getattr_common(exp, ea_size, req);
if (rc != 0) {
- if (md->body->valid & OBD_MD_FLACL_ACCESS) {
+ if (md->body->valid & OBD_MD_FLACL) {
acl_off = (md->body->valid & OBD_MD_FLEASIZE) ?
(offset + 2) : (offset + 1);
acl_off = (md->body->valid & OBD_MD_FLEASIZE) ?
(offset + 2) : (offset + 1);
- if (md->body->valid & OBD_MD_RACL) {
+ if (md->body->valid & OBD_MD_FLRMTACL) {
buf = lustre_swab_repbuf(req, acl_off, sizeof(*perm),
lustre_swab_remote_perm);
buf = lustre_swab_repbuf(req, acl_off, sizeof(*perm),
lustre_swab_remote_perm);
if (rc != -ENODATA && rc != -EOPNOTSUPP)
CERROR("getxattr failed: %d", rc);
} else {
if (rc != -ENODATA && rc != -EOPNOTSUPP)
CERROR("getxattr failed: %d", rc);
} else {
- repbody->valid |= OBD_MD_FLEA;
+ repbody->valid |= OBD_MD_FLXATTR;
repbody->eadatasize = rc;
rc = 0;
}
repbody->eadatasize = rc;
rc = 0;
}
if (rc < 0) {
CERROR("listxattr failed: %d", rc);
} else {
if (rc < 0) {
CERROR("listxattr failed: %d", rc);
} else {
- repbody->valid |= OBD_MD_FLEALIST;
+ repbody->valid |= OBD_MD_FLXATTRLIST;
repbody->eadatasize = rc;
rc = 0;
}
repbody->eadatasize = rc;
rc = 0;
}
}
*sizep = cpu_to_le32(size);
}
*sizep = cpu_to_le32(size);
- body->valid |= OBD_MD_FLACL_ACCESS;
+ body->valid |= OBD_MD_FLACL;
if (inode->i_op->permission(inode, MAY_READ, NULL) == 0)
perm->mrp_perm |= MAY_READ;
if (inode->i_op->permission(inode, MAY_READ, NULL) == 0)
perm->mrp_perm |= MAY_READ;
- body->valid |= (OBD_MD_FLACL_ACCESS | OBD_MD_RACL);
+ body->valid |= (OBD_MD_FLACL | OBD_MD_FLRMTACL);
} else if (S_ISLNK(inode->i_mode) &&
(reqbody->valid & OBD_MD_LINKNAME) != 0) {
rc = mds_pack_link(dentry, req, body, reply_off);
} else if (S_ISLNK(inode->i_mode) &&
(reqbody->valid & OBD_MD_LINKNAME) != 0) {
rc = mds_pack_link(dentry, req, body, reply_off);
- } else if (reqbody->valid & OBD_MD_FLEA) {
+ } else if (reqbody->valid & OBD_MD_FLXATTR) {
rc = mds_pack_ea(dentry, req, body, req_off, reply_off);
rc = mds_pack_ea(dentry, req, body, req_off, reply_off);
- } else if (reqbody->valid & OBD_MD_FLEALIST) {
+ } else if (reqbody->valid & OBD_MD_FLXATTRLIST) {
rc = mds_pack_ealist(dentry, req, body, reply_off);
}
rc = mds_pack_ealist(dentry, req, body, reply_off);
}
- if (reqbody->valid & OBD_MD_FLACL_ACCESS) {
+ if (reqbody->valid & OBD_MD_FLACL) {
int inc = (reqbody->valid & OBD_MD_FLEASIZE) ? 2 : 1;
rc = mds_pack_acl(req, reply_off + inc, body, inode);
}
int inc = (reqbody->valid & OBD_MD_FLEASIZE) ? 2 : 1;
rc = mds_pack_acl(req, reply_off + inc, body, inode);
}
bufcount++;
CDEBUG(D_INODE, "symlink size: %Lu, reply space: %d\n",
inode->i_size + 1, body->eadatasize);
bufcount++;
CDEBUG(D_INODE, "symlink size: %Lu, reply space: %d\n",
inode->i_size + 1, body->eadatasize);
- } else if ((body->valid & OBD_MD_FLEA)) {
+ } else if ((body->valid & OBD_MD_FLXATTR)) {
char *ea_name = lustre_msg_string(req->rq_reqmsg,
offset + 1, 0);
rc = -EOPNOTSUPP;
char *ea_name = lustre_msg_string(req->rq_reqmsg,
offset + 1, 0);
rc = -EOPNOTSUPP;
size[bufcount] = min_t(int, body->eadatasize, rc);
}
bufcount++;
size[bufcount] = min_t(int, body->eadatasize, rc);
}
bufcount++;
- } else if (body->valid & OBD_MD_FLEALIST) {
+ } else if (body->valid & OBD_MD_FLXATTRLIST) {
rc = -EOPNOTSUPP;
if (inode->i_op && inode->i_op->getxattr)
rc = inode->i_op->listxattr(de, NULL, 0);
rc = -EOPNOTSUPP;
if (inode->i_op && inode->i_op->getxattr)
rc = inode->i_op->listxattr(de, NULL, 0);
}
/* may co-exist with OBD_MD_FLEASIZE */
}
/* may co-exist with OBD_MD_FLEASIZE */
- if (body->valid & OBD_MD_FLACL_ACCESS) {
+ if (body->valid & OBD_MD_FLACL) {
if (req->rq_export->exp_mds_data.med_remote) {
size[bufcount++] = sizeof(struct mds_remote_perm);
} else {
if (req->rq_export->exp_mds_data.med_remote) {
size[bufcount++] = sizeof(struct mds_remote_perm);
} else {