Skip to contentSkip to conversation

fs: list init in the critical section

PATCH In review swkhack 2 participants 2 messages Sep 10, 2018 – Sep 11, 2018 VFS

lore
Share & tools
lore

swkhack

author
#0 lore raw

PATCH 2/2 fs: list init in the critical section

the i_state init in the critical section,so as the list init should in it.

---
 fs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/inode.c +1 -1
index 42f6d25..d3e07e4 100644
@@ -905,8 +905,8 @@ struct inode *new_inode_pseudo(struct super_block *sb)
 	if (inode) {
 		spin_lock(&inode->i_lock);
 		inode->i_state = 0;
-		spin_unlock(&inode->i_lock);
 		INIT_LIST_HEAD(&inode->i_sb_list);
+		spin_unlock(&inode->i_lock);
 	}
 	return inode;
 }
Signature · 1 line
2.7.4
#1 lore raw
Quoted 1 line · swkhack

the i_state init in the critical section,so as the list init should in it.

Why? What bug does this fix?

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]