diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-08-01 17:06:44 -0500 |
---|---|---|
committer | Eric Sandeen <sandeen@redhat.com> | 2018-08-01 17:06:44 -0500 |
commit | 224df90245a9f407be2eea4935ecd79989338bb9 (patch) | |
tree | 93468788f46b585ecec75128c8d0086469b46df0 /scrub | |
parent | 973de649842b6f96db32e5060b62e8fbcc05f033 (diff) | |
download | xfsprogs-dev-224df90245a9f407be2eea4935ecd79989338bb9.tar.gz |
xfs_scrub: destroy workqueues when erroring out
Fix a couple of code paths that forgot to tear down a workqueue when
erroring out, because if we don't the wq threads keep running even after
we've freed the wq memory.
Found by fuzzing core.nlinkv2=0 in xfs/377, but only because the fs will
shut down when it hits an error destroying the incore (corrupt) inode
after the scrub.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Diffstat (limited to 'scrub')
-rw-r--r-- | scrub/phase2.c | 2 | ||||
-rw-r--r-- | scrub/vfs.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/scrub/phase2.c b/scrub/phase2.c index 025758376e..faa01bf998 100644 --- a/scrub/phase2.c +++ b/scrub/phase2.c @@ -88,7 +88,7 @@ xfs_scan_metadata( */ moveon = xfs_scrub_primary_super(ctx); if (!moveon) - return moveon; + goto out; for (agno = 0; moveon && agno < ctx->geo.agcount; agno++) { ret = workqueue_add(&wq, xfs_scan_ag_metadata, agno, &moveon); diff --git a/scrub/vfs.c b/scrub/vfs.c index a33ec8b4a2..8bcc4e79d3 100644 --- a/scrub/vfs.c +++ b/scrub/vfs.c @@ -196,7 +196,7 @@ scan_fs_tree( if (ret) { str_info(ctx, ctx->mntpoint, _("Could not queue directory scan work.")); - goto out_free; + goto out_wq; } pthread_mutex_lock(&sft.lock); @@ -206,6 +206,8 @@ _("Could not queue directory scan work.")); workqueue_destroy(&wq); return sft.moveon; +out_wq: + workqueue_destroy(&wq); out_free: free(sftd->path); free(sftd); |