X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fllite%2Fxattr26.c;h=d0cd4a1aad6b54839a53fbdb675063a6c0ff7513;hb=refs%2Fchanges%2F09%2F34909%2F16;hp=3faa1d8315b2e0eefee722de3d78a135725892dc;hpb=ccabce23bd9e366c345c852f565766a799f61238;p=fs%2Flustre-release.git diff --git a/lustre/llite/xattr26.c b/lustre/llite/xattr26.c index 3faa1d8..d0cd4a1 100644 --- a/lustre/llite/xattr26.c +++ b/lustre/llite/xattr26.c @@ -124,11 +124,7 @@ int ll_setxattr_common(struct inode *inode, const char *name, if ((xattr_type == XATTR_ACL_ACCESS_T || xattr_type == XATTR_ACL_DEFAULT_T) && -#ifdef HAVE_INODE_OWNER_OR_CAPABLE !inode_owner_or_capable(inode)) -#else - !is_owner_or_cap(inode)) -#endif return -EPERM; /* b10667: ignore lustre special xattr for now */ @@ -152,7 +148,7 @@ int ll_setxattr_common(struct inode *inode, const char *name, } rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, name, pv, - size, 0, flags, ll_i2suppgid(inode), &req); + size, flags, ll_i2suppgid(inode), &req); if (rc) { if (rc == -EOPNOTSUPP && xattr_type == XATTR_USER_T) { LCONSOLE_INFO("Disabling user_xattr feature because " @@ -329,7 +325,6 @@ int ll_getxattr_common(struct inode *inode, const char *name, { struct ll_sb_info *sbi = ll_i2sbi(inode); struct ptlrpc_request *req = NULL; - struct mdt_body *body; int xattr_type, rc; void *xdata; struct ll_inode_info *lli = ll_i2info(inode); @@ -405,36 +400,25 @@ do_getxattr: } } else { getxattr_nocache: - rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), - valid, name, NULL, 0, size, 0, &req); - + rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, + name, size, &req); if (rc < 0) GOTO(out_xattr, rc); - body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); - LASSERT(body); - /* only detect the xattr size */ if (size == 0) - GOTO(out, rc = body->mbo_eadatasize); + GOTO(out, rc); - if (size < body->mbo_eadatasize) { - CERROR("server bug: replied size %u > %u\n", - body->mbo_eadatasize, (int)size); + if (size < rc) GOTO(out, rc = -ERANGE); - } - - if (body->mbo_eadatasize == 0) - GOTO(out, rc = -ENODATA); /* do not need swab xattr data */ xdata = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA, - body->mbo_eadatasize); + rc); if (!xdata) - GOTO(out, rc = -EFAULT); + GOTO(out, rc = -EPROTO); - memcpy(buffer, xdata, body->mbo_eadatasize); - rc = body->mbo_eadatasize; + memcpy(buffer, xdata, rc); } EXIT; @@ -442,8 +426,8 @@ getxattr_nocache: out_xattr: if (rc == -EOPNOTSUPP && xattr_type == XATTR_USER_T) { LCONSOLE_INFO("%s: disabling user_xattr feature because " - "it is not supported on the server: rc = %d\n", - ll_get_fsname(inode->i_sb, NULL, 0), rc); + "it is not supported on the server: rc = %d\n", + ll_i2sbi(inode)->ll_fsname, rc); sbi->ll_flags &= ~LL_SBI_USER_XATTR; } out: @@ -463,6 +447,7 @@ static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size) .cl_buf.lb_len = buf_size, }; __u16 refcheck; + __u32 magic; if (obj == NULL) RETURN(-ENODATA); @@ -489,7 +474,8 @@ static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size) * otherwise it would confuse tar --xattr by * recognizing layout gen as stripe offset when the * file is restored. See LU-2809. */ - if (((struct lov_mds_md *)buf)->lmm_magic == LOV_MAGIC_COMP_V1) + magic = ((struct lov_mds_md *)buf)->lmm_magic; + if (magic == LOV_MAGIC_COMP_V1 || magic == LOV_MAGIC_FOREIGN) goto out_env; ((struct lov_mds_md *)buf)->lmm_layout_gen = 0;