Skip to contentSkip to conversation

OCFS2: add error check for ocfs2_read_locked_inode() call

PATCH New wengang wang 2 participants 2 messages Feb 20, 2009 – Feb 25, 2009 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OCFS2: add error check for ocfs2_read_locked_inode() call

add error check for ocfs2_read_locked_inode() call.

--

inode.c +7 -1
Index: inode.c
===================================================================
@@ -118,6 +118,7 @@ struct inode *ocfs2_iget(struct ocfs2_su
 	struct inode *inode = NULL;
 	struct super_block *sb = osb->sb;
 	struct ocfs2_find_inode_args args;
+	int status;
 
 	mlog_entry("(blkno = %llu)\n", (unsigned long long)blkno);
 
@@ -142,7 +143,12 @@ struct inode *ocfs2_iget(struct ocfs2_su
 	 * afterwards. */
 	if (inode && inode->i_state & I_NEW) {
 		mlog(0, "Inode was not in inode cache, reading it.\n");
-		ocfs2_read_locked_inode(inode, &args);
+		status = ocfs2_read_locked_inode(inode, &args);
+		if (status) {
+			iput(inode);
+			inode = ERR_PTR(status);
+			goto bail;
+		}
 		unlock_new_inode(inode);
 	}
 	if (inode == NULL) {
#1 lore raw

PATCH 1/1 OCFS2: add error check for ocfs2_read_locked_inode() call

Quoted 1 line · wengang wang

add error check for ocfs2_read_locked_inode() call.

This isn't needed, because every error in
ocfs2_read_locked_inode() will set the inode bad with make_bad_inode(). ocfs2_iget() checks tat five lines later with is_bad_inode().

Joel

Quoted 34 lines

--
Index: inode.c
===================================================================

inode.c +7 -1
@@ -118,6 +118,7 @@ struct inode *ocfs2_iget(struct ocfs2_su
 	struct inode *inode = NULL;
 	struct super_block *sb = osb->sb;
 	struct ocfs2_find_inode_args args;
+	int status;
 
 	mlog_entry("(blkno = %llu)\n", (unsigned long long)blkno);
 
@@ -142,7 +143,12 @@ struct inode *ocfs2_iget(struct ocfs2_su
 	 * afterwards. */
 	if (inode && inode->i_state & I_NEW) {
 		mlog(0, "Inode was not in inode cache, reading it.\n");
-		ocfs2_read_locked_inode(inode, &args);
+		status = ocfs2_read_locked_inode(inode, &args);
+		if (status) {
+			iput(inode);
+			inode = ERR_PTR(status);
+			goto bail;
+		}
 		unlock_new_inode(inode);
 	}
 	if (inode == NULL) {

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

Signature · 8 lines
"In the room the women come and go
 Talking of Michaelangelo."

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