From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@redhat.com, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 03/10] xfs_scrub: destroy workqueues when erroring out
Date: Tue, 26 Jun 2018 19:48:04 -0700 [thread overview]
Message-ID: <153006768447.20121.17161456551475897498.stgit@magnolia> (raw)
In-Reply-To: <153006766483.20121.9285982017465570544.stgit@magnolia>
From: Darrick J. Wong <darrick.wong@oracle.com>
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>
---
scrub/phase2.c | 2 +-
scrub/vfs.c | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/scrub/phase2.c b/scrub/phase2.c
index ad736bf5..7078e38d 100644
--- a/scrub/phase2.c
+++ b/scrub/phase2.c
@@ -102,7 +102,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 77df2874..12a6a860 100644
--- a/scrub/vfs.c
+++ b/scrub/vfs.c
@@ -210,7 +210,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);
@@ -220,6 +220,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);
next prev parent reply other threads:[~2018-06-27 2:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-27 2:47 [PATCH 00/10] xfsprogs-4.18: mostly scrub/repair stuff Darrick J. Wong
2018-06-27 2:47 ` [PATCH 01/10] libxfs: remove crc32 functions Darrick J. Wong
2018-06-27 2:47 ` [PATCH 02/10] libfrog: move crc32c code out of libxfs Darrick J. Wong
2018-06-27 2:48 ` Darrick J. Wong [this message]
2018-07-26 0:29 ` [PATCH 03/10] xfs_scrub: destroy workqueues when erroring out Eric Sandeen
2018-06-27 2:48 ` [PATCH 04/10] xfs_scrub: schedule and manage optimizations/repairs to the filesystem Darrick J. Wong
2018-07-26 1:06 ` Eric Sandeen
2018-07-26 1:17 ` Darrick J. Wong
2018-06-27 2:48 ` [PATCH 05/10] xfs_scrub: allow developers to force repairs Darrick J. Wong
2018-07-26 1:07 ` Eric Sandeen
2018-06-27 2:48 ` [PATCH 06/10] xfs_scrub: don't error out if an optimize-only repair isn't supported Darrick J. Wong
2018-07-26 1:09 ` Eric Sandeen
2018-06-27 2:48 ` [PATCH 07/10] xfs_scrub: rename NOFIX_COMPLAIN to be less confusing Darrick J. Wong
2018-07-26 1:10 ` Eric Sandeen
2018-06-27 2:48 ` [PATCH 08/10] xfs_scrub: only retry non-permanent repair failures Darrick J. Wong
2018-07-26 1:16 ` Eric Sandeen
2018-07-26 1:19 ` Darrick J. Wong
2018-06-27 2:48 ` [PATCH 09/10] xfs_io: wire up repair ioctl stuff Darrick J. Wong
2018-07-26 1:23 ` Eric Sandeen
2018-06-27 2:48 ` [PATCH 10/10] xfs_repair: use libxfs extsize/cowextsize validation helpers Darrick J. Wong
2018-06-27 3:25 ` Eric Sandeen
2018-06-28 17:28 ` Darrick J. Wong
2018-06-28 17:29 ` [PATCH 11/10] xfs_repair: clear extent size hints when clearing inode core Darrick J. Wong
2018-06-28 19:24 ` Eric Sandeen
2018-06-28 17:30 ` [PATCH 12/10] xfs_repair: use libxfs extsize/cowextsize validation helpers Darrick J. Wong
2018-07-26 1:44 ` Eric Sandeen
2018-07-26 1:48 ` Eric Sandeen
2018-07-26 20:38 ` [PATCH v2 " Darrick J. Wong
2018-07-27 22:44 ` Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=153006768447.20121.17161456551475897498.stgit@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).