public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Drokin <green@namesys.com>
To: marcelo@conectiva.com.br
Cc: linux-kernel@vger.kernel.org, reiserfs-list@namesys.com
Subject: [PATCH] Reiserfs fixes for 2.4.17-rc2
Date: Wed, 19 Dec 2001 19:56:53 +0300	[thread overview]
Message-ID: <20011219195653.A29999@namesys.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

Hello!

    Attached are 2 fixes for reiserfs in 2.4.17-rc2
    map_block_for_writepage_highmem_fix-1.diff fixes oops on incorerct access to (possibly) unkmapped highmem pages.
    mmaped_data_loss_fix.diff fixes a problem where some data may be lost if mmap-writed data is subsequently appended by
    data written with write(2), and because of that mmapped data is lost. (Originally found by fsx tool)

Bye,
    Oleg

[-- Attachment #2: map_block_for_writepage_highmem_fix-1.diff --]
[-- Type: text/plain, Size: 863 bytes --]

--- linux/fs/reiserfs/inode.c.orig	Wed Dec 19 16:26:05 2001
+++ linux/fs/reiserfs/inode.c	Wed Dec 19 16:32:02 2001
@@ -1772,6 +1772,7 @@
     int bytes_copied = 0 ;
     int copy_size ;
 
+    kmap(bh_result->b_page) ;
 start_over:
     lock_kernel() ;
     journal_begin(&th, inode->i_sb, jbegin_count) ;
@@ -1844,10 +1845,8 @@
 
     /* this is where we fill in holes in the file. */
     if (use_get_block) {
-        kmap(bh_result->b_page) ;
 	retval = reiserfs_get_block(inode, block, bh_result, 
 	                            GET_BLOCK_CREATE | GET_BLOCK_NO_ISEM) ;
-        kunmap(bh_result->b_page) ;
 	if (!retval) {
 	    if (!buffer_mapped(bh_result) || bh_result->b_blocknr == 0) {
 	        /* get_block failed to find a mapped unformatted node. */
@@ -1856,6 +1855,7 @@
 	    }
 	}
     }
+    kunmap(bh_result->b_page) ;
     return retval ;
 }
 

[-- Attachment #3: mmaped_data_loss_fix.diff --]
[-- Type: text/plain, Size: 1143 bytes --]

--- linux/fs/reiserfs/inode.c.orig	Tue Dec 18 14:50:24 2001
+++ linux/fs/reiserfs/inode.c	Tue Dec 18 14:52:04 2001
@@ -273,7 +273,9 @@
 	pathrelse (&path);
         if (p)
             kunmap(bh_result->b_page) ;
-	if ((args & GET_BLOCK_NO_HOLE)) {
+	// We do not return -ENOENT if there is a hole but page is uptodate, because it means
+	// That there is some MMAPED data associated with it that is yet to be written to disk.
+	if ((args & GET_BLOCK_NO_HOLE) && !Page_Uptodate(bh_result->b_page) ) {
 	    return -ENOENT ;
 	}
         return 0 ;
@@ -294,9 +296,13 @@
 	    bh_result->b_dev = inode->i_dev;
 	    bh_result->b_blocknr = blocknr;
 	    bh_result->b_state |= (1UL << BH_Mapped);
-	} else if ((args & GET_BLOCK_NO_HOLE)) {
-	    ret = -ENOENT ;
-	}
+	} else
+	    // We do not return -ENOENT if there is a hole but page is uptodate, because it means
+	    // That there is some MMAPED data associated with it that is yet to be written to disk.
+	    if ((args & GET_BLOCK_NO_HOLE) && !Page_Uptodate(bh_result->b_page) ) {
+		ret = -ENOENT ;
+	    }
+
 	pathrelse (&path);
         if (p)
             kunmap(bh_result->b_page) ;

                 reply	other threads:[~2001-12-19 16:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20011219195653.A29999@namesys.com \
    --to=green@namesys.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --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