* Re: Kernel Ooops when using kdesu
2010-10-07 20:35 "Sven Müller"
@ 2010-10-08 9:22 ` Edward Shishkin
0 siblings, 0 replies; 4+ messages in thread
From: Edward Shishkin @ 2010-10-08 9:22 UTC (permalink / raw)
To: Sven Müller; +Cc: reiserfs-devel
[-- Attachment #1: Type: text/plain, Size: 4745 bytes --]
Sven Müller wrote:
> Hi Edward,
>
> according to the advice in Gentoo Forums:
>
> http://forums.gentoo.org/viewtopic-t-845764.html
>
> I'll send you the bug report.
>
Hello.
Could you please try the attached patch and report about results?
Thanks,
Edward.
> Behaviour:
> When I try start a program via kdesu (KDE4) I'll get a Kernel Ooops. It's reproducible. The Ooops occurs on x86 and amd64. I've tested it on 2.6.34 and on 2.6.35 (r1 and r5). And until now it seems that only kdesu is affected.
>
> Configuration:
> Kernel: Gentoo-Sources-2.6.35-r5
> Root Device is Reiser4
> Reiser4 Patch is from Kernel.org (Reiser4-for-2.6.35.patch)
> CPU: x86
> The Posting in Gentoo Forums (Link) is from a amd64.
>
> /var/log/messages:
>
> Oct 7 22:26:32 localhost kernel: BUG: unable to handle kernel NULL pointer dereference at (null)
> Oct 7 22:26:32 localhost kernel: IP: [<c01b846a>] checkin_logical_cluster+0xb1/0x176
> Oct 7 22:26:32 localhost kernel: *pde = 00000000
> Oct 7 22:26:32 localhost kernel: Oops: 0000 [#1]
> Oct 7 22:26:32 localhost kernel: last sysfs file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
> Oct 7 22:26:32 localhost kernel: Modules linked in: pcmcia
> Oct 7 22:26:32 localhost kernel:
> Oct 7 22:26:32 localhost kernel: Pid: 2306, comm: kio_file Not tainted 2.6.35-gentoo-r5 #2 Latitude C610 /Latitude C610
> Oct 7 22:26:32 localhost kernel: EIP: 0060:[<c01b846a>] EFLAGS: 00010246 CPU: 0
> Oct 7 22:26:32 localhost kernel: EIP is at checkin_logical_cluster+0xb1/0x176
> Oct 7 22:26:32 localhost kernel: EAX: 00000001 EBX: c9176d58 ECX: 00000000 EDX: 00000000
> Oct 7 22:26:32 localhost kernel: ESI: 00000000 EDI: 00000000 EBP: cb572eb4 ESP: c9176d14
> Oct 7 22:26:32 localhost kernel: DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
> Oct 7 22:26:32 localhost kernel: Process kio_file (pid: 2306, ti=c9176000 task=cb376360 task.ti=c9176000)
> Oct 7 22:26:32 localhost kernel: Stack:
> Oct 7 22:26:32 localhost kernel: 00000000 c9176d58 00000000 cb572eb4 00000000 c9176d58 00000000 cb572eb4
> Oct 7 22:26:32 localhost kernel: <0> 00000000 c01bacff 00000000 c9192100 00000000 0000000d cb572eb4 c01baf36
> Oct 7 22:26:32 localhost kernel: <0> fffffff4 00000000 00000000 00000000 00000000 00000001 00000000 00000000
> Oct 7 22:26:32 localhost kernel: Call Trace:
> Oct 7 22:26:32 localhost kernel: [<c01bacff>] ? capture_page_cluster+0xa2/0xc7
> Oct 7 22:26:32 localhost kernel: [<c01baf36>] ? write_end_cryptcompress+0x212/0x222
> Oct 7 22:26:32 localhost kernel: [<c01b7455>] ? reiser4_write_end_careful+0xe8/0x153
> Oct 7 22:26:32 localhost kernel: [<c0148127>] ? pagecache_write_end+0x37/0x3e
> Oct 7 22:26:32 localhost kernel: [<c01ac107>] ? reiser4_dirty_inode+0x8/0x59
> Oct 7 22:26:32 localhost kernel: [<c017c356>] ? pipe_to_file+0x109/0x114
> Oct 7 22:26:32 localhost kernel: [<c01ac107>] ? reiser4_dirty_inode+0x8/0x59
> Oct 7 22:26:32 localhost kernel: [<c01ac107>] ? reiser4_dirty_inode+0x8/0x59
> Oct 7 22:26:32 localhost kernel: [<c017b3ff>] ? splice_from_pipe_feed+0x31/0x9e
> Oct 7 22:26:32 localhost kernel: [<c017c24d>] ? pipe_to_file+0x0/0x114
> Oct 7 22:26:32 localhost kernel: [<c017c1c0>] ? generic_file_splice_write+0xa2/0x12f
> Oct 7 22:26:32 localhost kernel: [<c017c11e>] ? generic_file_splice_write+0x0/0x12f
> Oct 7 22:26:32 localhost kernel: [<c017bca0>] ? vfs_splice_from+0x53/0x5a
> Oct 7 22:26:32 localhost kernel: [<c017c093>] ? direct_splice_actor+0x14/0x18
> Oct 7 22:26:32 localhost kernel: [<c017bb35>] ? splice_direct_to_actor+0xbe/0x172
> Oct 7 22:26:32 localhost kernel: [<c017c07f>] ? direct_splice_actor+0x0/0x18
> Oct 7 22:26:32 localhost kernel: [<c017bc34>] ? do_splice_direct+0x4b/0x64
> Oct 7 22:26:32 localhost kernel: [<c0166440>] ? do_sendfile+0x16c/0x1b5
> Oct 7 22:26:32 localhost kernel: [<c01664c9>] ? sys_sendfile64+0x40/0x86
> Oct 7 22:26:32 localhost kernel: [<c0102510>] ? sysenter_do_call+0x12/0x26
> Oct 7 22:26:32 localhost kernel: Code: 01 74 09 31 f6 83 f8 02 75 1e eb 05 8b 73 3c eb 17 8b 43 0c 31 ff 8b 70 04 03 30 81 c6 ff 0f 00 00 83 d7 00 0f ac fe 0c 8b 7b 48 <8b> 07 f6 c4 01 74 24 89 e8 e8 2f 4a fe ff e8 ac a3 fe ff 8b 4b
> Oct 7 22:26:32 localhost kernel: EIP: [<c01b846a>] checkin_logical_cluster+0xb1/0x176 SS:ESP 0068:c9176d14
> Oct 7 22:26:32 localhost kernel: CR2: 0000000000000000
> Oct 7 22:26:32 localhost kernel: ---[ end trace 401667030bed02db ]---
>
>
> addr2line -e /usr/src/linux/vmlinux -i c01b846a:
>
> /usr/src/linux/fs/reiser4/plugin/file/cryptcompress.c:1722
> /usr/src/linux/fs/reiser4/plugin/file/cryptcompress.c:1780
>
> Let me know if you need any further information. I would be glad if I could help you.
>
> Thx
> Sven
>
[-- Attachment #2: reiser4-fix-write_begin_end_aops.patch --]
[-- Type: text/plain, Size: 5175 bytes --]
Fix write_end_cryptcompress():
update i_size, if pos + count > old i_size.
Signed-off-by: Edward Shishkin <edward.shishkin@gmail.com>
---
fs/reiser4/plugin/file/cryptcompress.c | 47 +++++++++++++++++++++++--------
fs/reiser4/plugin/file/file.c | 2 -
fs/reiser4/plugin/file/file.h | 4 +-
fs/reiser4/plugin/file/file_conversion.c | 6 ---
fs/reiser4/plugin/plugin.h | 2 -
5 files changed, 41 insertions(+), 20 deletions(-)
--- linux-2.6.35.orig/fs/reiser4/plugin/file/cryptcompress.c
+++ linux-2.6.35/fs/reiser4/plugin/file/cryptcompress.c
@@ -3749,13 +3749,14 @@ int write_begin_cryptcompress(struct fil
/* plugin->commit_write */
int write_end_cryptcompress(struct file *file, struct page *page,
- unsigned from, unsigned to)
+ loff_t pos, unsigned copied)
{
- int ret;
+ int ret = 0;
hint_t *hint;
lock_handle *lh;
struct inode * inode;
struct cluster_handle clust;
+ struct reiser4_slide *win = NULL;
unlock_page(page);
@@ -3769,17 +3770,41 @@ int write_end_cryptcompress(struct file
cluster_init_read(&clust, NULL);
clust.hint = hint;
- ret = alloc_cluster_pgset(&clust, cluster_nrpages(inode));
- if (ret)
- goto out;
- clust.index = pg_to_clust(page->index, inode);
- ret = capture_page_cluster(&clust, inode);
- if (ret)
- warning("edward-1557",
- "Capture failed (inode %llu, result=%i)",
- (unsigned long long)get_inode_oid(inode), ret);
+ if (pos + copied > inode->i_size) {
+ win = kmalloc(sizeof(*win), reiser4_ctx_gfp_mask_get());
+ if (win == NULL)
+ goto out;
+ /* make sure there is no holes */
+ assert("edward-xxx", pos <= inode->i_size);
+ ret = set_cluster_by_window(inode, &clust, win, copied, pos);
+ if (ret)
+ goto out;
+ ret = capture_page_cluster(&clust, inode);
+ if (ret) {
+ warning("edward-xxx",
+ "Capture failed (inode %llu, result=%i)",
+ (unsigned long long)get_inode_oid(inode), ret);
+ goto out;
+ }
+ /* FIXME-EDWARD:
+ reserve space for update_sd in write_begin() */
+ ret = update_sd_cryptcompress(inode);
+ }
+ else {
+ ret = alloc_cluster_pgset(&clust, cluster_nrpages(inode));
+ if (ret)
+ goto out;
+ clust.index = pg_to_clust(page->index, inode);
+ ret = capture_page_cluster(&clust, inode);
+ if (ret)
+ warning("edward-1557",
+ "Capture failed (inode %llu, result=%i)",
+ (unsigned long long)get_inode_oid(inode), ret);
+ }
out:
done_lh(lh);
+ if (win)
+ kfree(win);
kfree(hint);
put_cluster_handle(&clust);
return ret;
--- linux-2.6.35.orig/fs/reiser4/plugin/file/file.c
+++ linux-2.6.35/fs/reiser4/plugin/file/file.c
@@ -893,7 +893,7 @@ static int capture_page_and_create_exten
/* plugin->write_end() */
int write_end_unix_file(struct file *file, struct page *page,
- unsigned from, unsigned to)
+ loff_t pos, unsigned copied)
{
unlock_page(page);
return capture_page_and_create_extent(page);
--- linux-2.6.35.orig/fs/reiser4/plugin/file/file.h
+++ linux-2.6.35/fs/reiser4/plugin/file/file.h
@@ -97,7 +97,7 @@ int writepages_unix_file(struct address_
int write_begin_unix_file(struct file *file, struct page *page,
unsigned from, unsigned to);
int write_end_unix_file(struct file *file, struct page *page,
- unsigned from, unsigned to);
+ loff_t pos, unsigned copied);
sector_t bmap_unix_file(struct address_space *, sector_t lblock);
/* other private methods */
@@ -137,7 +137,7 @@ int writepages_cryptcompress(struct addr
int write_begin_cryptcompress(struct file *file, struct page *page,
unsigned from, unsigned to);
int write_end_cryptcompress(struct file *file, struct page *page,
- unsigned from, unsigned to);
+ loff_t pos, unsigned copied);
sector_t bmap_cryptcompress(struct address_space *, sector_t lblock);
/* other private methods */
--- linux-2.6.35.orig/fs/reiser4/plugin/file/file_conversion.c
+++ linux-2.6.35/fs/reiser4/plugin/file/file_conversion.c
@@ -694,16 +694,12 @@ int reiser4_write_end_careful(struct fil
{
int ret;
reiser4_context *ctx;
- unsigned start, end;
struct inode *inode = page->mapping->host;
assert("umka-3101", file != NULL);
assert("umka-3102", page != NULL);
assert("umka-3093", PageLocked(page));
- start = pos & (PAGE_CACHE_SIZE - 1);
- end = start + len;
-
flush_dcache_page(page);
SetPageUptodate(page);
@@ -713,7 +709,7 @@ int reiser4_write_end_careful(struct fil
ret = PTR_ERR(ctx);
goto out;
}
- ret = PROT_PASSIVE(int, write_end, (file, page, start, end));
+ ret = PROT_PASSIVE(int, write_end, (file, page, pos, copied));
/* don't commit transaction under inode semaphore */
context_set_commit_async(ctx);
--- linux-2.6.35.orig/fs/reiser4/plugin/plugin.h
+++ linux-2.6.35/fs/reiser4/plugin/plugin.h
@@ -251,7 +251,7 @@ typedef struct file_plugin {
int (*write_begin)(struct file *file, struct page *page,
unsigned from, unsigned to);
int (*write_end)(struct file *file, struct page *page,
- unsigned from, unsigned to);
+ loff_t pos, unsigned copied);
sector_t (*bmap) (struct address_space * mapping, sector_t lblock);
/* other private methods */
/* save inode cached stat-data onto disk. It was called
^ permalink raw reply [flat|nested] 4+ messages in thread