[Ocfs2-commits] jlbec commits r2780 - branches/ocfs2-1.2/fs/ocfs2

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Wed Mar 1 16:11:53 CST 2006


Author: jlbec
Signed-off-by: mfasheh
Date: 2006-03-01 16:11:52 -0600 (Wed, 01 Mar 2006)
New Revision: 2780

Modified:
   branches/ocfs2-1.2/fs/ocfs2/extent_map.c
Log:

o Backport extent_map.c errors from upstream:

    ocfs2: Respond to on-disk corruption in the extent map code.

    The extent map code has long noticed when the on-disk extent information
    is corrupt.  However, so far it has only returned an error.  We should
    take the filesystem read-only, as it is corrupt.

    

Signed-off-by: mfasheh



Modified: branches/ocfs2-1.2/fs/ocfs2/extent_map.c
===================================================================
--- branches/ocfs2-1.2/fs/ocfs2/extent_map.c	2006-03-01 21:55:39 UTC (rev 2779)
+++ branches/ocfs2-1.2/fs/ocfs2/extent_map.c	2006-03-01 22:11:52 UTC (rev 2780)
@@ -178,6 +178,12 @@
 			ret = -EBADR;
 			if (rec_end > OCFS2_I(inode)->ip_clusters) {
 				mlog_errno(ret);
+				ocfs2_error(inode->i_sb,
+					    "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
+					    i,
+					    le64_to_cpu(rec->e_blkno),
+					    OCFS2_I(inode)->ip_blkno,
+					    OCFS2_I(inode)->ip_clusters);
 				goto out_free;
 			}
 
@@ -223,6 +229,12 @@
 			ret = -EBADR;
 			if (blkno) {
 				mlog_errno(ret);
+				ocfs2_error(inode->i_sb,
+					    "Multiple extents for (cpos = %u, clusters = %u) on inode %"MLFu64"; e_blkno %"MLFu64" and rec %d at e_blkno %"MLFu64"\n",
+					    cpos, clusters,
+					    OCFS2_I(inode)->ip_blkno,
+					    blkno, i,
+					    le64_to_cpu(rec->e_blkno));
 				goto out_free;
 			}
 
@@ -235,6 +247,10 @@
 		 */
 		ret = -EBADR;
 		if (!blkno) {
+			ocfs2_error(inode->i_sb,
+				    "No record found for (cpos = %u, clusters = %u) on inode %"MLFu64"\n",
+				    cpos, clusters,
+				    OCFS2_I(inode)->ip_blkno);
 			mlog_errno(ret);
 			goto out_free;
 		}
@@ -264,6 +280,20 @@
 
 	for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
 		rec = &el->l_recs[i];
+
+		if ((le32_to_cpu(rec->e_cpos) + le32_to_cpu(rec->e_clusters)) >
+		    OCFS2_I(inode)->ip_clusters) {
+			ret = -EBADR;
+			mlog_errno(ret);
+			ocfs2_error(inode->i_sb,
+				    "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
+				    i,
+				    le64_to_cpu(rec->e_blkno),
+				    OCFS2_I(inode)->ip_blkno,
+				    OCFS2_I(inode)->ip_clusters);
+			return ret;
+		}
+
 		ret = ocfs2_extent_map_insert(inode, rec,
 					      le16_to_cpu(el->l_tree_depth));
 		if (ret) {
@@ -524,6 +554,10 @@
 		    OCFS2_I(inode)->ip_map.em_clusters) {
 			ret = -EBADR;
 			mlog_errno(ret);
+			ocfs2_error(inode->i_sb,
+				    "Zero e_clusters on non-tail extent record at e_blkno %"MLFu64" on inode %"MLFu64"\n",
+				    le64_to_cpu(rec->e_blkno),
+				    OCFS2_I(inode)->ip_blkno);
 			return ret;
 		}
 
@@ -586,12 +620,12 @@
  * Existing record in the extent map:
  *
  *	cpos = 10, len = 10
- * 	|---------|
+ *	|---------|
  *
  * New Record:
  *
  *	cpos = 10, len = 20
- * 	|------------------|
+ *	|------------------|
  *
  * The passed record is the new on-disk record.  The new_clusters value
  * is how many clusters were added to the file.  If the append is a




More information about the Ocfs2-commits mailing list