Return-Path: <green@namesys.com>
Delivered-To: reiser@namesys.com
Received: (qmail 27964 invoked from network); 11 Sep 2002 14:58:29 -0000
Received: from angband.namesys.com (postfix@212.16.7.85)
  by thebsh.namesys.com with SMTP; 11 Sep 2002 14:58:29 -0000
Received: by angband.namesys.com (Postfix on SuSE Linux 7.3 (i386), from userid 521)
	id 755951870F8; Wed, 11 Sep 2002 18:58:29 +0400 (MSD)
Date: Wed, 11 Sep 2002 18:58:29 +0400
From: Oleg Drokin <green@namesys.com>
To: reiser@namesys.com
Subject: reiserfs_file_write bugfix
Message-ID: <20020911185829.A11962@namesys.com>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ"
Content-Disposition: inline
User-Agent: Mutt/1.3.22.1i


--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline

Hello!

   You probably want to ask Marcelo if he is going to leave reiserfs_file_write
   stuff in kernel. If he is going to do that, then attached fix should be
   applied. Otherwise it can be ignored, of course.

Bye,
    Oleg

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=koi8-r
Content-Disposition: attachment; filename=mail3

Hello!

  This fixes a buglet in new reiserfs_file_write() that escaped out previous
  tests. Problem only occurs on non-empty appended (opened with O_APPEND)
  files that are being written with more than 128k bytes data at a time
  (write syscall). Fix itself is trivial.

Diffstat:
 file.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Plain text patch:
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.632   -> 1.633  
#	  fs/reiserfs/file.c	1.10    -> 1.11   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/11	green@angband.namesys.com	1.633
# reiserfs: Fix a case where non empty files written to with O_APPEND set and amount of bytes to write bigger than 128k (or up to 4k less for non page aligned writes) can get their content damaged.
# --------------------------------------------
#
diff -Nru a/fs/reiserfs/file.c b/fs/reiserfs/file.c
--- a/fs/reiserfs/file.c	Wed Sep 11 18:50:13 2002
+++ b/fs/reiserfs/file.c	Wed Sep 11 18:50:14 2002
@@ -1189,7 +1189,7 @@
 
 	already_written += write_bytes;
 	buf += write_bytes;
-	pos = *ppos += write_bytes;
+	*ppos = pos += write_bytes;
 	count -= write_bytes;
     }
 

--lrZ03NoBR/3+SXJZ--


