From: Al Viro <viro@ZenIV.linux.org.uk>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [BUG] fs/dlm: A possible sleep-in-atomic bug in dlm_master_lookup
Date: Sat, 7 Oct 2017 03:26:11 +0100 [thread overview]
Message-ID: <20171007022611.GO21978@ZenIV.linux.org.uk> (raw)
In-Reply-To: <58efdfb6-d18d-cb45-ecd4-4c9b680d7595@163.com>
On Sat, Oct 07, 2017 at 09:59:41AM +0800, Jia-Ju Bai wrote:
> According to fs/dlm/lock.c, the kernel may sleep under a spinlock,
> and the function call path is:
> dlm_master_lookup (acquire the spinlock)
> dlm_send_rcom_lookup_dump
> create_rcom
> dlm_lowcomms_get_buffer
> nodeid2con
> mutex_lock --> may sleep
>
> This bug is found by my static analysis tool and my code review.
Umm... dlm_master_lookup() locking is not nice, but to trigger that
you would need a combination of
* from_nodeid != our_nodeid (or we would've buggered off long before that point)
* dir_nodeid == our_nodeid
* failing dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r)
(success would have the lock dropped)
* succeeding dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r)
* from_master being true
* r->res_master_nodeid != from_nodeid and r->res_master_nodeid == our_nodeid
(the former is follows from the latter, actually)
The last one might or might not be impossible - I'm not familiar with dlm
guts, but it does have
log_error(ls, "from_master %d our_master", from_nodeid);
just before that call, so it's worth a further look.
WARNING: multiple messages have this Message-ID (diff)
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jia-Ju Bai <baijiaju1990@163.com>
Cc: ccaulfie@redhat.com, teigland@redhat.com,
cluster-devel@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [BUG] fs/dlm: A possible sleep-in-atomic bug in dlm_master_lookup
Date: Sat, 7 Oct 2017 03:26:11 +0100 [thread overview]
Message-ID: <20171007022611.GO21978@ZenIV.linux.org.uk> (raw)
In-Reply-To: <58efdfb6-d18d-cb45-ecd4-4c9b680d7595@163.com>
On Sat, Oct 07, 2017 at 09:59:41AM +0800, Jia-Ju Bai wrote:
> According to fs/dlm/lock.c, the kernel may sleep under a spinlock,
> and the function call path is:
> dlm_master_lookup (acquire the spinlock)
> dlm_send_rcom_lookup_dump
> create_rcom
> dlm_lowcomms_get_buffer
> nodeid2con
> mutex_lock --> may sleep
>
> This bug is found by my static analysis tool and my code review.
Umm... dlm_master_lookup() locking is not nice, but to trigger that
you would need a combination of
* from_nodeid != our_nodeid (or we would've buggered off long before that point)
* dir_nodeid == our_nodeid
* failing dlm_search_rsb_tree(&ls->ls_rsbtbl[b].keep, name, len, &r)
(success would have the lock dropped)
* succeeding dlm_search_rsb_tree(&ls->ls_rsbtbl[b].toss, name, len, &r)
* from_master being true
* r->res_master_nodeid != from_nodeid and r->res_master_nodeid == our_nodeid
(the former is follows from the latter, actually)
The last one might or might not be impossible - I'm not familiar with dlm
guts, but it does have
log_error(ls, "from_master %d our_master", from_nodeid);
just before that call, so it's worth a further look.
next prev parent reply other threads:[~2017-10-07 2:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-07 1:59 [Cluster-devel] [BUG] fs/dlm: A possible sleep-in-atomic bug in dlm_master_lookup Jia-Ju Bai
2017-10-07 1:59 ` Jia-Ju Bai
2017-10-07 2:26 ` Al Viro [this message]
2017-10-07 2:26 ` Al Viro
2017-10-09 14:37 ` [Cluster-devel] " David Teigland
2017-10-09 14:37 ` David Teigland
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=20171007022611.GO21978@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
/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.