Re: [PATCH] cramfs corruption after BLKFLSBUF on loop device

From: Chris Mason
Date: Thu Jun 01 2006 - 16:16:11 EST


On Thursday 01 June 2006 14:49, Olaf Hering wrote:
> This script will cause cramfs decompression errors, on SMP at least:
>
> #!/bin/bash
> while :;do blockdev --flushbufs /dev/loop0;done </dev/null &>/dev/null&
> while :;do ps faxs </dev/null &>/dev/null&done </dev/null &>/dev/null&
> while :;do dmesg </dev/null &>/dev/null&done </dev/null &>/dev/null&
> while :;do find /mounts/instsys -type f -print0|xargs -0 cat
> &>/dev/null;done

It looks as though:

* cramfs_readpage is synchronous
* cramfs_readpage always returns an up to date page
* cramfs data doesn't change
* read_cache_page as called by cramfs will always return a page that was
up to date at one time, or an error.

I think this will work (but have not tested it). Another option is to create
a read_cache_page that pins the page via a page flag
that invalidate_mapping_pages will honor.

-chris

diff -r a1a07af2d0cd fs/cramfs/inode.c
--- a/fs/cramfs/inode.c Thu Jun 01 10:45:04 2006 -0400
+++ b/fs/cramfs/inode.c Thu Jun 01 15:04:39 2006 -0400
@@ -190,18 +190,6 @@ static void *cramfs_read(struct super_bl
pages[i] = page;
}

- for (i = 0; i < BLKS_PER_BUF; i++) {
- struct page *page = pages[i];
- if (page) {
- wait_on_page_locked(page);
- if (!PageUptodate(page)) {
- /* asynchronous error */
- page_cache_release(page);
- pages[i] = NULL;
- }
- }
- }
-
buffer = next_buffer;
next_buffer = NEXT_BUFFER(buffer);
buffer_blocknr[buffer] = blocknr;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/