All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] Wake up down-convert thread when clearing OCFS2_LOCK_UPCONVERT_FINISHING from ocfs2_lock_res.l_flags
Date: Wed, 14 Sep 2011 18:41:28 -0700	[thread overview]
Message-ID: <4E7157C8.8090606@oracle.com> (raw)
In-Reply-To: <201109130913.p8D9DehZ013352@acsmt357.oracle.com>

Instead of passing osb, just wakeup_dc from the 5 locations.
Cleaner that-a-way.

On 09/13/2011 02:13 AM, Wengang Wang wrote:
> In down convert thread, when the ocfs2_lock_res is in OCFS2_LOCK_UPCONVERT_FINISHING
> state, it is requeued for next run of ocfs2_downconvert_thread_do_work(). If not
> waked up, the DC thread just sleep there without even there are ocfs2_lock_res' left
> in the list.
>
> So when clearing the OCFS2_LOCK_UPCONVERT_FINISHING flag, we need also to wake up dc
> thread accordingly.
>
> Signed-off-by: Wengang Wang<wen.gang.wang@oracle.com>
> ---
>   fs/ocfs2/dlmglue.c |   18 +++++++++++-------
>   1 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index 7642d7c..9e86d79 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
> @@ -359,7 +359,8 @@ static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *loc
>   static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres, int level);
>   static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
>   					struct ocfs2_lock_res *lockres);
> -static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
> +static inline void ocfs2_recover_from_dlm_error(struct ocfs2_super *osb,
> +						struct ocfs2_lock_res *lockres,
>   						int convert);
>   #define ocfs2_log_dlm_error(_func, _err, _lockres) do {					\
>   	if ((_lockres)->l_type != OCFS2_LOCK_TYPE_DENTRY)				\
> @@ -1191,7 +1192,8 @@ void ocfs2_set_locking_protocol(void)
>   	ocfs2_stack_glue_set_max_proto_version(&lproto.lp_max_version);
>   }
>
> -static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
> +static inline void ocfs2_recover_from_dlm_error(struct ocfs2_super *osb,
> +						struct ocfs2_lock_res *lockres,
>   						int convert)
>   {
>   	unsigned long flags;
> @@ -1206,6 +1208,7 @@ static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
>   	spin_unlock_irqrestore(&lockres->l_lock, flags);
>
>   	wake_up(&lockres->l_event);
> +	ocfs2_wake_downconvert_thread(osb);
>   }
>
>   /* Note: If we detect another process working on the lock (i.e.,
> @@ -1246,7 +1249,7 @@ static int ocfs2_lock_create(struct ocfs2_super *osb,
>   	lockres_clear_pending(lockres, gen, osb);
>   	if (ret) {
>   		ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres);
> -		ocfs2_recover_from_dlm_error(lockres, 1);
> +		ocfs2_recover_from_dlm_error(osb, lockres, 1);
>   	}
>
>   	mlog(0, "lock %s, return from ocfs2_dlm_lock\n", lockres->l_name);
> @@ -1478,7 +1481,7 @@ again:
>   				ocfs2_log_dlm_error("ocfs2_dlm_lock",
>   						    ret, lockres);
>   			}
> -			ocfs2_recover_from_dlm_error(lockres, 1);
> +			ocfs2_recover_from_dlm_error(osb, lockres, 1);
>   			goto out;
>   		}
>
> @@ -1502,6 +1505,7 @@ unlock:
>   	lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
>
>   	spin_unlock_irqrestore(&lockres->l_lock, flags);
> +	ocfs2_wake_downconvert_thread(osb);
>   out:
>   	/*
>   	 * This is helping work around a lock inversion between the page lock
> @@ -1891,7 +1895,7 @@ int ocfs2_file_lock(struct file *file, int ex, int trylock)
>   			ret = -EINVAL;
>   		}
>
> -		ocfs2_recover_from_dlm_error(lockres, 1);
> +		ocfs2_recover_from_dlm_error(osb, lockres, 1);
>   		lockres_remove_mask_waiter(lockres,&mw);
>   		goto out;
>   	}
> @@ -3264,7 +3268,7 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
>   	lockres_clear_pending(lockres, generation, osb);
>   	if (ret) {
>   		ocfs2_log_dlm_error("ocfs2_dlm_lock", ret, lockres);
> -		ocfs2_recover_from_dlm_error(lockres, 1);
> +		ocfs2_recover_from_dlm_error(osb, lockres, 1);
>   		goto bail;
>   	}
>
> @@ -3312,7 +3316,7 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb,
>   			       DLM_LKF_CANCEL);
>   	if (ret) {
>   		ocfs2_log_dlm_error("ocfs2_dlm_unlock", ret, lockres);
> -		ocfs2_recover_from_dlm_error(lockres, 0);
> +		ocfs2_recover_from_dlm_error(osb, lockres, 0);
>   	}
>
>   	mlog(ML_BASTS, "lockres %s\n", lockres->l_name);

  reply	other threads:[~2011-09-15  1:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13  9:13 [Ocfs2-devel] [PATCH] Wake up down-convert thread when clearing OCFS2_LOCK_UPCONVERT_FINISHING from ocfs2_lock_res.l_flags Wengang Wang
2011-09-15  1:41 ` Sunil Mushran [this message]
2011-09-15  1:49   ` Wengang Wang

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=4E7157C8.8090606@oracle.com \
    --to=sunil.mushran@oracle.com \
    --cc=ocfs2-devel@oss.oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.