@@ -1889,6 +1889,7 @@ struct cl_io {
loff_t sa_falloc_end;
uid_t sa_falloc_uid;
gid_t sa_falloc_gid;
+ u32 sa_falloc_projid;
} ci_setattr;
struct cl_data_version_io {
u64 dv_data_version;
@@ -2629,7 +2629,7 @@ static int ll_do_fiemap(struct inode *inode, struct fiemap *fiemap,
goto out;
}
- fmkey.lfik_oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
+ fmkey.lfik_oa.o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLPROJID;
obdo_from_inode(&fmkey.lfik_oa, inode, OBD_MD_FLSIZE);
obdo_set_parent_fid(&fmkey.lfik_oa, &ll_i2info(inode)->lli_fid);
@@ -3412,10 +3412,12 @@ static int ll_set_project(struct inode *inode, u32 xflags, u32 projid)
op_data->op_attr_flags = ll_inode_to_ext_flags(inode_flags);
if (xflags & FS_XFLAG_PROJINHERIT)
op_data->op_attr_flags |= LUSTRE_PROJINHERIT_FL;
+
+ /* pass projid to md_op_data */
op_data->op_projid = projid;
- op_data->op_xvalid |= OP_XVALID_PROJID;
- rc = md_setattr(ll_i2sbi(inode)->ll_md_exp, op_data, NULL,
- 0, &req);
+
+ op_data->op_xvalid |= OP_XVALID_PROJID | OP_XVALID_FLAGS;
+ rc = md_setattr(ll_i2sbi(inode)->ll_md_exp, op_data, NULL, 0, &req);
ptlrpc_req_finished(req);
if (rc)
goto out_fsxattr;
@@ -5262,11 +5264,11 @@ int ll_getattr(const struct path *path, struct kstat *stat,
int cl_falloc(struct file *file, struct inode *inode, int mode, loff_t offset,
loff_t len)
{
+ loff_t size = i_size_read(inode);
struct lu_env *env;
struct cl_io *io;
u16 refcheck;
int rc;
- loff_t size = i_size_read(inode);
env = cl_env_get(&refcheck);
if (IS_ERR(env))
@@ -5283,12 +5285,14 @@ int cl_falloc(struct file *file, struct inode *inode, int mode, loff_t offset,
io->u.ci_setattr.sa_falloc_end = offset + len;
io->u.ci_setattr.sa_subtype = CL_SETATTR_FALLOCATE;
- CDEBUG(D_INODE, "UID %u GID %u\n",
+ CDEBUG(D_INODE, "UID %u GID %u PRJID %u\n",
from_kuid(&init_user_ns, inode->i_uid),
- from_kgid(&init_user_ns, inode->i_gid));
+ from_kgid(&init_user_ns, inode->i_gid),
+ ll_i2info(inode)->lli_projid);
io->u.ci_setattr.sa_falloc_uid = from_kuid(&init_user_ns, inode->i_uid);
io->u.ci_setattr.sa_falloc_gid = from_kgid(&init_user_ns, inode->i_gid);
+ io->u.ci_setattr.sa_falloc_projid = ll_i2info(inode)->lli_projid;
if (io->u.ci_setattr.sa_falloc_end > size) {
loff_t newsize = io->u.ci_setattr.sa_falloc_end;
@@ -190,7 +190,8 @@ static int vvp_object_glimpse(const struct lu_env *env,
static void vvp_req_attr_set(const struct lu_env *env, struct cl_object *obj,
struct cl_req_attr *attr)
{
- u64 valid_flags = OBD_MD_FLTYPE | OBD_MD_FLUID | OBD_MD_FLGID;
+ u64 valid_flags = OBD_MD_FLTYPE | OBD_MD_FLUID | OBD_MD_FLGID |
+ OBD_MD_FLPROJID;
struct inode *inode;
struct obdo *oa;
@@ -685,6 +685,8 @@ static void lov_io_sub_inherit(struct lov_io_sub *sub, struct lov_io *lio,
parent->u.ci_setattr.sa_falloc_uid;
io->u.ci_setattr.sa_falloc_gid =
parent->u.ci_setattr.sa_falloc_gid;
+ io->u.ci_setattr.sa_falloc_projid =
+ parent->u.ci_setattr.sa_falloc_projid;
}
if (cl_io_is_trunc(io)) {
loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size;
@@ -671,11 +671,14 @@ static int osc_io_setattr_start(const struct lu_env *env,
oa->o_blocks = io->u.ci_setattr.sa_falloc_end;
oa->o_uid = io->u.ci_setattr.sa_falloc_uid;
oa->o_gid = io->u.ci_setattr.sa_falloc_gid;
+ oa->o_projid = io->u.ci_setattr.sa_falloc_projid;
oa->o_valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
- OBD_MD_FLUID | OBD_MD_FLGID;
+ OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLPROJID;
- CDEBUG(D_INODE, "size %llu blocks %llu uid %u gid %u\n",
- oa->o_size, oa->o_blocks, oa->o_uid, oa->o_gid);
+ CDEBUG(D_INODE,
+ "size %llu blocks %llu uid %u gid %u prjid %u\n",
+ oa->o_size, oa->o_blocks, oa->o_uid, oa->o_gid,
+ oa->o_projid);
result = osc_fallocate_base(osc_export(cl2osc(obj)),
oa, osc_async_upcall,
cbargs, falloc_mode);