From: tristan <tristan.ye@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle invalid lock_res in lockres_seq_start() for dlmdebug.c
Date: Fri, 10 Sep 2010 09:42:13 +0800 [thread overview]
Message-ID: <4C898CF5.7000903@oracle.com> (raw)
In-Reply-To: <4C898952.20705@oracle.com>
Sunil Mushran wrote:
> On 09/09/2010 06:20 PM, tristan wrote:
>>>> 1 files changed, 7 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
>>>> index 5efdd37..06d668a 100644
>>>> --- a/fs/ocfs2/dlm/dlmdebug.c
>>>> +++ b/fs/ocfs2/dlm/dlmdebug.c
>>>> @@ -639,6 +639,12 @@ static void *lockres_seq_start(struct seq_file
>>>> *m, loff_t *pos)
>>>> else
>>>> track_list =&dlm->tracking_list;
>>>>
>>>> + if (list_empty(track_list)) {
>>>> + dl = NULL;
>>>> + spin_unlock(&dlm->track_lock);
>>>> + goto bail;
>>>> + }
>>>> +
>>>
>>> You should add this check as part of the else block above so
>>> that we check for empty list only at the start.
>> fs/ocfs2/dlm/dlmdebug.c | 7 +++++++
>>
>> So we just don't need to check list 'oldres->tracking'?
>
> If you see how it works, it prints one lock resource at a time. As in,
> each time _start is called, it fetches the next lock resource in the
> tracking
> list. So the empty list should be checked only at the very beginning.
>
> To be fair, your code should also work. If the list has even one lockres,
> it cannot, by definition, be empty. But adding it in the if block
> makes the
> check explicit and clean. IMHO.
That makes pretty sense, we just need to check the list at the time of
getting its head:)
My check was making the logic clumsy, thanks for correction.
prev parent reply other threads:[~2010-09-10 1:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-09 9:16 [Ocfs2-devel] [PATCH 1/1] Ocfs2: Handle invalid lock_res in lockres_seq_start() for dlmdebug.c Tristan Ye
2010-09-09 16:59 ` Sunil Mushran
2010-09-10 1:20 ` tristan
2010-09-10 1:26 ` Sunil Mushran
2010-09-10 1:42 ` tristan [this message]
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=4C898CF5.7000903@oracle.com \
--to=tristan.ye@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.