summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2006-02-01 03:06:51 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-01 08:53:26 -0800
commitfa385bef256077f3b820b241e8f3755ef3905b74 (patch)
tree5bf0dee3b1a6bbf001ba912d8463740126be47ee /fs
parent6ae1ea447d21c4fecf5df8d0e1022461274fb4e8 (diff)
downloadlinux-3.10-fa385bef256077f3b820b241e8f3755ef3905b74.tar.gz
linux-3.10-fa385bef256077f3b820b241e8f3755ef3905b74.tar.bz2
linux-3.10-fa385bef256077f3b820b241e8f3755ef3905b74.zip
[PATCH] reiserfs: reiserfs: check for files > 2GB on 3.5.x disks
When a filesystem has been converted from 3.5.x to 3.6.x, we need an extra check during file write to make sure we are not trying to make a 3.5.x file > 2GB. Signed-off-by: Chris Mason <mason@suse.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/reiserfs/file.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 1cad5d066a5..f3473176c83 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -1287,6 +1287,23 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
struct reiserfs_transaction_handle th;
th.t_trans_id = 0;
+ /* If a filesystem is converted from 3.5 to 3.6, we'll have v3.5 items
+ * lying around (most of the disk, in fact). Despite the filesystem
+ * now being a v3.6 format, the old items still can't support large
+ * file sizes. Catch this case here, as the rest of the VFS layer is
+ * oblivious to the different limitations between old and new items.
+ * reiserfs_setattr catches this for truncates. This chunk is lifted
+ * from generic_write_checks. */
+ if (get_inode_item_key_version (inode) == KEY_FORMAT_3_5 &&
+ *ppos + count > MAX_NON_LFS) {
+ if (*ppos >= MAX_NON_LFS) {
+ send_sig(SIGXFSZ, current, 0);
+ return -EFBIG;
+ }
+ if (count > MAX_NON_LFS - (unsigned long)*ppos)
+ count = MAX_NON_LFS - (unsigned long)*ppos;
+ }
+
if (file->f_flags & O_DIRECT) { // Direct IO needs treatment
ssize_t result, after_file_end = 0;
if ((*ppos + count >= inode->i_size)