* [PATCH] jbd2: Move bdget out of critical section
@ 2011-04-02 9:01 Zhu Yanhai
2011-04-03 9:40 ` Jan Kara
2011-04-04 16:36 ` Ted Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Zhu Yanhai @ 2011-04-02 9:01 UTC (permalink / raw)
To: linux-ext4; +Cc: Andrew Morton, Jan Kara, Zhu Yanhai
bdget() should not be called when we hold spinlocks since
it might sleep.
Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com>
---
fs/jbd2/journal.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 90407b8..33dd3ef 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2413,10 +2413,12 @@ const char *jbd2_dev_to_name(dev_t device)
new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL);
if (!new_dev)
return "NODEV-ALLOCFAILURE"; /* Something non-NULL */
+ bd = bdget(device);
spin_lock(&devname_cache_lock);
if (devcache[i]) {
if (devcache[i]->device == device) {
kfree(new_dev);
+ bdput(bd);
ret = devcache[i]->devname;
spin_unlock(&devname_cache_lock);
return ret;
@@ -2425,7 +2427,6 @@ const char *jbd2_dev_to_name(dev_t device)
}
devcache[i] = new_dev;
devcache[i]->device = device;
- bd = bdget(device);
if (bd) {
bdevname(bd, devcache[i]->devname);
bdput(bd);
--
1.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] jbd2: Move bdget out of critical section
2011-04-02 9:01 [PATCH] jbd2: Move bdget out of critical section Zhu Yanhai
@ 2011-04-03 9:40 ` Jan Kara
2011-04-04 16:36 ` Ted Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2011-04-03 9:40 UTC (permalink / raw)
To: Zhu Yanhai; +Cc: linux-ext4, Andrew Morton, Jan Kara, Zhu Yanhai, tytso
On Sat 02-04-11 17:01:16, Zhu Yanhai wrote:
> bdget() should not be called when we hold spinlocks since
> it might sleep.
>
> Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com>
Looks good.
Acked-by: Jan Kara <jack@suse.cz>
PS: Added Ted to CC since he merges JBD2 patches.
Honza
> ---
> fs/jbd2/journal.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 90407b8..33dd3ef 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -2413,10 +2413,12 @@ const char *jbd2_dev_to_name(dev_t device)
> new_dev = kmalloc(sizeof(struct devname_cache), GFP_KERNEL);
> if (!new_dev)
> return "NODEV-ALLOCFAILURE"; /* Something non-NULL */
> + bd = bdget(device);
> spin_lock(&devname_cache_lock);
> if (devcache[i]) {
> if (devcache[i]->device == device) {
> kfree(new_dev);
> + bdput(bd);
> ret = devcache[i]->devname;
> spin_unlock(&devname_cache_lock);
> return ret;
> @@ -2425,7 +2427,6 @@ const char *jbd2_dev_to_name(dev_t device)
> }
> devcache[i] = new_dev;
> devcache[i]->device = device;
> - bd = bdget(device);
> if (bd) {
> bdevname(bd, devcache[i]->devname);
> bdput(bd);
> --
> 1.7.4
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] jbd2: Move bdget out of critical section
2011-04-02 9:01 [PATCH] jbd2: Move bdget out of critical section Zhu Yanhai
2011-04-03 9:40 ` Jan Kara
@ 2011-04-04 16:36 ` Ted Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Ted Ts'o @ 2011-04-04 16:36 UTC (permalink / raw)
To: Zhu Yanhai; +Cc: linux-ext4, Andrew Morton, Jan Kara, Zhu Yanhai
On Sat, Apr 02, 2011 at 05:01:16PM +0800, Zhu Yanhai wrote:
> bdget() should not be called when we hold spinlocks since
> it might sleep.
>
> Signed-off-by: Zhu Yanhai <gaoyang.zyh@taobao.com>
I've added the patch to the patch queue. Technically we should never
have a problem, though, since we only use this for the journal inode,
which is not going to be a fresly created inode. So I don't think we
should ever hit the paths that will result in the kernel sleeping.
But I agree it's better to move it out, if for no other reason to make
life easier for static checkers.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-04 16:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-02 9:01 [PATCH] jbd2: Move bdget out of critical section Zhu Yanhai
2011-04-03 9:40 ` Jan Kara
2011-04-04 16:36 ` Ted Ts'o
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).