From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH] gfs2: make recovery workqueue operate on a gfs2 mount point, not journal
Date: Tue, 22 Dec 2020 21:47:37 -0500 (EST) [thread overview]
Message-ID: <1734775184.38918835.1608691657308.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAHc6FU5w=7CLrqYzE==4Vt39+Mfv4ZNX_PVi7KShqNYzedLeag@mail.gmail.com>
----- Original Message -----
> On Tue, Dec 22, 2020 at 9:39 PM Bob Peterson <rpeterso@redhat.com> wrote:
> >
> > Hi,
> >
> > Before this patch, journal recovery was done by a workqueue function that
> > operated on a per-journal basis. The problem is, these could run
> > simultaneously
> > which meant that they could all use the same bio, sd_log_bio, to do their
> > writing to all the various journals. These operations overwrote one another
> > eventually causing memory corruption.
> >
> > This patch makes the recovery workqueue operate on a per-superblock basis,
> > which means a mount point using, for example journal0, could do recovery
> > for all journals that need recovery. This is done consecutively so the
> > sd_log_bio is only referenced by one recovery at a time, thus avoiding the
> > chaos.
> >
> > Since the journal recovery requests can come in any order, and
> > unpredictably,
> > the new work func loops until there are no more journals to be recovered.
> >
> > Since multiple processes may request recovery of a journal, and since they
> > all now use the same sdp-based workqueue, it's okay for them to get an
> > error from queue_work: Queueing work while there's already work queued.
> >
> > Signed-off-by: Bob Peterson <rpeterso@redhat.com>
>
> Can't this be a simple loop like below?
>
> repeat:
> spin_lock(&sdp->sd_jindex_spin);
> list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
> if (test_bit(JDF_RECOVERY, &jd->jd_flags)) {
> spin_unlock(&sdp->sd_jindex_spin);
> gfs2_recover_one(jd);
> goto repeat;
> }
> }
> spin_unlock(&sdp->sd_jindex_spin);
>
Yes, that's just as effective. I just hate gotos. Whichever you prefer is fine with me.
I'm okay with not reporting the count too.
Bob
next prev parent reply other threads:[~2020-12-23 2:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <290202568.38904309.1608669529163.JavaMail.zimbra@redhat.com>
2020-12-22 20:38 ` [Cluster-devel] [GFS2 PATCH] gfs2: make recovery workqueue operate on a gfs2 mount point, not journal Bob Peterson
2020-12-22 23:27 ` Andreas Gruenbacher
2020-12-23 2:47 ` Bob Peterson [this message]
2021-01-04 9:13 ` Steven Whitehouse
2021-01-04 16:09 ` Bob Peterson
2021-01-19 15:23 ` Andreas Gruenbacher
2021-01-19 15:44 ` Bob Peterson
2021-01-19 17:36 ` Andreas Gruenbacher
2021-01-19 18:18 ` Bob Peterson
2021-01-19 20:14 ` Andreas Gruenbacher
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=1734775184.38918835.1608691657308.JavaMail.zimbra@redhat.com \
--to=rpeterso@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).