Thanks for looking into this Vladimir!

> reiserfs panic labeled PAP-5680 which you encountered indicates that file
> truncate did not complete. Actually, reiserfs does not have to panic, it
> has to return EIO or something suitable.
Indeed, that would be much better behaviour. Maybe the attached patch is okay. 
It compiles fine with 2.6.19.1. However, I don't see how to test it. 

> Could it be hardware fault?
In case you saw the smartd warnings concerning /dev/hda, the reiserfs panic 
occurred with a reiserfs on an S-ATA software raid 5 (/dev/sd[a-g]1) I got a 
few months ago. The P-ATA boot disk is the only old component. I don't 
remember any worrying S-ATA or raid messages in my syslog. Unfortunately, I 
cannot have a closer look at the moment as I'm away on holiday.

Regards,
Joachim
--- stree.orig	2006-12-11 20:32:53.000000000 +0100
+++ stree.c	2006-12-26 14:53:48.000000000 +0100
@@ -1898,9 +1898,30 @@
 				goto out;
 			reiserfs_update_inode_transaction(p_s_inode);
 		}
-	} while (n_file_size > ROUND_UP(n_new_file_size) &&
-		 search_for_position_by_key(p_s_inode->i_sb, &s_item_key,
-					    &s_search_path) == POSITION_FOUND);
+	if (n_file_size > ROUND_UP(n_new_file_size)) {
+		retval = search_for_position_by_key(p_s_inode->i_sb,
+						  &s_item_key, &s_search_path);
+		if (retval == IO_ERROR) {
+			reiserfs_warning(p_s_inode->i_sb,
+				 	"jw-5670: reiserfs_do_truncate: "
+				 	"i/o failure occurred searching for %K",
+				 	&s_item_key);
+			err = -EIO;
+			goto out;
+		}
+		if (retval == FILE_NOT_FOUND) {
+			reiserfs_warning(p_s_inode->i_sb,
+				 	"jw-5672: reiserfs_do_truncate: "
+				 	"file not found searching for %K",
+				 	&s_item_key);
+			err = -EIO;
+			goto out;
+		}
+	}
+	else
+		retval = POSITION_NOT_FOUND;
+
+	} while (retval == POSITION_FOUND);
 
 	RFALSE(n_file_size > ROUND_UP(n_new_file_size),
 	       "PAP-5680: truncate did not finish: new_file_size %Ld, current %Ld, oid %d",

Reply via email to