* [PATCH] isofs: Fix lseek() to position beyond 4 GB
@ 2010-08-03 21:18 Jan Andres
2010-08-03 21:23 ` Joe Perches
2010-08-04 20:52 ` [PATCH v2] " Jan Andres
0 siblings, 2 replies; 5+ messages in thread
From: Jan Andres @ 2010-08-03 21:18 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-fsdevel
isofs supports files larger than 4 GB by using multi-extent files.
However an lseek() to a position beyond 4 GB in such a file will
fail with EINVAL, because s_maxbytes in the isofs superblock is
initialized to 2^32-1, and generic_file_llseek() checks against
that value.
I therefore suggest increasing the value of s_maxbytes to have
full support for large files in isofs. With multi-extent files, file
size is only limited by the maximum size of the file system (8 TB),
so this seems a reasonable value for s_maxbytes.
Signed-off-by: Jan Andres <jandres@gmx.net>
--- linux-2.6.35-j7/fs/isofs/inode.c.orig 2010-08-02 00:11:14.000000000 +0200
+++ linux-2.6.35-j7/fs/isofs/inode.c 2010-08-03 22:54:38.000000000 +0200
@@ -722,7 +722,12 @@ root_found:
}
s->s_magic = ISOFS_SUPER_MAGIC;
- s->s_maxbytes = 0xffffffff; /* We can handle files up to 4 GB */
+
+ /*
+ * With multi-extent files, file size is only limited by the maximum
+ * size of a file system, which is 8 TB.
+ */
+ s->s_maxbytes = 0x80000000000;
/*
* The CDROM is read-only, has no nodes (devices) on it, and since
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] isofs: Fix lseek() to position beyond 4 GB
2010-08-03 21:18 [PATCH] isofs: Fix lseek() to position beyond 4 GB Jan Andres
@ 2010-08-03 21:23 ` Joe Perches
2010-08-04 20:52 ` [PATCH v2] " Jan Andres
1 sibling, 0 replies; 5+ messages in thread
From: Joe Perches @ 2010-08-03 21:23 UTC (permalink / raw)
To: Jan Andres; +Cc: linux-kernel, linux-fsdevel
On Tue, 2010-08-03 at 23:18 +0200, Jan Andres wrote:
> isofs supports files larger than 4 GB by using multi-extent files.
> However an lseek() to a position beyond 4 GB in such a file will
> fail with EINVAL, because s_maxbytes in the isofs superblock is
> initialized to 2^32-1, and generic_file_llseek() checks against
> that value.
> --- linux-2.6.35-j7/fs/isofs/inode.c.orig 2010-08-02 00:11:14.000000000 +0200
> +++ linux-2.6.35-j7/fs/isofs/inode.c 2010-08-03 22:54:38.000000000 +0200
> + s->s_maxbytes = 0x80000000000;
0x80000000000LL;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] isofs: Fix lseek() to position beyond 4 GB
2010-08-03 21:18 [PATCH] isofs: Fix lseek() to position beyond 4 GB Jan Andres
2010-08-03 21:23 ` Joe Perches
@ 2010-08-04 20:52 ` Jan Andres
2010-09-30 22:14 ` Jan Kara
1 sibling, 1 reply; 5+ messages in thread
From: Jan Andres @ 2010-08-04 20:52 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-fsdevel
isofs supports files larger than 4 GB by using multi-extent files.
However an lseek() to a position beyond 4 GB in such a file will
fail with EINVAL, because s_maxbytes in the isofs superblock is
initialized to 2^32-1, and generic_file_llseek() checks against
that value.
I therefore suggest increasing the value of s_maxbytes to have
full support for large files in isofs. With multi-extent files, file
size is only limited by the maximum size of the file system (8 TB),
so this seems a reasonable value for s_maxbytes.
Signed-off-by: Jan Andres <jandres@gmx.net>
--- linux-2.6.35-j7/fs/isofs/inode.c.orig 2010-08-02 00:11:14.000000000 +0200
+++ linux-2.6.35-j7/fs/isofs/inode.c 2010-08-04 22:49:02.000000000 +0200
@@ -722,7 +722,12 @@ root_found:
}
s->s_magic = ISOFS_SUPER_MAGIC;
- s->s_maxbytes = 0xffffffff; /* We can handle files up to 4 GB */
+
+ /*
+ * With multi-extent files, file size is only limited by the maximum
+ * size of a file system, which is 8 TB.
+ */
+ s->s_maxbytes = 0x80000000000LL;
/*
* The CDROM is read-only, has no nodes (devices) on it, and since
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] isofs: Fix lseek() to position beyond 4 GB
2010-08-04 20:52 ` [PATCH v2] " Jan Andres
@ 2010-09-30 22:14 ` Jan Kara
2010-09-30 22:26 ` Jan Kara
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kara @ 2010-09-30 22:14 UTC (permalink / raw)
To: Jan Andres; +Cc: linux-kernel, linux-fsdevel
On Wed 04-08-10 22:52:46, Jan Andres wrote:
> isofs supports files larger than 4 GB by using multi-extent files.
> However an lseek() to a position beyond 4 GB in such a file will
> fail with EINVAL, because s_maxbytes in the isofs superblock is
> initialized to 2^32-1, and generic_file_llseek() checks against
> that value.
>
> I therefore suggest increasing the value of s_maxbytes to have
> full support for large files in isofs. With multi-extent files, file
> size is only limited by the maximum size of the file system (8 TB),
> so this seems a reasonable value for s_maxbytes.
OK, I had a look into the relevant code and it seems that the isofs
code should properly handle files upto 4TB and with a small fix (attached)
upto 8TB as you claim. So I'll take your patch and merge it with Linus.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
--
>From 258d9d44217700e2a7b513b9a029ad28daeca7b0 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Fri, 1 Oct 2010 00:05:33 +0200
Subject: [PATCH] isofs: Fix isofs_get_blocks for 8TB files
Currently isofs_get_blocks() was limited to handle only 4TB files on 32-bit
architectures because of unnecessary use of iblock variable which was signed
long. Just remove the variable. The error messages that were using this
variable should have rather used b_off anyway because that is the block we
are currently mapping.
Signed-off-by: Jan Kara <jack@suse.cz>
---
fs/isofs/inode.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index d8a68e7..a2de39d 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -962,26 +962,23 @@ static int isofs_statfs (struct dentry *dentry, struct kstatfs *buf)
* or getblk() if they are not. Returns the number of blocks inserted
* (-ve == error.)
*/
-int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
+int isofs_get_blocks(struct inode *inode, sector_t iblock,
struct buffer_head **bh, unsigned long nblocks)
{
- unsigned long b_off;
+ unsigned long b_off = iblock;
unsigned offset, sect_size;
unsigned int firstext;
unsigned long nextblk, nextoff;
- long iblock = (long)iblock_s;
int section, rv, error;
struct iso_inode_info *ei = ISOFS_I(inode);
error = -EIO;
rv = 0;
- if (iblock < 0 || iblock != iblock_s) {
+ if (iblock != b_off) {
printk(KERN_DEBUG "%s: block number too large\n", __func__);
goto abort;
}
- b_off = iblock;
-
offset = 0;
firstext = ei->i_first_extent;
sect_size = ei->i_section_size >> ISOFS_BUFFER_BITS(inode);
@@ -998,8 +995,9 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
* I/O errors.
*/
if (b_off > ((inode->i_size + PAGE_CACHE_SIZE - 1) >> ISOFS_BUFFER_BITS(inode))) {
- printk(KERN_DEBUG "%s: block >= EOF (%ld, %ld)\n",
- __func__, iblock, (unsigned long) inode->i_size);
+ printk(KERN_DEBUG "%s: block >= EOF (%lu, %llu)\n",
+ __func__, b_off,
+ (unsigned long long)inode->i_size);
goto abort;
}
@@ -1025,9 +1023,9 @@ int isofs_get_blocks(struct inode *inode, sector_t iblock_s,
if (++section > 100) {
printk(KERN_DEBUG "%s: More than 100 file sections ?!?"
" aborting...\n", __func__);
- printk(KERN_DEBUG "%s: block=%ld firstext=%u sect_size=%u "
+ printk(KERN_DEBUG "%s: block=%lu firstext=%u sect_size=%u "
"nextblk=%lu nextoff=%lu\n", __func__,
- iblock, firstext, (unsigned) sect_size,
+ b_off, firstext, (unsigned) sect_size,
nextblk, nextoff);
goto abort;
}
--
1.6.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] isofs: Fix lseek() to position beyond 4 GB
2010-09-30 22:14 ` Jan Kara
@ 2010-09-30 22:26 ` Jan Kara
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2010-09-30 22:26 UTC (permalink / raw)
To: Jan Andres; +Cc: linux-kernel, linux-fsdevel
On Fri 01-10-10 00:14:30, Jan Kara wrote:
> On Wed 04-08-10 22:52:46, Jan Andres wrote:
> > isofs supports files larger than 4 GB by using multi-extent files.
> > However an lseek() to a position beyond 4 GB in such a file will
> > fail with EINVAL, because s_maxbytes in the isofs superblock is
> > initialized to 2^32-1, and generic_file_llseek() checks against
> > that value.
> >
> > I therefore suggest increasing the value of s_maxbytes to have
> > full support for large files in isofs. With multi-extent files, file
> > size is only limited by the maximum size of the file system (8 TB),
> > so this seems a reasonable value for s_maxbytes.
> OK, I had a look into the relevant code and it seems that the isofs
> code should properly handle files upto 4TB and with a small fix (attached)
> upto 8TB as you claim. So I'll take your patch and merge it with Linus.
Oops, I now noticed that Al has already merged your patch. OK, so I'll
just merge my fix separately.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-30 22:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-03 21:18 [PATCH] isofs: Fix lseek() to position beyond 4 GB Jan Andres
2010-08-03 21:23 ` Joe Perches
2010-08-04 20:52 ` [PATCH v2] " Jan Andres
2010-09-30 22:14 ` Jan Kara
2010-09-30 22:26 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).