Whamcloud - gitweb
LU-10989 utils: correct lustre_rsync changelog clear logic 25/32525/3
authorJohn L. Hammond <john.hammond@intel.com>
Wed, 2 May 2018 14:43:07 +0000 (09:43 -0500)
committerJohn L. Hammond <jhammond@whamcloud.com>
Wed, 1 Aug 2018 16:56:28 +0000 (16:56 +0000)
In the non-extended rename case of lr_replicate() copy the record
number from ext to info. Then remove the spurious rename record
handling from lr_clear_cl().

Lustre-change: https://review.whamcloud.com/32247
Lustre-commit: 62ac9c6572e5d42183a9bf5fbbd6a8ead62408cd

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I615ec2f384f5f9d7807156acb3ce66ac47ca1e77
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/32525
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
lustre/utils/lustre_rsync.c

index 0748832..311bf42 100644 (file)
@@ -1388,14 +1388,9 @@ int lr_read_log()
 int lr_clear_cl(struct lr_info *info, int force)
 {
        char            mdt_device[LR_NAME_MAXLEN + 1];
-       long long       rec;
        int             rc = 0;
 
         if (force || info->recno > status->ls_last_recno + CLEAR_INTERVAL) {
-                if (info->type == CL_RENAME)
-                        rec = info->recno + 1;
-                else
-                        rec = info->recno;
                 if (!noclear && !dryrun) {
                         /* llapi_changelog_clear modifies the mdt
                          * device name so make a copy of it until this
@@ -1405,20 +1400,21 @@ int lr_clear_cl(struct lr_info *info, int force)
                                sizeof(mdt_device));
                         rc = llapi_changelog_clear(mdt_device,
                                                    status->ls_registration,
-                                                   rec);
+                                                  info->recno);
                         if (rc)
-                                printf("Changelog clear (%s, %s, %lld) "
-                                       "returned %d\n", status->ls_mdt_device,
-                                       status->ls_registration, rec, rc);
-                }
-                if (!rc && !dryrun) {
-                        status->ls_last_recno = rec;
-                        lr_write_log();
+                               printf("Changelog clear (%s, %s, %lld) "
+                                      "returned %d\n", status->ls_mdt_device,
+                                      status->ls_registration, info->recno,
+                                      rc);
+               }
 
-                }
-        }
+               if (!rc && !dryrun) {
+                       status->ls_last_recno = info->recno;
+                       lr_write_log();
+               }
+       }
 
-        return rc;
+       return rc;
 }
 
 /* Locate a usable version of rsync. At this point we'll use any
@@ -1588,6 +1584,7 @@ int lr_replicate()
                        strlcpy(info->sname, info->name, sizeof(info->sname));
                        strlcpy(info->name, ext->name, sizeof(info->name));
                        info->is_extended = 1;
+                       info->recno = ext->recno; /* For lr_clear_cl(). */
                }
 
                 if (dryrun)