Whamcloud - gitweb
LU-2587 quota: bump version after migration
authorNiu Yawei <niu@whamcloud.com>
Tue, 8 Jan 2013 10:39:56 +0000 (05:39 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 23 Jan 2013 17:59:22 +0000 (12:59 -0500)
The global index version should be bumped to 2 if migration
happened, otherwise, the global index copy version on slave will
be same as the global index's (both equal to 1 after creation),
and the migrated limits will fail to be reintegrated.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I2d596a33e2eb4495dfbb7bd63d37199297a9b214
Reviewed-on: http://review.whamcloud.com/4969
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/osd-ldiskfs/osd_quota.c

index 2d3c80c..acf5557 100644 (file)
@@ -906,7 +906,8 @@ out:
 }
 
 static int set_quota_index_version(const struct lu_env *env,
 }
 
 static int set_quota_index_version(const struct lu_env *env,
-                                  struct dt_object *dt)
+                                  struct dt_object *dt,
+                                  dt_obj_version_t version)
 {
        struct osd_device       *osd = osd_obj2dev(osd_dt_obj(dt));
        struct thandle          *th;
 {
        struct osd_device       *osd = osd_obj2dev(osd_dt_obj(dt));
        struct thandle          *th;
@@ -926,7 +927,7 @@ static int set_quota_index_version(const struct lu_env *env,
                GOTO(out, rc);
 
        th->th_sync = 1;
                GOTO(out, rc);
 
        th->th_sync = 1;
-       dt_version_set(env, dt, 1, th);
+       dt_version_set(env, dt, version, th);
 out:
        dt_trans_stop(env, &osd->od_dt_dev, th);
        RETURN(rc);
 out:
        dt_trans_stop(env, &osd->od_dt_dev, th);
        RETURN(rc);
@@ -1064,10 +1065,10 @@ out:
                               PFID(lu_object_fid(&dt->do_lu)), rc);
        }
 
                               PFID(lu_object_fid(&dt->do_lu)), rc);
        }
 
-       /* bump index version to 1, so the migration will be skipped
-        * next time. */
+       /* bump index version to 1 (or 2 if migration happened), so the
+        * migration will be skipped next time. */
        if (rc == 0) {
        if (rc == 0) {
-               rc = set_quota_index_version(env , dt);
+               rc = set_quota_index_version(env , dt, converted ? 2 : 1);
                if (rc)
                        CERROR("%s: Failed to set quota index("DFID") "
                               "version, rc:%d\n", osd->od_svname,
                if (rc)
                        CERROR("%s: Failed to set quota index("DFID") "
                               "version, rc:%d\n", osd->od_svname,