]> git.baikalelectronics.ru Git - kernel.git/commit
ocfs2: fix BUG when iput after ocfs2_mknod fails
authorJoseph Qi <joseph.qi@linux.alibaba.com>
Mon, 17 Oct 2022 13:02:26 +0000 (21:02 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 21 Oct 2022 04:27:22 +0000 (21:27 -0700)
commitc1ccdf4f58fc6e384a5d9f74748e3cc979bb31bd
tree7fc5a0aaa2a7a884623644b0dcb705f0483e4a79
parent5d8d3c9b445a35446f42f9d6c477930ad473ec84
ocfs2: fix BUG when iput after ocfs2_mknod fails

Commit f19fba12ad86 "ocfs2: should reclaim the inode if
'__ocfs2_mknod_locked' returns an error" tried to reclaim the claimed
inode if __ocfs2_mknod_locked() fails later.  But this introduce a race,
the freed bit may be reused immediately by another thread, which will
update dinode, e.g.  i_generation.  Then iput this inode will lead to BUG:
inode->i_generation != le32_to_cpu(fe->i_generation)

We could make this inode as bad, but we did want to do operations like
wipe in some cases.  Since the claimed inode bit can only affect that an
dinode is missing and will return back after fsck, it seems not a big
problem.  So just leave it as is by revert the reclaim logic.

Link: https://lkml.kernel.org/r/20221017130227.234480-1-joseph.qi@linux.alibaba.com
Fixes: f19fba12ad86 ("ocfs2: should reclaim the inode if '__ocfs2_mknod_locked' returns an error")
Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reported-by: Yan Wang <wangyan122@huawei.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/namei.c