Blame SOURCES/xfsprogs-5.7.0-progress-reporting-fix.patch

3d5736
xfs_repair: fix progress reporting
3d5736
3d5736
RHEL7 note: this is a simplified version of the upstream patch.
3d5736
3d5736
The Fixes: commit tried to avoid a segfault in case the progress timer
3d5736
went off before the first message type had been set up, but this
3d5736
had the net effect of short-circuiting the pthread start routine,
3d5736
and so the timer didn't get set up at all and we lost all fine-grained
3d5736
progress reporting.
3d5736
3d5736
The initial problem occurred when log zeroing took more time than the
3d5736
timer interval.
3d5736
3d5736
[RHEL7: we do not explicitly track log zeroing, and instead lump it into
3d5736
Phase 2, so the next part of the description is not relevant to this
3d5736
patch.]
3d5736
3d5736
So, make a new log zeroing progress item and initialize it when we first
3d5736
set up the timer thread, to be sure that if the timer goes off while we
3d5736
are still zeroing the log, it will be initialized and correct.
3d5736
3d5736
(We can't offer fine-grained status on log zeroing, so it'll go from
3d5736
zero to $LOGBLOCKS with nothing in between, but it's unlikely that log
3d5736
zeroing will take so long that this really matters.)
3d5736
3d5736
Reported-by: Leonardo Vaz <lvaz@redhat.com>
3d5736
Fixes: 7f2d6b811755 ("xfs_repair: avoid segfault if reporting progre...")
3d5736
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
3d5736
---
3d5736
3d5736
It might be nice to add progress reporting for the log zeroing, but that
3d5736
requires renumbering all these macros, and we don't/can't actually get
3d5736
any fine-grained progress at all, so probably not worth it.
3d5736
3d5736
Index: xfsprogs-4.5.0/repair/progress.c
3d5736
===================================================================
3d5736
--- xfsprogs-4.5.0.orig/repair/progress.c
3d5736
+++ xfsprogs-4.5.0/repair/progress.c
3d5736
@@ -124,7 +124,13 @@ init_progress_rpt (void)
3d5736
 	 */
3d5736
 
3d5736
 	pthread_mutex_init(&global_msgs.mutex, NULL);
3d5736
-	global_msgs.format = NULL;
3d5736
+	/*
3d5736
+	 * Ensure the format string is not NULL in case the first timer
3d5736
+	 * goes off before any stage calls set_progress_msg() to set it.
3d5736
+	 * Choosing PROG_FMT_SCAN_AG lumps log zeroing in with the AG scan
3d5736
+	 * but that is not expected to take inordinately long.
3d5736
+	 */
3d5736
+	global_msgs.format = &progress_rpt_reports[PROG_FMT_SCAN_AG];
3d5736
 	global_msgs.count = glob_agcount;
3d5736
 	global_msgs.interval = report_interval;
3d5736
 	global_msgs.done   = prog_rpt_done;
3d5736
@@ -170,10 +176,6 @@ progress_rpt_thread (void *p)
3d5736
 	msg_block_t *msgp = (msg_block_t *)p;
3d5736
 	__uint64_t percent;
3d5736
 
3d5736
-	/* It's possible to get here very early w/ no progress msg set */
3d5736
-	if (!msgp->format)
3d5736
-		return NULL;
3d5736
-
3d5736
 	if ((msgbuf = (char *)malloc(DURATION_BUF_SIZE)) == NULL)
3d5736
 		do_error (_("progress_rpt: cannot malloc progress msg buffer\n"));
3d5736