Whamcloud - gitweb
LU-9679 lustre: use LIST_HEAD() for local lists.
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_handler.c
index 5710374..13e710c 100644 (file)
@@ -42,9 +42,7 @@
 #include <linux/kallsyms.h>
 #include <linux/module.h>
 #include <linux/user_namespace.h>
-#ifdef HAVE_UIDGID_HEADER
-# include <linux/uidgid.h>
-#endif
+#include <linux/uidgid.h>
 
 /* prerequisite for linux/xattr.h */
 #include <linux/types.h>
@@ -1014,6 +1012,7 @@ again:
        filp->f_mapping = inode->i_mapping;
        filp->f_op = fops;
        filp->private_data = NULL;
+       filp->f_cred = current_cred();
        set_file_inode(filp, inode);
        rc = osd_security_file_alloc(filp);
        if (rc)
@@ -2796,9 +2795,10 @@ static int osd_declare_attr_set(const struct lu_env *env,
                        RETURN(rc);
 
                gid = i_gid_read(obj->oo_inode);
+               CDEBUG(D_QUOTA, "declare uid %d -> %d gid %d -> %d\n", uid,
+                      attr->la_uid, gid, attr->la_gid);
                enforce = (attr->la_valid & LA_GID) && (attr->la_gid != gid);
-               rc = osd_declare_attr_qid(env, obj, oh, bspace,
-                                         i_gid_read(obj->oo_inode),
+               rc = osd_declare_attr_qid(env, obj, oh, bspace, gid,
                                          attr->la_gid, enforce, GRPQUOTA,
                                          ignore_edquot);
                if (rc)
@@ -2941,6 +2941,11 @@ static int osd_quota_transfer(struct inode *inode, const struct lu_attr *attr)
            (attr->la_valid & LA_GID && attr->la_gid != i_gid_read(inode))) {
                struct iattr iattr;
 
+               CDEBUG(D_QUOTA,
+                      "executing dquot_transfer inode %ld uid %d -> %d gid %d -> %d\n",
+                      inode->i_ino, i_uid_read(inode), attr->la_uid,
+                      i_gid_read(inode), attr->la_gid);
+
                dquot_initialize(inode);
                iattr.ia_valid = 0;
                if (attr->la_valid & LA_UID)
@@ -3036,6 +3041,8 @@ static int osd_attr_set(const struct lu_env *env,
 
        ll_dirty_inode(inode, I_DIRTY_DATASYNC);
 
+       osd_trans_exec_check(env, handle, OSD_OT_ATTR_SET);
+
        if (!(attr->la_valid & LA_FLAGS))
                GOTO(out, rc);
 
@@ -3054,6 +3061,9 @@ static int osd_attr_set(const struct lu_env *env,
                lma->lma_incompat |=
                        lustre_to_lma_flags(attr->la_flags);
                lustre_lma_swab(lma);
+
+               osd_trans_exec_op(env, handle, OSD_OT_XATTR_SET);
+
                rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA,
                                     lma, sizeof(*lma), XATTR_REPLACE);
                if (rc != 0) {
@@ -3069,7 +3079,6 @@ static int osd_attr_set(const struct lu_env *env,
                osd_trans_exec_check(env, handle, OSD_OT_XATTR_SET);
        }
 out:
-       osd_trans_exec_check(env, handle, OSD_OT_ATTR_SET);
 
        return rc;
 }
@@ -3910,20 +3919,16 @@ static int osd_process_scheduled_agent_removals(const struct lu_env *env,
        struct osd_thread_info *info = osd_oti_get(env);
        struct osd_obj_orphan *oor, *tmp;
        struct osd_inode_id id;
-       struct list_head list;
+       LIST_HEAD(list);
        struct inode *inode;
        struct lu_fid fid;
        handle_t *jh;
        __u32 ino;
 
-       INIT_LIST_HEAD(&list);
-
        spin_lock(&osd->od_osfs_lock);
        list_for_each_entry_safe(oor, tmp, &osd->od_orphan_list, oor_list) {
-               if (oor->oor_env == env) {
-                       list_del(&oor->oor_list);
-                       list_add(&oor->oor_list, &list);
-               }
+               if (oor->oor_env == env)
+                       list_move(&oor->oor_list, &list);
        }
        spin_unlock(&osd->od_osfs_lock);
 
@@ -6623,6 +6628,7 @@ static int osd_ldiskfs_it_fill(const struct lu_env *env,
                down_read(&obj->oo_ext_idx_sem);
        }
 
+       filp->f_cred = current_cred();
        rc = osd_security_file_alloc(filp);
        if (rc)
                RETURN(rc);
@@ -8146,7 +8152,7 @@ static int osd_health_check(const struct lu_env *env, struct obd_device *obd)
 /*
  * lprocfs legacy support.
  */
-static struct obd_ops osd_obd_device_ops = {
+static const struct obd_ops osd_obd_device_ops = {
        .o_owner = THIS_MODULE,
        .o_connect      = osd_obd_connect,
        .o_disconnect   = osd_obd_disconnect,