diff --git a/lustre/utils/lustre_rsync.c b/lustre/utils/lustre_rsync.c
index e4bc0e5dc538acb902737ac143da028917dc5498..a54ac2578ad4a93b1805c5b9bad210061ec03a47 100644
--- a/lustre/utils/lustre_rsync.c
+++ b/lustre/utils/lustre_rsync.c
@@ -1396,14 +1396,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
@@ -1413,20 +1408,21 @@ int lr_clear_cl(struct lr_info *info, int force)
 				 status->ls_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
@@ -1611,6 +1607,7 @@ int lr_replicate()
 			snprintf(info->name, sizeof(info->name), "%s",
 				 ext->name);
 			info->is_extended = 1;
+			info->recno = ext->recno; /* For lr_clear_cl(). */
 		}
 
                 if (dryrun)