Skip to contentSkip to conversation

OCFS2: add IO error check in ocfs2_get_sector() -v2

PATCH New wengang wang 3 participants 6 messages Feb 12, 2009 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OCFS2: add IO error check in ocfs2_get_sector() -v2

checks IO error in ocfs2_get_sector().

this patch is based on 1.4 git.

--

ocfs2/super.c +6 -0
Index: fs/ocfs2/super.c
===================================================================
@@ -1203,6 +1203,12 @@ static int ocfs2_get_sector(struct super
 	unlock_buffer(*bh);
 	ll_rw_block(READ, 1, bh);
 	wait_on_buffer(*bh);
+	if (!buffer_uptodate(*bh)) {
+		mlog_errno(-EIO);
+		brelse(*bh);
+		return -EIO;
+	}
+
 	return 0;
 }
 
#1 lore raw

PATCH 1/1 OCFS2: add IO error check in ocfs2_get_sector() -v2

The matching brelse() is in ocfs2_fill_super(). So you shouldn't need it. Cross check though please.

Secondly, when you make a patch, please make it against mainline. ocfs2 1.4 pulls in patches from mainline.

Sunil

Quoted 29 lines · wengang wang

checks IO error in ocfs2_get_sector().

this patch is based on 1.4 git.

--
Index: fs/ocfs2/super.c
===================================================================

ocfs2/super.c +6 -0
@@ -1203,6 +1203,12 @@ static int ocfs2_get_sector(struct super
 	unlock_buffer(*bh);
 	ll_rw_block(READ, 1, bh);
 	wait_on_buffer(*bh);
+	if (!buffer_uptodate(*bh)) {
+		mlog_errno(-EIO);
+		brelse(*bh);
+		return -EIO;
+	}
+
 	return 0;
 }
 

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

#2 lore raw

PATCH 1/1 OCFS2: add IO error check in ocfs2_get_sector() -v2

Quoted 2 lines · Sunil Mushran

The matching brelse() is in ocfs2_fill_super(). So you shouldn't need it. Cross check though please.

No, if we get an error from ocfs2_get_sector() we return without
brelse(). So the patch is correct.

Joel

Signature · 8 lines
"I have never let my schooling interfere with my education."
        - Mark Twain

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
#3 lore raw

PATCH 1/1 OCFS2: add IO error check in ocfs2_get_sector() -v2

I am looking at the brelse() in ocfs2_fill_super().

Quoted 12 lines · Joel Becker
Quoted 3 lines · Sunil Mushran

The matching brelse() is in ocfs2_fill_super(). So you shouldn't need it. Cross check though please.

No, if we get an error from ocfs2_get_sector() we return without
brelse(). So the patch is correct.

Joel

#4 lore raw

PATCH 1/1 OCFS2: add IO error check in ocfs2_get_sector() -v2

Quoted 1 line · Sunil Mushran

I am looking at the brelse() in ocfs2_fill_super().

Oh, right. Then Wengang's patch should null out *bh when
brelsing it. No point in passing a garbage bh all the way up.

Joel

Quoted 20 lines
Quoted 12 lines · Joel Becker
Quoted 3 lines · Sunil Mushran

The matching brelse() is in ocfs2_fill_super(). So you shouldn't need it. Cross check though please.

No, if we get an error from ocfs2_get_sector() we return without
brelse(). So the patch is correct.

Joel

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

Signature · 10 lines
"The one important thing i have learned over the years is the
 difference between taking one's work seriously and taking one's self
 seriously.  The first is imperative and the second is disastrous."
	-Margot Fonteyn

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
#5 lore raw

PATCH 1/1 OCFS2: add IO error check in ocfs2_get_sector() -v2

In reply to wengang wang
Quoted 3 lines · wengang wang

checks IO error in ocfs2_get_sector().

this patch is based on 1.4 git.

This patch is good, but definitely needs to be against mainline.

sobby

Quoted 25 lines

--
Index: fs/ocfs2/super.c
===================================================================

ocfs2/super.c +6 -0
@@ -1203,6 +1203,12 @@ static int ocfs2_get_sector(struct super
 	unlock_buffer(*bh);
 	ll_rw_block(READ, 1, bh);
 	wait_on_buffer(*bh);
+	if (!buffer_uptodate(*bh)) {
+		mlog_errno(-EIO);
+		brelse(*bh);
+		return -EIO;
+	}
+
 	return 0;
 }
 

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel

Signature · 11 lines
The Graham Corollary:

	The longer a socially-moderated news website exists, the
	probability of an old Paul Graham link appearing at the top
	approaches certainty.

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127