mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 03:36:19 +00:00
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 http://oss.oracle.com/bugzilla/show_bug.cgi?id=1183. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Joel Becker <joel.becker@oracle.com>
This commit is contained in:
parent
12d4cec988
commit
c7d260afcb
1 changed files with 1 additions and 1 deletions
|
@ -2136,6 +2136,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir,
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
mlog_errno(status);
|
mlog_errno(status);
|
||||||
|
|
||||||
|
insert_inode_hash(inode);
|
||||||
leave:
|
leave:
|
||||||
if (status < 0 && did_quota_inode)
|
if (status < 0 && did_quota_inode)
|
||||||
vfs_dq_free_inode(inode);
|
vfs_dq_free_inode(inode);
|
||||||
|
@ -2284,7 +2285,6 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir,
|
||||||
goto out_commit;
|
goto out_commit;
|
||||||
}
|
}
|
||||||
|
|
||||||
insert_inode_hash(inode);
|
|
||||||
dentry->d_op = &ocfs2_dentry_ops;
|
dentry->d_op = &ocfs2_dentry_ops;
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
status = 0;
|
status = 0;
|
||||||
|
|
Loading…
Reference in a new issue