[11/13] xfs_scrub: check progress bar timedwait failures
diff mbox series

Message ID 156944727002.297677.2767314073387682430.stgit@magnolia
State New
Headers show
Series
  • libfrog/xfs_scrub: fix error handling
Related show

Commit Message

Darrick J. Wong Sept. 25, 2019, 9:34 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Check for failures in the timedwait for progressbar reporting.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 scrub/progress.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Eric Sandeen Oct. 9, 2019, 9:49 p.m. UTC | #1
On 9/25/19 4:34 PM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Check for failures in the timedwait for progressbar reporting.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  scrub/progress.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/scrub/progress.c b/scrub/progress.c
> index 5fda4ccb..e93b607f 100644
> --- a/scrub/progress.c
> +++ b/scrub/progress.c
> @@ -130,7 +130,9 @@ progress_report_thread(void *arg)
>  			abstime.tv_sec++;
>  			abstime.tv_nsec -= NSEC_PER_SEC;
>  		}
> -		pthread_cond_timedwait(&pt.wakeup, &pt.lock, &abstime);
> +		ret = pthread_cond_timedwait(&pt.wakeup, &pt.lock, &abstime);
> +		if (ret && ret != ETIMEDOUT)
> +			break;
>  		if (pt.terminate)
>  			break;
>  		ret = ptcounter_value(pt.ptc, &progress_val);
>

Patch
diff mbox series

diff --git a/scrub/progress.c b/scrub/progress.c
index 5fda4ccb..e93b607f 100644
--- a/scrub/progress.c
+++ b/scrub/progress.c
@@ -130,7 +130,9 @@  progress_report_thread(void *arg)
 			abstime.tv_sec++;
 			abstime.tv_nsec -= NSEC_PER_SEC;
 		}
-		pthread_cond_timedwait(&pt.wakeup, &pt.lock, &abstime);
+		ret = pthread_cond_timedwait(&pt.wakeup, &pt.lock, &abstime);
+		if (ret && ret != ETIMEDOUT)
+			break;
 		if (pt.terminate)
 			break;
 		ret = ptcounter_value(pt.ptc, &progress_val);