linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <mason@suse.com>
From: Jeff Mahoney <jeffm@suse.com>
To: akpm@osdl.org, linux-fsdevel@vger.kernel.org, reiserfs-list@namesys.com
Subject: [patch 6/6] reiserfs v3 patches
Subject: [patch 6/6] reiserfs: check for files > 2GB on 3.5.x disks
Date: Sun, 15 Jan 2006 19:50:08 -0500	[thread overview]
Message-ID: <20060116005314.959522000@watt.suse.com> (raw)
In-Reply-To: 20060116005002.398989000@watt.suse.com

[-- Attachment #1: reiserfs-old-format-size.diff --]
[-- Type: text/plain, Size: 1335 bytes --]

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.

diff -r ee81eb208598 fs/reiserfs/file.c
--- a/fs/reiserfs/file.c	Fri Jan 13 14:01:37 2006 -0500
+++ b/fs/reiserfs/file.c	Fri Jan 13 14:08:12 2006 -0500
@@ -1285,6 +1285,23 @@ static ssize_t reiserfs_file_write(struc
 	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)

--

      parent reply	other threads:[~2006-01-16  0:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-16  0:50 [patch 0/6] reiserfs v3 patches Chris Mason
2006-01-16  0:50 ` [patch 1/6] reiserfs v3 patches, [patch 1/6] fix reiserfs_invalidatepage race against data=ordered Chris Mason, Chris Mason
2006-01-16  0:50 ` [patch 2/6] reiserfs v3 patches, [patch 2/6] Zero b_private when allocating buffer heads Chris Mason, Chris Mason
2006-01-16  0:50 ` [patch 3/6] reiserfs v3 patches, [patch 3/6] reiserfs hang and performance fix for data=journal mode Chris Mason, Chris Mason
2006-01-16  0:50 ` [patch 4/6] reiserfs v3 patches, [patch 4/6] reiserfs write_ordered_buffers should not oops on dirty non-uptodate bh Chris Mason, Chris Mason
2006-01-16  0:50 ` [patch 5/6] reiserfs v3 patches, [patch 5/6] reiserfs fix journal accounting in journal_transaction_should_end Chris Mason, Chris Mason
2006-01-16  0:50 ` Chris Mason, Jeff Mahoney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060116005314.959522000@watt.suse.com \
    --to=mason@suse.com \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=reiserfs-list@namesys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).