return osd_invariant(osd_obj(l));
}
-#ifdef HAVE_QUOTA_SUPPORT
-static inline void
-osd_push_ctxt(const struct lu_env *env, struct osd_ctxt *save, bool is_md)
-{
- struct md_ucred *uc;
- struct cred *tc;
-
- if (!is_md)
- /* OFD support */
- return;
-
- uc = md_ucred(env);
-
- LASSERT(uc != NULL);
-
- save->oc_uid = current_fsuid();
- save->oc_gid = current_fsgid();
- save->oc_cap = current_cap();
- if ((tc = prepare_creds())) {
- tc->fsuid = uc->mu_fsuid;
- tc->fsgid = uc->mu_fsgid;
- commit_creds(tc);
- }
- /* XXX not suboptimal */
- cfs_curproc_cap_unpack(uc->mu_cap);
-}
-
-static inline void
-osd_pop_ctxt(struct osd_ctxt *save, bool is_md)
-{
- struct cred *tc;
-
- if (!is_md)
- /* OFD support */
- return;
-
- if ((tc = prepare_creds())) {
- tc->fsuid = save->oc_uid;
- tc->fsgid = save->oc_gid;
- tc->cap_effective = save->oc_cap;
- commit_creds(tc);
- }
-}
-#endif
-
/*
* Concurrency: doesn't matter
*/
OSD_EXEC_OP(handle, attr_set);
inode = obj->oo_inode;
- if (!osd_dt_dev(handle->th_dev)->od_is_md) {
- /* OFD support */
- rc = osd_quota_transfer(inode, attr);
- if (rc)
- return rc;
- } else {
-#ifdef HAVE_QUOTA_SUPPORT
- if ((attr->la_valid & LA_UID && attr->la_uid != inode->i_uid) ||
- (attr->la_valid & LA_GID && attr->la_gid != inode->i_gid)) {
- struct osd_ctxt *save = &osd_oti_get(env)->oti_ctxt;
- struct iattr iattr;
- int rc;
-
- iattr.ia_valid = 0;
- if (attr->la_valid & LA_UID)
- iattr.ia_valid |= ATTR_UID;
- if (attr->la_valid & LA_GID)
- iattr.ia_valid |= ATTR_GID;
- iattr.ia_uid = attr->la_uid;
- iattr.ia_gid = attr->la_gid;
- osd_push_ctxt(env, save, 1);
- rc = ll_vfs_dq_transfer(inode, &iattr) ? -EDQUOT : 0;
- osd_pop_ctxt(save, 1);
- if (rc != 0)
- return rc;
- }
-#endif
- }
+
+ rc = osd_quota_transfer(inode, attr);
+ if (rc)
+ return rc;
+
cfs_spin_lock(&obj->oo_guard);
rc = osd_inode_setattr(env, inode, attr);
cfs_spin_unlock(&obj->oo_guard);
struct osd_thandle *oth;
struct dt_object *parent = NULL;
struct inode *inode;
-#ifdef HAVE_QUOTA_SUPPORT
- struct osd_ctxt *save = &info->oti_ctxt;
-#endif
LINVRNT(osd_invariant(obj));
LASSERT(obj->oo_inode == NULL);
if (hint && hint->dah_parent)
parent = hint->dah_parent;
-#ifdef HAVE_QUOTA_SUPPORT
- osd_push_ctxt(info->oti_env, save, osd_dt_dev(th->th_dev)->od_is_md);
-#endif
inode = ldiskfs_create_inode(oth->ot_handle,
parent ? osd_dt_obj(parent)->oo_inode :
osd_sb(osd)->s_root->d_inode,
mode);
-#ifdef HAVE_QUOTA_SUPPORT
- osd_pop_ctxt(save, osd_dt_dev(th->th_dev)->od_is_md);
-#endif
if (!IS_ERR(inode)) {
/* Do not update file c/mtime in ldiskfs.
* NB: don't need any lock because no contention at this
if ((valid & LA_MTIME) && (attr->la_mtime == LTIME_S(inode->i_mtime)))
attr->la_valid &= ~LA_MTIME;
- if (!osd_obj2dev(obj)->od_is_md) {
- /* OFD support */
- result = osd_quota_transfer(inode, attr);
- if (result)
- return;
- } else {
-#ifdef HAVE_QUOTA_SUPPORT
- attr->la_valid &= ~(LA_UID | LA_GID);
-#endif
- }
+ result = osd_quota_transfer(inode, attr);
+ if (result)
+ return;
if (attr->la_valid != 0) {
result = osd_inode_setattr(info->oti_env, inode, attr);
LASSERT(obj->oo_inode != NULL);
- if (osd->od_is_md) {
- struct md_ucred *uc = md_ucred(env);
- LASSERT(uc != NULL);
- }
-
osd_id_gen(id, obj->oo_inode->i_ino, obj->oo_inode->i_generation);
return osd_oi_insert(info, osd, fid, id, th);
}
struct iam_path_descr *ipd;
struct osd_thandle *oh;
struct iam_container *bag = &obj->oo_dir->od_container;
-#ifdef HAVE_QUOTA_SUPPORT
- cfs_cap_t save = cfs_curproc_cap_pack();
-#endif
struct osd_thread_info *oti = osd_oti_get(env);
struct iam_rec *iam_rec;
int rc;
oh = container_of0(th, struct osd_thandle, ot_super);
LASSERT(oh->ot_handle != NULL);
LASSERT(oh->ot_handle->h_transaction != NULL);
-#ifdef HAVE_QUOTA_SUPPORT
- if (ignore_quota)
- cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
- else
- cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
-#endif
if (S_ISDIR(obj->oo_inode->i_mode)) {
iam_rec = (struct iam_rec *)oti->oti_ldp;
osd_fid_pack((struct osd_fid_pack *)iam_rec, rec, &oti->oti_fid);
rc = iam_insert(oh->ot_handle, bag, (const struct iam_key *)key,
iam_rec, ipd);
-#ifdef HAVE_QUOTA_SUPPORT
- cfs_curproc_cap_unpack(save);
-#endif
osd_ipd_put(env, bag, ipd);
LINVRNT(osd_invariant(obj));
RETURN(rc);
struct lu_fid *fid = (struct lu_fid *) rec;
const char *name = (const char *)key;
struct osd_object *child;
-#ifdef HAVE_QUOTA_SUPPORT
- cfs_cap_t save = cfs_curproc_cap_pack();
-#endif
int rc;
ENTRY;
child = osd_object_find(env, dt, fid);
if (!IS_ERR(child)) {
-#ifdef HAVE_QUOTA_SUPPORT
- if (ignore_quota)
- cfs_cap_raise(CFS_CAP_SYS_RESOURCE);
- else
- cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
-#endif
rc = osd_ea_add_rec(env, obj, child->oo_inode, name, rec, th);
-#ifdef HAVE_QUOTA_SUPPORT
- cfs_curproc_cap_unpack(save);
-#endif
osd_object_put(env, child);
} else {
rc = PTR_ERR(child);