mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Fester <cfester@wms.com>
To: linux-kernel@vger.kernel.org
Subject: ROMFS error reading 0 byte files
Date: Fri, 25 Jul 2008 14:54:37 -0500	[thread overview]
Message-ID: <20080725195437.GA15807@kaboom.dhcp.chi.wms.com> (raw)

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


                 reply	other threads:[~2008-07-25 20:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080725195437.GA15807@kaboom.dhcp.chi.wms.com \
    --to=cfester@wms.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®