From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [GFS2 PATCH] [TRY #2] GFS2: Prevent recovery before the local journal is set
Date: Wed, 07 May 2014 11:56:59 +0100 [thread overview]
Message-ID: <536A117B.2070001@redhat.com> (raw)
In-Reply-To: <256959012.14056298.1399039517312.JavaMail.zimbra@redhat.com>
Hi,
On 02/05/14 15:05, Bob Peterson wrote:
> Hi,
>
> This patch uses a completion to prevent dlm's recovery process from
> referencing and trying to recover a journal before a journal has been
> opened.
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
There is one possible issue that I can see, which is the error case. If
we have some error that occurs prior to getting to the complete_all()
will we land up with a process that has requested recovery waiting
forever? If we can resolve that, then I think this should be good to go,
Steve.
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
> index bdf70c1..04c062c 100644
> --- a/fs/gfs2/incore.h
> +++ b/fs/gfs2/incore.h
> @@ -730,6 +730,8 @@ struct gfs2_sbd {
> struct gfs2_holder sd_sc_gh;
> struct gfs2_holder sd_qc_gh;
>
> + struct completion sd_journal_ready;
> +
> /* Daemon stuff */
>
> struct task_struct *sd_logd_process;
> diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
> index 22f9540..4535156 100644
> --- a/fs/gfs2/ops_fstype.c
> +++ b/fs/gfs2/ops_fstype.c
> @@ -94,6 +94,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
> INIT_LIST_HEAD(&sdp->sd_jindex_list);
> spin_lock_init(&sdp->sd_jindex_spin);
> mutex_init(&sdp->sd_jindex_mutex);
> + init_completion(&sdp->sd_journal_ready);
>
> INIT_LIST_HEAD(&sdp->sd_quota_list);
> mutex_init(&sdp->sd_quota_mutex);
> @@ -676,6 +677,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
>
> if (sdp->sd_args.ar_spectator) {
> sdp->sd_jdesc = gfs2_jdesc_find(sdp, 0);
> + complete_all(&sdp->sd_journal_ready);
> atomic_set(&sdp->sd_log_blks_free, sdp->sd_jdesc->jd_blocks);
> atomic_set(&sdp->sd_log_thresh1, 2*sdp->sd_jdesc->jd_blocks/5);
> atomic_set(&sdp->sd_log_thresh2, 4*sdp->sd_jdesc->jd_blocks/5);
> @@ -686,10 +688,13 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
> fs_err(sdp, "there are only %u journals (0 - %u)\n",
> gfs2_jindex_size(sdp),
> gfs2_jindex_size(sdp) - 1);
> + complete_all(&sdp->sd_journal_ready);
> goto fail_jindex;
> }
> sdp->sd_jdesc = gfs2_jdesc_find(sdp, sdp->sd_lockstruct.ls_jid);
>
> + complete_all(&sdp->sd_journal_ready);
> +
> error = gfs2_glock_nq_num(sdp, sdp->sd_lockstruct.ls_jid,
> &gfs2_journal_glops,
> LM_ST_EXCLUSIVE, LM_FLAG_NOEXP,
> diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
> index de25d55..02afa82 100644
> --- a/fs/gfs2/sys.c
> +++ b/fs/gfs2/sys.c
> @@ -407,6 +407,9 @@ int gfs2_recover_set(struct gfs2_sbd *sdp, unsigned jid)
> struct gfs2_jdesc *jd;
> int rv;
>
> + /* Wait for our primary journal to be initialized */
> + wait_for_completion(&sdp->sd_journal_ready);
> +
> spin_lock(&sdp->sd_jindex_spin);
> rv = -EBUSY;
> if (sdp->sd_jdesc->jd_jid == jid)
>
next prev parent reply other threads:[~2014-05-07 10:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1427204217.14054872.1399039419168.JavaMail.zimbra@redhat.com>
2014-05-02 14:05 ` [Cluster-devel] [GFS2 PATCH] [TRY #2] GFS2: Prevent recovery before the local journal is set Bob Peterson
2014-05-07 10:56 ` Steven Whitehouse [this message]
2014-05-22 13:17 ` [Cluster-devel] [GFS2 PATCH] [TRY #3] " Bob Peterson
2014-05-22 13:32 ` Steven Whitehouse
2014-06-02 13:40 ` [Cluster-devel] [GFS2 PATCH] [TRY #4] " Bob Peterson
2014-06-02 19:49 ` Steven Whitehouse
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=536A117B.2070001@redhat.com \
--to=swhiteho@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).