ocfs2: fix infinite loop for orphan entry list
PATCH 1/1 ocfs2: fix infinite loop for orphan entry list
Orphan file may be in the recover list already when the ip_next_orphan is NULL (for example, orphan file is second tail elementof recover list). In this scenario, the file could be added to the list twice and infinite loop happened. So we need another pointer value here(EFAULT)
instead of NULL for the list tail element.
--- fs/ocfs2/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ocfs2/journal.c +2 -2
@@ -2207,7 +2207,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb, enum ocfs2_orphan_reco_type orphan_reco_type) {int ret =0 ; -struct inode *inode =NULL ; +struct inode *inode =ERR_PTR (-EFAULT );struct inode *iter;struct ocfs2_inode_info *oi;struct buffer_head *di_bh =NULL ;
@@ -2224,7 +2224,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,if (ret)mlog_errno (ret); -while (inode) { +while (!IS_ERR (inode)) { oi =OCFS2_I (inode);trace_ocfs2_recover_orphans_iput ( (unsigned long long )oi->ip_blkno);
Signature · 1 line
1.8.3.1
Joseph Qi
maintainerQuoted 6 lines · lihongweizz
Orphan file may be in the recover list already when the
ip_next_orphanis NULL (for example, orphan file is second tail elementof recover list). In this scenario, the file could be added to the list twice and infinite loop happened. So we need another pointer value here(EFAULT)
instead of NULL for the list tail element.
Don't understand how it happens. Is this a real issue you encountered? When queue orphans, it will bypass those already in recover list.
Thanks,
Joseph
Quoted 27 lines
Signed-off-by lihongweizz <[email protected]>--- fs/ocfs2/journal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/ocfs2/journal.c +2
-2@@ -2207,7 +2207,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb, enum ocfs2_orphan_reco_type orphan_reco_type) {int ret =0 ; -struct inode *inode =NULL ; +struct inode *inode =ERR_PTR (-EFAULT );struct inode *iter;struct ocfs2_inode_info *oi;struct buffer_head *di_bh =NULL ;@@ -2224,7 +2224,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,if (ret)mlog_errno (ret); -while (inode) { +while (!IS_ERR (inode)) { oi =OCFS2_I (inode);trace_ocfs2_recover_orphans_iput ( (unsigned long long )oi->ip_blkno);