Skip to contentSkip to conversation

ReiserFS file write bug fix for 2.4

BK Hans Reiser 3 participants 5 messages Sep 11, 2002 – Sep 12, 2002

lore
Share & tools
lore
#0 lore raw

Well, at least getting the new file write code into pre6 found this bug for us.... please apply.

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

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 [email protected] 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. # --------------------------------------------
#

fs/reiserfs/file.c +1 -1
diff -Nru a/fs/reiserfs/file.c b/fs/reiserfs/file.c
@@ -1189,7 +1189,7 @@
 
 	already_written += write_bytes;
 	buf += write_bytes;
-	pos = *ppos += write_bytes;
+	*ppos = pos += write_bytes;
 	count -= write_bytes;
     }
 
#1 lore raw
Quoted 2 lines · Hans Reiser

Well, at least getting the new file write code into pre6 found this bug for us.... please apply.

What is the "right" way to get the new block allocation going? The mount option (-o alloc=prealloc min=4:preallocsize=9) only or better a "reformat"?

Thanks,
Dieter

Signature · 6 lines
Dieter Nützel
Graduate Student, Computer Science

University of Hamburg
Department of Computer Science
@home: Dieter.Nuetzel at hamburg.de (replace at with @)
#2 lore raw

Hello!

Quoted 4 lines · Dieter N?tzel
Quoted 2 lines · Hans Reiser

Well, at least getting the new file write code into pre6 found this bug for us.... please apply.

What is the "right" way to get the new block allocation going?

use 2.4.19-pre2+ and it is in there ;)

Quoted 2 lines

The mount option (-o alloc=prealloc min=4:preallocsize=9) only or better a "reformat"?

Those mount options are no longer needed starting from 2.4.20-pre6. They are default. Reformat is not needed, but all the blocks allocated by old allocator will remain at their old places of course.

Bye,
Oleg

#3 lore raw
Quoted 10 lines · Oleg Drokin

Hello!

Quoted 5 lines · Dieter N?tzel
Quoted 2 lines · Hans Reiser

Well, at least getting the new file write code into pre6 found this bug for us.... please apply.

What is the "right" way to get the new block allocation going?

use 2.4.19-pre2+ and it is in there ;)

You meant 2.4.20-pre2, didn't you?

Quoted 9 lines
Quoted 2 lines

The mount option (-o alloc=prealloc min=4:preallocsize=9) only or better a "reformat"?

Those mount options are no longer needed starting from 2.4.20-pre6. They are default. Reformat is not needed, but all the blocks allocated by old allocator will remain at their old places of course.

Bye,
Oleg

Signature · 6 lines
Dieter Nützel
Graduate Student, Computer Science

University of Hamburg
Department of Computer Science
@home: Dieter.Nuetzel at hamburg.de (replace at with @)
#4 lore raw

Hello!

Quoted 7 lines · Dieter N?tzel
Quoted 6 lines · Dieter N?tzel
Quoted 4 lines · Hans Reiser
Quoted 2 lines

Well, at least getting the new file write code into pre6 found this bug for us.... please apply.

What is the "right" way to get the new block allocation going?

use 2.4.19-pre2+ and it is in there ;)

You meant 2.4.20-pre2, didn't you?

Ah, yes. 2.4.20-pre2+ of course.

Bye,
Oleg