Re: [PATCH] Avoid a NULL pointer in btrfs

2011-01-20 Thread Liuwenyi

于 2011-1-19 23:52, Chris Mason 写道:

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 never
happen.
It is rare and hard to reproduced. So, I update this patch, just avoid a 
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
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] 2.6.35 btrfs oops at extent_range_uptodate

2011-01-19 Thread Liuwenyi


于 2011-1-19 14:27, Yang Ruirui 写道:

Boot with meego kernel 2.6.35.9-6.5-adaptation-n900 on n900, an oops happend, I 
see similar reporting in lkml:
https://lkml.org/lkml/2010/8/26/103

I just happened once, so I don't know hot to reproduce it.

`addr2line -e vmlinux 0xc0197888` show
fs/btrfs/extent_io.c:3358

  ret = test_range_bit(tree, eb-start, eb-start + eb-len - 1,
EXTENT_UPTODATE, 1, cached_state);
Maybe, this is caused by (tree==null). We can add a judgement in 
test_tange_bit to avoid this situation.

3[ 7872.955352] mmcblk0: error -9 sending status comand
3[ 7872.960083] mmcblk0: error -9 sending read/write command, response 0x0, 
card status 0x0
3[ 7872.968383] mmcblk0: error -9 transferring data, sector 89484, nr 4, card 
status 0x0
3[ 7872.977142] end_request: I/O error, dev mmcblk0, sector 89484
3[ 7872.984466] mmcblk0: error -9 sending status comand
3[ 7872.989257] mmcblk0: error -9 sending read/write command, response 0x0, 
card status 0x0
3[ 7872.998535] mmcblk0: error -9 transferring data, sector 89485, nr 3, card 
status 0x0
3[ 7873.007019] end_request: I/O error, dev mmcblk0, sector 89485
3[ 7873.012878] mmcblk0: error -9 sending status comand
3[ 7873.017669] mmcblk0: error -9 sending read/write command, response 0x0, 
card status 0x0
3[ 7873.025939] mmcblk0: error -9 transferring data, sector 89486, nr 2, card 
status 0x0
3[ 7873.040283] end_request: I/O error, dev mmcblk0, sector 89486
3[ 7873.046203] mmcblk0: error -9 sending status comand
3[ 7873.050994] mmcblk0: error -9 sending read/write command, response 0x0, 
card status 0x0
3[ 7873.059265] mmcblk0: error -9 transferring data, sector 89487, nr 1, card 
status 0x0
3[ 7873.067108] end_request: I/O error, dev mmcblk0, sector 89487
1[ 7873.073120] Unable to handle kernel NULL pointer dereference at virtual 
address 
1[ 7873.082031] pgd = c0004000
1[ 7873.084747] [] *pgd=
0[ 7873.088439] Internal error: Oops: 17 [#1] PREEMPT
0[ 7873.093170] last sysfs file: 
/sys/devices/platform/isp1704_charger.0/power_supply/isp1704/online
4[ 7873.102020] Modules linked in: rfcomm sco wl1251_spi wl1251 cmt_speech 
ssi_protocol mac80211 cmt hsi_char smc91x tsl2563(C) isp1704_charger leds_lp5523 
lis3lv02d_i2c cfg80211 power_supply led_class rtc_twl industrialio(C) omap_ssi 
lis3lv02d mii input_polldev crc7 bnep l2cap hci_h4p bluetooth gpio_keys omaplfb 
pvrsrvkm g_nokia vfat fat
4[ 7873.132232] CPU: 0Tainted: G C   
(2.6.35.9-6.5-adaptation-n900 #1)
4[ 7873.139495] PC is at extent_range_uptodate+0x5c/0x9c
4[ 7873.144531] LR is at lock_release+0x38/0x48
4[ 7873.148742] pc : [c0197888]lr : [c007cbc4]psr: 6013
4[ 7873.148742] sp : cffcbf00  ip : 0001  fp : 
4[ 7873.160278] r10: 023b2dff  r9 :   r8 : 1000
4[ 7873.165557] r7 : 0001  r6 : cf909908  r5 :   r4 : 023b2000
4[ 7873.172119] r3 :   r2 :   r1 : 0001  r0 : 
4[ 7873.178680] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment 
kernel
4[ 7873.186035] Control: 10c5387d  Table: 8ffe8019  DAC: 0017
0[ 7873.191833] Process btrfs-endio-met (pid: 475, stack limit = 0xcffca2e8)
0[ 7873.198577] Stack: (0xcffcbf00 to 0xcffcc000)
0[ 7873.202972] bf00: 023b2dff  0004 0001  cff9feec 
 023b1e00
0[ 7873.211212] bf20:  c300cc60 cff413e0   023b2dff 
 c016cf44
0[ 7873.219421] bf40: 023b2dff  023b1000  cff9feec cff413c0 
cff78000 0001
0[ 7873.227661] bf60: cff9fec0 cff9fec0 cffca000 cffcbf88 cff413e0 cff9fecc 
 cff9fec4
0[ 7873.235900] bf80:  c01a038c cffcbf88 cffcbf88 cffcbf90 cffcbf90 
cff81ef4 c01a0308
0[ 7873.244140] bfa0: cff9fec0 0013    c006b8f8 
 
0[ 7873.252380] bfc0:  0001 dead4ead   c0503878 
 c042f88a
0[ 7873.260620] bfe0: cffcbfe0 cffcbfe0 cff81ef4 c006b874 c002e980 c002e980 
00801000 
4[ 7873.268859] [c0197888] (extent_range_uptodate+0x5c/0x9c) from 
[c016cf44] (end_workqueue_fn+0x11c/0x174)
4[ 7873.278686] [c016cf44] (end_workqueue_fn+0x11c/0x174) from [c01a038c] 
(worker_loop+0x84/0x320)
4[ 7873.287719] [c01a038c] (worker_loop+0x84/0x320) from [c006b8f8] 
(kthread+0x84/0x8c)
4[ 7873.295806] [c006b8f8] (kthread+0x84/0x8c) from [c002e980] 
(kernel_thread_exit+0x0/0x8)
0[ 7873.304229] Code: e1a01624 e5960008 e1811a05 ebfc1508 (e5907000)
4[ 7873.320831] ---[ end trace e366e719494232ee ]---
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH]btrfs: avoid comparing with NULL pointer

2010-01-27 Thread Liuwenyi

于 2010年01月27日 16:00, Yan, Zheng 写道:

2010/1/27 Liuwenyiqingshen...@gmail.com:
   

In this patch, I adjust the seqence of if-conditions.
It will assess the page-private situation.
First, we make sure the page-private is not null.
And then, we can do some with this page-private.

---
Signed-off-by: Liuwenyiqingshen...@gmail.com
Cc: Chris Masonchris.ma...@oracle.com
Cc: Yan Zhengzheng@oracle.com
Cc: Josef Bacikjba...@redhat.com
Cc: Jens Axboejens.ax...@oracle.com
Cc: linux-btrfs@vger.kernel.org
Cc: linux-ker...@vger.kernel.org

---
fs/btrfs/disk-io.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 009e3bd..a300dca 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1407,11 +1407,11 @@ static int bio_ready_for_csum(struct bio *bio)

bio_for_each_segment(bvec, bio, i) {
page = bvec-bv_page;
- if (page-private == EXTENT_PAGE_PRIVATE) {
+ if (!page-private) {
length += bvec-bv_len;
continue;
}
- if (!page-private) {
+ if (page-private == EXTENT_PAGE_PRIVATE) {
length += bvec-bv_len;
continue;
}
--
 

Why do you want to do this? The code is perfect safe even
page-private is NULL. Furthermore, your patch is malformed.

Yan, Zheng
   

Yes, I agree with you, this code is safe.
But I think we should check whether the pointer is available first.
It is unnecessary judge the (page-private == EXTENT_PAGE_PRIVATE)
while page-private is null.


---
Best Regards,
Liuwenyi
2010-1-27

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH]btrfs: avoid comparing with NULL pointer

2010-01-26 Thread Liuwenyi
In this patch, I adjust the seqence of if-conditions.
It will assess the page-private situation.
First, we make sure the page-private is not null.
And then, we can do some with this page-private.

---
Signed-off-by: Liuwenyi qingshen...@gmail.com
Cc: Chris Mason chris.ma...@oracle.com
Cc: Yan Zheng zheng@oracle.com
Cc: Josef Bacik jba...@redhat.com
Cc: Jens Axboe jens.ax...@oracle.com
Cc: linux-btrfs@vger.kernel.org
Cc: linux-ker...@vger.kernel.org

---
fs/btrfs/disk-io.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 009e3bd..a300dca 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1407,11 +1407,11 @@ static int bio_ready_for_csum(struct bio *bio)

bio_for_each_segment(bvec, bio, i) {
page = bvec-bv_page;
- if (page-private == EXTENT_PAGE_PRIVATE) {
+ if (!page-private) {
length += bvec-bv_len;
continue;
}
- if (!page-private) {
+ if (page-private == EXTENT_PAGE_PRIVATE) {
length += bvec-bv_len;
continue;
}
-- 
1.6.6


---
Best Regards,
Liuwenyi
2010-01-277
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Unable to handle kernel NULL pointer dereference at virtual address 00000008

2010-01-21 Thread Liuwenyi

于 2010-1-21 16:57, Sander 写道:

Hello Tomasz,

Tomasz Torcz wrote (ao):
   

On Thu, Jan 21, 2010 at 07:07:10AM +0100, Sander wrote:
 

[26678.568532] [c026c294] (btrfs_get_acl+0x60/0x250) from [c026c494] 
(btrfs_xattr_get_acl+0x10/0x70)
[26678.577802] [c026c494] (btrfs_xattr_get_acl+0x10/0x70) from [c019bb20] 
(generic_getxattr+0x78/0x7c)
[26678.587243] [c019bb20] (generic_getxattr+0x78/0x7c) from [c019c01c] 
(vfs_getxattr+0x58/0x5c)
[26678.596074] [c019c01c] (vfs_getxattr+0x58/0x5c) from [c019c0c4] 
(getxattr+0xa4/0x11c)
[26678.604298] [c019c0c4] (getxattr+0xa4/0x11c) from [c019c220] 
(sys_getxattr+0x44/0x58)
[26678.612525] [c019c220] (sys_getxattr+0x44/0x58) from [c0122e20] 
(ret_fast_syscall+0x0/0x28)
   

   Although your oops is in btrfs_get_acl(), you may need similar fix
as done for btrfs_set_acl() in this commit:

   
http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-unstable.git;a=commitdiff;h=a9cc71a60c29a09174bee2fcef8f924c529fd4b7
 

Thanks, that makes sense.

Unfortunately I'm no kernel hacker so I can't provide a patch. I'm more
than happy to test patches of course.

With kind regards, Sander

   


I remember that the lastest git pull had fixed this bug, it was Chris 
Mason's patch.


--
Best Regards,
Liuwenyi

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC INFO PATCH 02/03] export use_mm and unuse_mm for filesystem modules.

2010-01-19 Thread Liuwenyi

Maybe, you should send this patch to

Andrew Morton a...@linux-foundation.org
Andrea Arcangeli aarca...@redhat.com
Michael S. Tsirkin m...@redhat.com
linux-ker...@vger.kernel.org
linux...@kvack.org


于 2010年01月20日 05:58, jim owens 写道:

required for btrfs directio worker threads.

Signed-off-by: jim owensjow...@hp.com
---
mm/mmu_context.c |3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mm/mmu_context.c b/mm/mmu_context.c
index ded9081..daabf4d 100644
--- a/mm/mmu_context.c
+++ b/mm/mmu_context.c
@@ -3,6 +3,7 @@
  * See ../COPYING for licensing terms.
  */

+#includelinux/module.h
#includelinux/mm.h
#includelinux/mmu_context.h
#includelinux/sched.h
@@ -37,6 +38,7 @@ void use_mm(struct mm_struct *mm)
 if (active_mm != mm)
 mmdrop(active_mm);
}
+EXPORT_SYMBOL_GPL(use_mm);

/*
  * unuse_mm
@@ -56,3 +58,4 @@ void unuse_mm(struct mm_struct *mm)
 enter_lazy_tlb(mm, tsk);
 task_unlock(tsk);
}
+EXPORT_SYMBOL_GPL(unuse_mm);
   


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs development git tree

2010-01-08 Thread Liuwenyi

于 2010-1-8 20:41, Simon Schubert 写道:

Hey,

I apologize for this ignorant question upfront, but:

Where can I find a current btrfs git repo?  The one linked from the wiki
(I think cmason's unstable tree) did not update in the last 3 weeks, and
I don't think nothing happened since then.  Maybe the wiki could list
also alternative repos from other developers?

thanks
   simon

   


Maybe there is no suitable patch accepted by community.
You can search the maillist in past 3 weeks or more and find it out.

--
Best Regards,
Liuwenyi

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv2 02/12]posix_acl: Add the check items

2009-12-21 Thread Liuwenyi
move the ACL validation check in to fs/posix_acl.c.
Including nullpointer check and PTR_ERR check.


---
Signed-off-by: Liuwenyi qingshen...@gmail.com
Cc: Chris Mason chris.ma...@oracle.com
Cc: Al Viro v...@zeniv.linux.org.uk
Cc: Joel Becker joel.bec...@oracle.com
Cc: Chris Ball c...@laptop.org
Cc: James Morris jmor...@namei.org
Cc: linux-btrfs@vger.kernel.org
Cc: linux-ker...@vger.kernel.org

---
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index 2e9e699..0f14f95 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -102,12 +102,9 @@ static int btrfs_set_acl(struct btrfs_trans_handle
*trans,
char *value = NULL;
mode_t mode;

- if (acl) {
- ret = posix_acl_valid(acl);
- if (ret  0)
- return ret;
- ret = 0;
- }
+ ret = posix_acl_valid(acl);
+ if (ret  0)
+ return ret;

switch (type) {
case ACL_TYPE_ACCESS:

-- 
Best Regards,
Liuwenyi

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html