[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080725195437.GA15807@kaboom.dhcp.chi.wms.com>
Date: Fri, 25 Jul 2008 14:54:37 -0500
From: Chris Fester <cfester@....com>
To: linux-kernel@...r.kernel.org
Subject: ROMFS error reading 0 byte files
Hi,
I've been poking around at a problem I've been having with the
latest kernels and romfs. The symptom is getting an Input/output
error when reading a zero length file:
# find . -size 0
./usr/lib/gconv/gconv-modules.cache
# cat ./usr/lib/gconv/gconv-modules.cache
cat: ./usr/lib/gconv/gconv-modules.cache: Input/output error
The problem seems to have occurred somewhere between 2.6.22 and
2.6.23. Not much changed in the romfs code then, but the
mm/filemap.c had a bit of changes. Personally I saw this problem
with Debian Lenny kernels 2.6.24 and 2.6.25. Looking at the
kernel.org source I suspect the problem is still in 2.6.26.
I'm not a filesystem or mm expert, but I would like to get a good
solution going... if it means I get more familiar with mm and
filesystems then so be it. :)
Matt Waddel proposed this patch back in November of 2007 on the
uclinux-dev mail list:
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index dae7945..ed04d73 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -430,7 +430,7 @@ romfs_readpage(struct file *file, struct page * page)
/* 32 bit warning -- but not for us :) */
offset = page_offset(page);
- if (offset < i_size_read(inode)) {
+ if (offset <= i_size_read(inode)) {
avail = inode->i_size-offset;
readlen = min_t(unsigned long, avail, PAGE_SIZE);
if (romfs_copyfrom(inode, buf, ROMFS_I(inode)->i_dataoffset+offset, readlen) == readlen) {
I mailed Matt recently and he's been using this patch for a while now
with no failures.
I'm not sure if this patch is the best solution. I was looking at
cramfs's inode.c:cramfs_readpage, and it looks like it's structured
a little more optimally in the 0 length case.
For reference to the original discussion, see the uclinux-dev mail list:
http://mailman.uclinux.org/pipermail/uclinux-dev/2007-December/044836.html
Since the maintainer for romfs seems to have moved on, could someone with
vfs knowledge please direct me on what I should do next? The company I
work for uses romfs extensively in their products. So far they've been
lucky because the newest kernel being used is 2.6.18. But there's
rumblings to upgrade to a newer kernel, and I'd like to be prepared with
a good solid fix in mainline rather than patching.
Thanks in advance for any help!
Chris Fester
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists