[Ocfs2-commits] mfasheh commits r2579 - branches/readonly-operation/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Sep 16 16:19:19 CDT 2005


Author: mfasheh
Date: 2005-09-16 16:19:18 -0500 (Fri, 16 Sep 2005)
New Revision: 2579

Modified:
   branches/readonly-operation/fs/ocfs2/alloc.c
   branches/readonly-operation/fs/ocfs2/journal.c
   branches/readonly-operation/fs/ocfs2/localalloc.c
   branches/readonly-operation/fs/ocfs2/ocfs2.h
   branches/readonly-operation/fs/ocfs2/suballoc.c
   branches/readonly-operation/fs/ocfs2/super.h
Log:
* Fix up the vararg part of the ocfs2_error/abort macros

* detected an aborted journal in ocfs2_start_trans() and ocfs2_abort() when 
  we get one 

* Left a newline character in some of the error/abort calls, remove those.

* journal_clear_err() during node recovery too



Modified: branches/readonly-operation/fs/ocfs2/alloc.c
===================================================================
--- branches/readonly-operation/fs/ocfs2/alloc.c	2005-09-16 03:06:45 UTC (rev 2578)
+++ branches/readonly-operation/fs/ocfs2/alloc.c	2005-09-16 21:19:18 UTC (rev 2579)
@@ -565,7 +565,7 @@
 			if (next_free == 0) {
 				ocfs2_error(inode->i_sb,
 					    "Dinode %"MLFu64" has a bad "
-					    "extent list\n",
+					    "extent list",
 					    OCFS2_I(inode)->ip_blkno);
 				status = -EIO;
 				goto bail;
@@ -610,7 +610,7 @@
 		if (next_free == 0) {
 			ocfs2_error(inode->i_sb,
 				    "Dinode %"MLFu64" has a bad "
-				    "extent list\n",
+				    "extent list",
 				    OCFS2_I(inode)->ip_blkno);
 			status = -EIO;
 			goto bail;
@@ -651,7 +651,7 @@
 		if (el->l_recs[i].e_cpos != fe->i_clusters) {
 			ocfs2_error(inode->i_sb,
 				    "Dinode %"MLFu64" trailing extent is bad: "
-				    "cpos (%u) != number of clusters (%u)\n",
+				    "cpos (%u) != number of clusters (%u)",
 				    le32_to_cpu(el->l_recs[i].e_cpos),
 				    le32_to_cpu(fe->i_clusters));
 			status = -EIO;
@@ -746,7 +746,7 @@
 	while(le16_to_cpu(el->l_tree_depth) > 1) {
 		if (le16_to_cpu(el->l_next_free_rec) == 0) {
 			ocfs2_error(inode->i_sb, "Dinode %"MLFu64" has empty "
-				    "extent list (next_free_rec == 0)\n",
+				    "extent list (next_free_rec == 0)",
 				    OCFS2_I(inode)->ip_blkno);
 			status = -EIO;
 			goto bail;
@@ -756,7 +756,7 @@
 		if (!blkno) {
 			ocfs2_error(inode->i_sb, "Dinode %"MLFu64" has extent "
 				    "list where extent # %d has no physical "
-				    "block start\n",
+				    "block start",
 				    OCFS2_I(inode)->ip_blkno, i);
 			status = -EIO;
 			goto bail;
@@ -1945,7 +1945,19 @@
 	mlog(0, "fe->i_clusters = %u, new_i_clusters = %u, fe->i_size ="
 	     "%"MLFu64"\n", fe->i_clusters, new_i_clusters, fe->i_size);
 
-	BUG_ON(le32_to_cpu(fe->i_clusters) <= new_i_clusters);
+	if (le32_to_cpu(fe->i_clusters) <= new_i_clusters) {
+		ocfs2_error(inode->i_sb, "Dinode %"MLFu64" has cluster count "
+			    "%u and size %"MLFu64" whereas struct inode has "
+			    "cluster count %u and size %llu which caused an "
+			    "invalid truncate to %u clusters.",
+			    le64_to_cpu(fe->i_blkno),
+			    le32_to_cpu(fe->i_clusters),
+			    le64_to_cpu(fe->i_size),
+			    OCFS2_I(inode)->ip_clusters, i_size_read(inode),
+			    new_i_clusters);
+		status = -EIO;
+		goto bail;
+	}
 
 	*tc = kcalloc(1, sizeof(struct ocfs2_truncate_context), GFP_KERNEL);
 	if (!(*tc)) {

Modified: branches/readonly-operation/fs/ocfs2/journal.c
===================================================================
--- branches/readonly-operation/fs/ocfs2/journal.c	2005-09-16 03:06:45 UTC (rev 2578)
+++ branches/readonly-operation/fs/ocfs2/journal.c	2005-09-16 21:19:18 UTC (rev 2579)
@@ -186,6 +186,11 @@
 		ret = (int)PTR_ERR(handle->k_handle);
 		handle->k_handle = NULL;
 		mlog_errno(ret);
+
+		if (is_journal_aborted(journal)) {
+			ocfs2_abort(osb->sb, "Detected aborted journal");
+			ret = -EROFS;
+		}
 		goto done_free;
 	}
 
@@ -616,7 +621,7 @@
 		 * handle the errors in a specific manner, so no need
 		 * to call ocfs2_error() here. */
 		mlog(ML_ERROR, "Journal dinode %"MLFu64"  has invalid "
-		     "signature: %.*s\n", fe->i_blkno, 7, fe->i_signature);
+		     "signature: %.*s", fe->i_blkno, 7, fe->i_signature);
 		status = -EIO;
 		goto out;
 	}
@@ -714,10 +719,27 @@
 	mlog_exit_void();
 }
 
+static void ocfs2_clear_journal_error(struct super_block *sb,
+				      journal_t *journal,
+				      int slot)
+{
+	int olderr;
+
+	olderr = journal_errno(journal);
+	if (olderr) {
+		mlog(ML_ERROR, "File system error %d recorded in "
+		     "journal %u.\n", olderr, slot);
+		mlog(ML_ERROR, "File system on device %s needs checking.\n",
+		     sb->s_id);
+
+		journal_ack_err(journal);
+		journal_clear_err(journal);
+	}
+}
+
 int ocfs2_journal_load(ocfs2_journal *journal)
 {
 	int status = 0;
-	int olderr = 0;
 	ocfs2_super *osb;
 
 	mlog_entry_void();
@@ -733,12 +755,7 @@
 		goto done;
 	}
 
-	olderr = journal_errno(journal->j_journal);
-	if (olderr) {
-		mlog(ML_ERROR, "last journal left error code %d\n", olderr);
-		journal_ack_err(journal->j_journal);
-		journal_clear_err(journal->j_journal);
-	}
+	ocfs2_clear_journal_error(osb->sb, journal->j_journal, osb->slot_num);
 
 	status = ocfs2_journal_toggle_dirty(osb, 1);
 	if (status < 0) {
@@ -1170,6 +1187,8 @@
 		goto done;
 	}
 
+	ocfs2_clear_journal_error(osb->sb, journal, slot_num);
+
 	/* wipe the journal */
 	mlog(0, "flushing the journal.\n");
 	journal_lock_updates(journal);

Modified: branches/readonly-operation/fs/ocfs2/localalloc.c
===================================================================
--- branches/readonly-operation/fs/ocfs2/localalloc.c	2005-09-16 03:06:45 UTC (rev 2578)
+++ branches/readonly-operation/fs/ocfs2/localalloc.c	2005-09-16 21:19:18 UTC (rev 2579)
@@ -494,7 +494,7 @@
 	if (le32_to_cpu(alloc->id1.bitmap1.i_used) !=
 	    ocfs2_local_alloc_count_bits(alloc)) {
 		ocfs2_error(osb->sb, "local alloc inode %"MLFu64" says it has "
-			    "%u free bits, but a count shows %u\n",
+			    "%u free bits, but a count shows %u",
 			    le64_to_cpu(alloc->i_blkno),
 			    le32_to_cpu(alloc->id1.bitmap1.i_used),
 			    ocfs2_local_alloc_count_bits(alloc));

Modified: branches/readonly-operation/fs/ocfs2/ocfs2.h
===================================================================
--- branches/readonly-operation/fs/ocfs2/ocfs2.h	2005-09-16 03:06:45 UTC (rev 2578)
+++ branches/readonly-operation/fs/ocfs2/ocfs2.h	2005-09-16 21:19:18 UTC (rev 2579)
@@ -351,7 +351,7 @@
 #define OCFS2_RO_ON_INVALID_DINODE(__sb, __di)	do {			\
 	typeof(__di) ____di = (__di);					\
 	ocfs2_error((__sb), 						\
-		"Dinode # %"MLFu64" has bad signature %.*s\n",		\
+		"Dinode # %"MLFu64" has bad signature %.*s",		\
 		(____di)->i_blkno, 7,					\
 		(____di)->i_signature);					\
 } while (0);
@@ -362,7 +362,7 @@
 #define OCFS2_RO_ON_INVALID_EXTENT_BLOCK(__sb, __eb)	do {		\
 	typeof(__eb) ____eb = (__eb);					\
 	ocfs2_error((__sb), 						\
-		"Extent Block # %"MLFu64" has bad signature %.*s\n",	\
+		"Extent Block # %"MLFu64" has bad signature %.*s",	\
 		(____eb)->h_blkno, 7,					\
 		(____eb)->h_signature);					\
 } while (0);
@@ -373,7 +373,7 @@
 #define OCFS2_RO_ON_INVALID_GROUP_DESC(__sb, __gd)	do {		\
 	typeof(__gd) ____gd = (__gd);					\
 		ocfs2_error((__sb),					\
-		"Group Descriptor # %"MLFu64" has bad signature %.*s\n",\
+		"Group Descriptor # %"MLFu64" has bad signature %.*s",	\
 		(____gd)->bg_blkno, 7,					\
 		(____gd)->bg_signature);				\
 } while (0);

Modified: branches/readonly-operation/fs/ocfs2/suballoc.c
===================================================================
--- branches/readonly-operation/fs/ocfs2/suballoc.c	2005-09-16 03:06:45 UTC (rev 2578)
+++ branches/readonly-operation/fs/ocfs2/suballoc.c	2005-09-16 21:19:18 UTC (rev 2579)
@@ -158,7 +158,7 @@
 
 	if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) {
 		ocfs2_error(alloc_inode->i_sb, "group block (%"MLFu64") "
-			    "!= b_blocknr (%llu)\n", group_blkno,
+			    "!= b_blocknr (%llu)", group_blkno,
 			    (unsigned long long) bg_bh->b_blocknr);
 		status = -EIO;
 		goto bail;
@@ -383,7 +383,7 @@
 	}
 	if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) {
 		ocfs2_error(alloc_inode->i_sb, "Invalid chain allocator "
-			    "# %"MLFu64"\n", le64_to_cpu(fe->i_blkno));
+			    "# %"MLFu64, le64_to_cpu(fe->i_blkno));
 		status = -EIO;
 		goto bail;
 	}
@@ -1135,7 +1135,7 @@
 	if (le32_to_cpu(fe->id1.bitmap1.i_used) >=
 	    le32_to_cpu(fe->id1.bitmap1.i_total)) {
 		ocfs2_error(osb->sb, "Chain allocator dinode %"MLFu64" has %u"
-			    "used bits but only %u total.\n",
+			    "used bits but only %u total.",
 			    le64_to_cpu(fe->i_blkno),
 			    le32_to_cpu(fe->id1.bitmap1.i_used),
 			    le32_to_cpu(fe->id1.bitmap1.i_total));

Modified: branches/readonly-operation/fs/ocfs2/super.h
===================================================================
--- branches/readonly-operation/fs/ocfs2/super.h	2005-09-16 03:06:45 UTC (rev 2578)
+++ branches/readonly-operation/fs/ocfs2/super.h	2005-09-16 21:19:18 UTC (rev 2579)
@@ -34,11 +34,11 @@
 void __ocfs2_error(struct super_block *sb,
 		   const char *function,
 		   const char *fmt, ...);
-#define ocfs2_error(sb, fmt, args...) __ocfs2_error(sb, __PRETTY_FUNCTION__, fmt, args)
+#define ocfs2_error(sb, fmt, args...) __ocfs2_error(sb, __PRETTY_FUNCTION__, fmt, ##args)
 
 void __ocfs2_abort(struct super_block *sb,
 		   const char *function,
 		   const char *fmt, ...);
-#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, args)
+#define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args)
 
 #endif /* OCFS2_SUPER_H */



More information about the Ocfs2-commits mailing list