path: root/fs
diff options
authorTao Ma <>2009-12-18 10:24:54 +0800
committerJoel Becker <>2009-12-18 13:32:20 -0800
commitc7d260afcbc0f9f4074e74796d4e3646875c08e1 (patch)
tree71d200fa3fddd6d98c39ecc48fd7b6ca10d91afc /fs
parent12d4cec988a8a20927a9795dbf2c6d9ef2f85baa (diff)
ocfs2: Add reflinked file's inode to inode hash eariler.
We used to add reflinked file's inode to inode hash when we add it to the dest dir. But actually there is a race. Consider the following sequence. 1. reflink happens and create the inode in orphan dir. 2. reflink thread is scheduled out because of some io. 3. recovery begins to work and calls ocfs2_recover_orphans. It calls ocfs2_iget and get a new inode and i_count = 1. It calls iput then and delete inode. the buffer's uptodate state is cleared. This patch move insert_inode_hash to the create function so that it can be found by step 3 and prevented from deleting because i_count > 1. This resolves the bug Signed-off-by: Tao Ma <> Signed-off-by: Joel Becker <>
Diffstat (limited to 'fs')
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index f010b22b1c44..5ac4d52e090f 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -2136,6 +2136,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
if (status < 0)
+ insert_inode_hash(inode);
if (status < 0 && did_quota_inode)
@@ -2284,7 +2285,6 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
goto out_commit;
- insert_inode_hash(inode);
dentry->d_op = &ocfs2_dentry_ops;
d_instantiate(dentry, inode);
status = 0;