* PATCH for reiserfs, max 2GB in version 3.5
@ 2005-10-13 12:38 Manfred Scherer
2005-10-14 11:01 ` David R
0 siblings, 1 reply; 3+ messages in thread
From: Manfred Scherer @ 2005-10-13 12:38 UTC (permalink / raw)
To: reiserfs-dev; +Cc: linux-kernel
If we create a file greater than 2GB in a reiserfs v3.5,
the file size will not be checked and the file can be
created like this:
pc1:/mnt_hdg10 # dd if=/dev/zero of=zero_3GB.dd bs=1024 count=3000000
3000000+0 records in
3000000+0 records out
pc1:/mnt_hdg10 #
The command "ls -l" shows the file size as created above:
pc1:/mnt_hdg10 # ls -l zero_3GB.dd
-rw-r--r-- 1 root root 3072000000 Oct 3 15:59 zero_3GB.dd
pc1:/mnt_hdg10 #
When we read this file, read will abort when the 2GB border is reached:
pc1:/mnt_hdg10 # dd if=zero_3GB.dd of=/dev/null bs=1024
dd: reading `zero_3GB.dd': Input/output error
2097152+0 records in
2097152+0 records out
pc1:/mnt_hdg10 #
A file system check does not help,
the command "reiserfsck --fix-fixable /dev/hdg10"
spit out this massage:
/zero_3GB.ddvpf-10670: The file [2 23061] has the wrong size in the
StatData (3072000000) - corrected to (3072000000)
BTW this file can be delete with the command "rm zero_3GB.dd".
The same test in a reiserfs v3.5 with a file greater than 4GB will end
in more trouble.
You can test this like:
pc1:/mnt_hdg10 # dd if=/dev/zero of=zero_5GB.dd bs=1024 count=5000000
---------------------------------------------------------------------------
A simple check will avoid to create files greater than 2GB in reiserfs v3.5,
see patch below:
---------------------------------------------------------------------------
--- linux-2.6.13/fs/reiserfs/file.c.ORIG 2005-08-29
01:41:01.000000000 +0200
+++ linux-2.6.13/fs/reiserfs/file.c 2005-10-11 11:41:23.000000000 +0200
@@ -1343,10 +1343,14 @@
down(&inode->i_sem); // locks the entire file for just us
pos = *ppos;
+ // 2005-10-07 --ms, max 2GB on v3.5
+ if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5)
+ file->f_flags &= ~O_LARGEFILE; // for LFS rule in
generic_write_checks()
+
/* Check if we can write to specified region of file, file
is not overly big and this kind of stuff. Adjust pos and
count, if needed */
res = generic_write_checks(file, &pos, &count, 0);
if (res)
Signed-off-by: Manfred Scherer <manfred.scherer.mhm@t-online.de>
-------------------------------------------------------------------------
BTW the 2.4 kernel will have the same problem.
fs/reiserfs/file.c:
static ssize_t
reiserfs_file_write(struct file *f, const char *b, size_t count, loff_t
*ppos)
{
ssize_t ret;
struct inode *inode = f->f_dentry->d_inode;
+ // 2005-10-07 --ms, max 2GB on v 3.5
+ if (get_inode_item_key_version(inode) == KEY_FORMAT_3_5)
+ file->f_flags &= ~O_LARGEFILE; // for LFS rule in
precheck_file_write()
+
ret = generic_file_write(f, b, count, ppos);
if (ret >= 0 && f->f_flags & O_SYNC) {
lock_kernel();
reiserfs_commit_for_inode(inode);
unlock_kernel();
}
return ret;
}
-------------------------------------------------------------------------
Manfred Scherer
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH for reiserfs, max 2GB in version 3.5
2005-10-13 12:38 PATCH for reiserfs, max 2GB in version 3.5 Manfred Scherer
@ 2005-10-14 11:01 ` David R
2005-10-14 11:13 ` David R
0 siblings, 1 reply; 3+ messages in thread
From: David R @ 2005-10-14 11:01 UTC (permalink / raw)
To: Manfred Scherer; +Cc: reiserfs-dev, linux-kernel
Quoting Manfred Scherer <Manfred.Scherer.Mhm@t-online.de>:
> If we create a file greater than 2GB in a reiserfs v3.5,
> the file size will not be checked and the file can be
> created like this:
>
I'm confused. I've got lots of video files > 2GB using Reiser 3
m@server:/mnt/raid/> dd if=051008-19.04.05.mpg of=/dev/null bs=1024
2573276+1 records in
2573276+1 records out
m@server:/mnt/raid/> ls -l 051008-19.04.05.mpg
-rw-r--r-- 1 m users 2635034636 2005-10-08 21:15 051008-19.04.05.mpg
that seem to work just fine?
David.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH for reiserfs, max 2GB in version 3.5
2005-10-14 11:01 ` David R
@ 2005-10-14 11:13 ` David R
0 siblings, 0 replies; 3+ messages in thread
From: David R @ 2005-10-14 11:13 UTC (permalink / raw)
To: Manfred Scherer; +Cc: reiserfs-dev, linux-kernel
Quoting David R <david@unsolicited.net>:
> I'm confused. I've got lots of video files > 2GB using Reiser 3
>
That would be a key format 3.6 volume. Sorry for the noise.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-10-14 11:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-13 12:38 PATCH for reiserfs, max 2GB in version 3.5 Manfred Scherer
2005-10-14 11:01 ` David R
2005-10-14 11:13 ` David R
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox