From 656743e8c32c581559430f45141e093986b3e2ec Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Wed, 1 Feb 2006 03:06:51 -0800 Subject: [PATCH] --- yaml --- r: 19461 b: refs/heads/master c: fa385bef256077f3b820b241e8f3755ef3905b74 h: refs/heads/master i: 19459: e5201f9d794411a7a1c0d5366cac50d27401ebd2 v: v3 --- [refs] | 2 +- trunk/fs/reiserfs/file.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 1719d0442716..a4a1bdd38a1d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6ae1ea447d21c4fecf5df8d0e1022461274fb4e8 +refs/heads/master: fa385bef256077f3b820b241e8f3755ef3905b74 diff --git a/trunk/fs/reiserfs/file.c b/trunk/fs/reiserfs/file.c index 1cad5d066a5c..f3473176c83a 100644 --- a/trunk/fs/reiserfs/file.c +++ b/trunk/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)