* [PATCH] sysfs superblock read oops
@ 2008-06-24 23:35 Chris Webb
2008-06-25 23:45 ` Neil Brown
0 siblings, 1 reply; 2+ messages in thread
From: Chris Webb @ 2008-06-24 23:35 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid
[-- Attachment #1: Type: text/plain, Size: 1501 bytes --]
Whilst correcting my rdev resize patch to deal with non-persistent metadata,
I noticed that reading from /sys/block/mdX/md/rdY/super when there isn't a
real superblock causes an oops rather than just returning zero length. The
tiny attached patch fixes this.
Best wishes,
Chris.
------------[ cut here ]------------
kernel BUG at fs/sysfs/file.c:126!
invalid opcode: 0000 [#1] PREEMPT SMP
Modules linked in:
Pid: 1263, comm: cat Not tainted (2.6.24.4 #12)
EIP: 0060:[<c01ab41f>] EFLAGS: 00010212 CPU: 1
EIP is at fill_read_buffer+0x6b/0x8c
EAX: 00000001 EBX: 00001000 ECX: 00000000 EDX: f6d30360
ESI: f6cf9940 EDI: f6d303c0 EBP: c06bd20c ESP: f6cabf4c
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process cat (pid: 1263, ti=f6caa000 task=f7cb2570 task.ti=f6caa000)
Stack: 00000000 f6c13300 f6cf9940 00001000 0804d038 c01ab467 c053ed00 c053ed00
f6c13300 0804d038 c053ed00 f6cabfa0 c0173cbf f6cabfa0 f6c13300 f6c13300
fffffff7 0804d038 f6caa000 c0173f57 f6cabfa0 00000000 00000000 00000000
Call Trace:
[<c01ab467>] sysfs_read_file+0x27/0x59
[<c0173cbf>] vfs_read+0x83/0xee
[<c0173f57>] sys_read+0x41/0x67
[<c0103e7a>] sysenter_past_esp+0x5f/0x85
=======================
Code: ed ff ff ff 74 3e 8b 47 18 8b 4e 0c 8b 40 04 89 46 2c 8b 57 14 89 d8 ff 55 00 89 c3 89 f8 e8 cf 08 00 00 81 fb ff 0f 00 00 7e 04 <0f> 0b eb fe 85 db 78 0b c7 46 28 00 00 00 00 89 1e eb 03 89 1c
EIP: [<c01ab41f>] fill_read_buffer+0x6b/0x8c SS:ESP 0068:f6cabf4c
---[ end trace 6abc62061d49b4ad ]---
[-- Attachment #2: linux-2.6.24.4-md-external-super-sysfs.patch --]
[-- Type: text/plain, Size: 647 bytes --]
From: Chris Webb <chris@arachsys.com>
Fix oops on reading from /sys/block/mdX/md/rdY/super when there is no
persistent superblock to read.
Signed-off-by: Chris Webb <chris@arachsys.com>
---
drivers/md/md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1911,7 +1911,7 @@
static ssize_t
super_show(mdk_rdev_t *rdev, char *page)
{
- if (rdev->sb_loaded && rdev->sb_size) {
+ if (rdev->mddev->persistent && rdev->sb_loaded && rdev->sb_size) {
memcpy(page, page_address(rdev->sb_page), rdev->sb_size);
return rdev->sb_size;
} else
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sysfs superblock read oops
2008-06-24 23:35 [PATCH] sysfs superblock read oops Chris Webb
@ 2008-06-25 23:45 ` Neil Brown
0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2008-06-25 23:45 UTC (permalink / raw)
To: Chris Webb; +Cc: linux-raid
On Wednesday June 25, chris@arachsys.com wrote:
> Whilst correcting my rdev resize patch to deal with non-persistent metadata,
> I noticed that reading from /sys/block/mdX/md/rdY/super when there isn't a
> real superblock causes an oops rather than just returning zero length. The
> tiny attached patch fixes this.
You must be using a slightly old kernel. The 'super' sysfs file was removed
on 19th March 2008 and is gone since 2.6.25-rc7.
commit 0e82989d95cc46cc58622381eafa54f7428ee679
Thanks,
NeilBrown
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-25 23:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 23:35 [PATCH] sysfs superblock read oops Chris Webb
2008-06-25 23:45 ` Neil Brown
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).