public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@namesys.com>
To: Kyle Rose <krose+linux-kernel@krose.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Large-file corruption. ReiserFS? VFS?
Date: Fri, 12 Sep 2003 19:39:35 +0400	[thread overview]
Message-ID: <20030912153935.GA2693@namesys.com> (raw)
In-Reply-To: <87r82noyr9.fsf@nausicaa.krose.org>

Hello!

On Thu, Sep 11, 2003 at 04:28:58PM -0400, Kyle Rose wrote:

> However, just as the write completed, the beginning of the file became
> corrupted.  I considered a 4GB problem to be likely, and re-tested

You are absolutely right.
Ther is a reiserfs problem that I just found based on your description.
The patch below should help. Please confirm that it works for you too.
Thanks a lot for the report.

Bye,
    Oleg

===== fs/reiserfs/file.c 1.22 vs edited =====
--- 1.22/fs/reiserfs/file.c	Fri Aug 15 05:17:00 2003
+++ edited/fs/reiserfs/file.c	Fri Sep 12 19:18:53 2003
@@ -779,7 +779,7 @@
     /* Now if all the write area lies past the file end, no point in
        maping blocks, since there is none, so we just zero out remaining
        parts of first and last pages in write area (if needed) */
-    if ( (pos & ~(PAGE_CACHE_SIZE - 1)) > inode->i_size ) {
+    if ( (pos & ~((loff_t)PAGE_CACHE_SIZE - 1)) > inode->i_size ) {
 	if ( from != 0 ) {/* First page needs to be partially zeroed */
 	    char *kaddr = kmap_atomic(prepared_pages[0], KM_USER0);
 	    memset(kaddr, 0, from);
@@ -801,9 +801,9 @@
        we need to allocate (calculated above) */
     /* Mask write position to start on blocksize, we do it out of the
        loop for performance reasons */
-    pos &= ~(inode->i_sb->s_blocksize - 1);
+    pos &= ~((loff_t) inode->i_sb->s_blocksize - 1);
     /* Set cpu key to the starting position in a file (on left block boundary)*/
-    make_cpu_key (&key, inode, 1 + ((pos) & ~(inode->i_sb->s_blocksize - 1)), TYPE_ANY, 3/*key length*/);
+    make_cpu_key (&key, inode, 1 + ((pos) & ~((loff_t) inode->i_sb->s_blocksize - 1)), TYPE_ANY, 3/*key length*/);
 
     reiserfs_write_lock(inode->i_sb); // We need that for at least search_by_key()
     for ( i = 0; i < num_pages ; i++ ) { 

  parent reply	other threads:[~2003-09-12 15:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-11 20:28 Large-file corruption. ReiserFS? VFS? Kyle Rose
     [not found] ` <20030911144732.S18851@schatzie.adilger.int>
2003-09-11 20:56   ` Kyle Rose
2003-09-11 21:00     ` Andreas Dilger
2003-09-13  6:50       ` Rogier Wolff
2003-09-13  6:51       ` Rogier Wolff
2003-09-12  9:36 ` Matthias Schniedermeyer
2003-09-12 11:47   ` Kyle Rose
2003-09-12 15:39 ` Oleg Drokin [this message]
2003-09-12 17:59   ` Mike Fedyk
2003-09-12 18:40     ` Oleg Drokin
2003-09-12 20:54       ` Mike Fedyk
2003-09-12 21:05         ` Kyle Rose
2003-09-12 21:56           ` Mike Fedyk
2003-09-13  0:46             ` Hans Reiser
2003-09-13  7:00         ` Oleg Drokin
2003-09-14 12:13   ` Kyle Rose
     [not found] <uGoz.5NC.7@gated-at.bofh.it>
2003-09-11 20:49 ` Pascal Schmidt

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=20030912153935.GA2693@namesys.com \
    --to=green@namesys.com \
    --cc=krose+linux-kernel@krose.org \
    --cc=linux-kernel@vger.kernel.org \
    /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