[PATCH] I/O Error attempting to read last partial block of a file in an ISO9660 file system

There was an I/O error that prevented reading the last partial block of
large files in an ISO9660 filesystem.  The error was generated when a file
comprised more than one section and had a size that was not an exact
multiple of the filesystem block size.  This patch removes the check (and
failure) for reading into the last partial block (and possibly beyond) for
multiple-section files.

It worked in my testing to prevent reading beyond the end of the section;
my first patch just incremented the sect_size block count for a partial
block and continued doing the check.  But there is a commment in the source
code about reading beyond the end of the file to fill a page cache.
Failing to access beyond the section would prevent reading beyond the end
of the file.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Joel & Rebecca VanderZee 2006-09-29 02:00:30 -07:00 committed by Linus Torvalds
parent e4b765551a
commit fb50ae7446

View file

@ -960,13 +960,14 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
goto abort;
}
if (nextblk) {
while (b_off >= (offset + sect_size)) {
/* On the last section, nextblk == 0, section size is likely to
* exceed sect_size by a partial block, and access beyond the
* end of the file will reach beyond the section size, too.
*/
while (nextblk && (b_off >= (offset + sect_size))) {
struct inode *ninode;
offset += sect_size;
if (nextblk == 0)
goto abort;
ninode = isofs_iget(inode->i_sb, nextblk, nextoff);
if (!ninode)
goto abort;
@ -985,7 +986,6 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
goto abort;
}
}
}
if ( *bh ) {
map_bh(*bh, inode->i_sb, firstext + b_off - offset);