[Cluster-devel] [PATCH 2/3] gfs2: Dequeue waiters when withdrawn

Andreas Gruenbacher agruenba at redhat.com
Tue Aug 2 14:47:26 UTC 2022


On Wed, Jul 27, 2022 at 6:24 PM Bob Peterson <rpeterso at redhat.com> wrote:
> When a withdraw occurs, ordinary (not system) glocks may not be granted
> anymore. This patch takes measures to remove any pending waiters from
> the glocks that will never be granted.

You kind of explain why this patch is useful in the cover letter, but
not here. Could you please add that description here?

Thanks,
Andreas

> Signed-off-by: Bob Peterson <rpeterso at redhat.com>
> ---
>  fs/gfs2/glock.c | 14 ++++++++++++++
>  fs/gfs2/glock.h |  1 +
>  fs/gfs2/util.c  |  5 +++++
>  3 files changed, 20 insertions(+)
>
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index e540d1290099..0bfecffd71f1 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -2223,6 +2223,20 @@ static void dump_glock_func(struct gfs2_glock *gl)
>         dump_glock(NULL, gl, true);
>  }
>
> +static void withdraw_dq(struct gfs2_glock *gl)
> +{
> +       spin_lock(&gl->gl_lockref.lock);
> +       if (!__lockref_is_dead(&gl->gl_lockref) &&
> +           glock_blocked_by_withdraw(gl))
> +               do_error(gl, LM_OUT_ERROR); /* remove pending waiters */
> +       spin_unlock(&gl->gl_lockref.lock);
> +}
> +
> +void gfs2_gl_dq_holders(struct gfs2_sbd *sdp)
> +{
> +       glock_hash_walk(withdraw_dq, sdp);
> +}
> +
>  /**
>   * gfs2_gl_hash_clear - Empty out the glock hash table
>   * @sdp: the filesystem
> diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
> index c0ae9100a0bc..d6fc449aa7ff 100644
> --- a/fs/gfs2/glock.h
> +++ b/fs/gfs2/glock.h
> @@ -273,6 +273,7 @@ extern void gfs2_cancel_delete_work(struct gfs2_glock *gl);
>  extern bool gfs2_delete_work_queued(const struct gfs2_glock *gl);
>  extern void gfs2_flush_delete_work(struct gfs2_sbd *sdp);
>  extern void gfs2_gl_hash_clear(struct gfs2_sbd *sdp);
> +extern void gfs2_gl_dq_holders(struct gfs2_sbd *sdp);
>  extern void gfs2_glock_finish_truncate(struct gfs2_inode *ip);
>  extern void gfs2_glock_thaw(struct gfs2_sbd *sdp);
>  extern void gfs2_glock_add_to_lru(struct gfs2_glock *gl);
> diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
> index 78cb12d0fba1..acf94c83b29b 100644
> --- a/fs/gfs2/util.c
> +++ b/fs/gfs2/util.c
> @@ -164,6 +164,11 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
>                 }
>                 if (!ret)
>                         gfs2_make_fs_ro(sdp);
> +               /*
> +                * Dequeue any pending non-system glock holders that can no
> +                * longer be granted because the file system is withdrawn.
> +                */
> +               gfs2_gl_dq_holders(sdp);
>                 gfs2_freeze_unlock(&freeze_gh);
>         }
>
> --
> 2.36.1
>



More information about the Cluster-devel mailing list