cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 6/8] gfs2: Rework freeze / thaw logic
Date: Tue, 13 Jun 2023 15:33:15 +0200	[thread overview]
Message-ID: <CAHc6FU4_Z-AsHHLNk6Qg_nCwYEDL2s92sCt8oMvWTq8cogAV0g@mail.gmail.com> (raw)
In-Reply-To: <CAK-6q+i4yy8-T1SPVC=nwQQNtszxzP+uqsG7Jx4zNz44mPqjXA@mail.gmail.com>

On Tue, Jun 13, 2023 at 3:05?PM Alexander Aring <aahringo@redhat.com> wrote:
> Hi Andreas,
>
> On Mon, Jun 12, 2023 at 12:33?PM Andreas Gruenbacher
> <agruenba@redhat.com> wrote:
> ...
> >
> > @@ -152,24 +151,18 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
> >          */
> >         clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
> >         if (!sb_rdonly(sdp->sd_vfs)) {
> > -               struct gfs2_holder freeze_gh;
> > -
> > -               gfs2_holder_mark_uninitialized(&freeze_gh);
> > -               if (sdp->sd_freeze_gl &&
> > -                   !gfs2_glock_is_locked_by_me(sdp->sd_freeze_gl)) {
> > -                       ret = gfs2_freeze_lock_shared(sdp, &freeze_gh,
> > -                                       log_write_allowed ? 0 : LM_FLAG_TRY);
> > -                       if (ret == GLR_TRYFAILED)
> > -                               ret = 0;
> > -               }
> > -               if (!ret)
> > -                       gfs2_make_fs_ro(sdp);
> > +               bool locked = mutex_trylock(&sdp->sd_freeze_mutex);
> > +
> > +               gfs2_make_fs_ro(sdp);
> > +
> > +               if (locked)
> > +                       mutex_unlock(&sdp->sd_freeze_mutex);
>
> I am not sure if I overlooked something here, for me it looks like the
> application does not care about if sd_freeze_mutex is locked or not
> because the introduced locked boolean will never be evaluated?
>
> What am I missing here?

This is to withdraw the filesystem. We're trying to acquire
sd_freeze_mutex to prevent local races, but if we can't get it, we
still go ahead and mark the filesystem read-only. Then we unlock
sd_freeze_mutex, but only if we've locked it before. This is a bit
ugly, but I don't have any better ideas right now.

Thanks,
Andreas


  reply	other threads:[~2023-06-13 13:33 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 16:33 [Cluster-devel] [PATCH 0/8] gfs2: Rework freeze / thaw logic Andreas Gruenbacher
2023-06-12 16:33 ` [Cluster-devel] [PATCH 1/8] gfs2: Rename remaining "transaction" glock references Andreas Gruenbacher
2023-06-12 16:33 ` [Cluster-devel] [PATCH 2/8] gfs2: Rename the {freeze, thaw}_super callbacks Andreas Gruenbacher
2023-06-12 16:33 ` [Cluster-devel] [PATCH 3/8] gfs2: Rename gfs2_freeze_lock{ => _shared } Andreas Gruenbacher
2023-06-12 16:33 ` [Cluster-devel] [PATCH 4/8] gfs2: Reconfiguring frozen filesystem already rejected Andreas Gruenbacher
2023-06-12 16:33 ` [Cluster-devel] [PATCH 5/8] gfs2: Rename SDF_{FS_FROZEN => FREEZE_INITIATOR} Andreas Gruenbacher
2023-06-12 16:33 ` [Cluster-devel] [PATCH 6/8] gfs2: Rework freeze / thaw logic Andreas Gruenbacher
2023-06-13 10:28   ` Andrew Price
2023-06-13 12:49     ` Andreas Gruenbacher
2023-06-13 13:05   ` Alexander Aring
2023-06-13 13:33     ` Andreas Gruenbacher [this message]
2023-06-12 16:33 ` [Cluster-devel] [PATCH 7/8] gfs2: Replace sd_freeze_state with SDF_FROZEN flag Andreas Gruenbacher
2023-06-12 16:33 ` [Cluster-devel] [PATCH 8/8] gfs2: gfs2_freeze_lock_shared cleanup 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=CAHc6FU4_Z-AsHHLNk6Qg_nCwYEDL2s92sCt8oMvWTq8cogAV0g@mail.gmail.com \
    --to=agruenba@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 read-only IMAP folder(s) and NNTP newsgroup(s).