* [PATCH] Avoid a NULL pointer in btrfs
@ 2011-01-19 14:08 Liuwenyi
2011-01-19 14:14 ` Josef Bacik
0 siblings, 1 reply; 4+ messages in thread
From: Liuwenyi @ 2011-01-19 14:08 UTC (permalink / raw)
To: strongzgy, onlyflyer, linux-btrfs, linux-kernel, ak, akpm, miaox,
josef
In Yang Ruirui's mail, the btrfs will create a oops. This is caused by a
null pointer in test_range_bit() while lock the spinlock.
So, It is necessary to add a pointer check into test_range_bit()
---
Signed-off-by: Liu Wenyi <qingshenlwy@gmail.com>
---
fs/btrfs/extent_io.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 5e7a94d..0da42b5 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1553,6 +1553,9 @@ int test_range_bit(struct extent_io_tree *tree,
u64 start, u64 end,
struct rb_node *node;
int bitset = 0;
+ if (tree == NULL)
+ return bitset;
+
spin_lock(&tree->lock);
if (cached && cached->tree && cached->start == start)
node = &cached->rb_node;
--
1.7.3.3
---
Best Regards,
Liu Wenyi
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Avoid a NULL pointer in btrfs
2011-01-19 14:08 [PATCH] Avoid a NULL pointer in btrfs Liuwenyi
@ 2011-01-19 14:14 ` Josef Bacik
2011-01-19 15:52 ` Chris Mason
0 siblings, 1 reply; 4+ messages in thread
From: Josef Bacik @ 2011-01-19 14:14 UTC (permalink / raw)
To: Liuwenyi
Cc: strongzgy, onlyflyer, linux-btrfs, linux-kernel, ak, akpm, miaox,
josef, chris.mason, Yang Ruirui, meego-kernel
On Wed, Jan 19, 2011 at 10:08:13PM +0800, Liuwenyi wrote:
> In Yang Ruirui's mail, the btrfs will create a oops. This is caused by a
> null pointer in test_range_bit() while lock the spinlock.
>
> So, It is necessary to add a pointer check into test_range_bit()
>
NAK, the tree shouldn't be null coming into this function, something else is
going wrong. What oops is this? Thanks,
Josef
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Avoid a NULL pointer in btrfs
2011-01-19 14:14 ` Josef Bacik
@ 2011-01-19 15:52 ` Chris Mason
2011-01-20 12:26 ` Liuwenyi
0 siblings, 1 reply; 4+ messages in thread
From: Chris Mason @ 2011-01-19 15:52 UTC (permalink / raw)
To: Josef Bacik
Cc: Liuwenyi, strongzgy, onlyflyer, linux-btrfs, linux-kernel, ak,
akpm, miaox, Yang Ruirui, meego-kernel
Excerpts from Josef Bacik's message of 2011-01-19 09:14:02 -0500:
> On Wed, Jan 19, 2011 at 10:08:13PM +0800, Liuwenyi wrote:
> > In Yang Ruirui's mail, the btrfs will create a oops. This is caused by a
> > null pointer in test_range_bit() while lock the spinlock.
> >
> > So, It is necessary to add a pointer check into test_range_bit()
> >
>
>
> NAK, the tree shouldn't be null coming into this function, something else is
> going wrong. What oops is this? Thanks,
What was your metadata blocksize for this oops? This call should never
happen.
I think there is a larger problem, probably in the IO error handling
code since the trace had io errors beforehand.
-chris
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Avoid a NULL pointer in btrfs
2011-01-19 15:52 ` Chris Mason
@ 2011-01-20 12:26 ` Liuwenyi
0 siblings, 0 replies; 4+ messages in thread
From: Liuwenyi @ 2011-01-20 12:26 UTC (permalink / raw)
To: Chris Mason
Cc: Josef Bacik, strongzgy, onlyflyer, linux-btrfs, linux-kernel, ak,
akpm, miaox, Yang Ruirui, meego-kernel
=E4=BA=8E 2011-1-19 23:52, Chris Mason =E5=86=99=E9=81=93:
> Excerpts from Josef Bacik's message of 2011-01-19 09:14:02 -0500:
>> On Wed, Jan 19, 2011 at 10:08:13PM +0800, Liuwenyi wrote:
>>> In Yang Ruirui's mail, the btrfs will create a oops. This is caused=
by a
>>> null pointer in test_range_bit() while lock the spinlock.
>>>
>>> So, It is necessary to add a pointer check into test_range_bit()
>>>
>>
>> NAK, the tree shouldn't be null coming into this function, something=
else is
>> going wrong. What oops is this? Thanks,
The mail is here http://lkml.org/lkml/2011/1/19/24
another mesg is here http://www.aei.mpg.de/~crmafra/dmesg-2.6.35.3.txt
> What was your metadata blocksize for this oops? This call should nev=
er
> happen.
It is rare and hard to reproduced. So, I update this patch, just avoid =
a=20
null pointer calling.
> I think there is a larger problem, probably in the IO error handling
> code since the trace had io errors beforehand.
Yes, I agree. This situation is too strange to happen.
> -chris
---
Best Regards,
Liu Wenyi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-20 12:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-19 14:08 [PATCH] Avoid a NULL pointer in btrfs Liuwenyi
2011-01-19 14:14 ` Josef Bacik
2011-01-19 15:52 ` Chris Mason
2011-01-20 12:26 ` Liuwenyi
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).