]> git.baikalelectronics.ru Git - kernel.git/commit
ocfs2: clear dinode links count in case of error
authorJoseph Qi <joseph.qi@linux.alibaba.com>
Mon, 17 Oct 2022 13:02:27 +0000 (21:02 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 21 Oct 2022 04:27:22 +0000 (21:27 -0700)
commit5e7b6a73dabc5a3b56985276d122b91d46df2c42
tree690c8db824575a59ad93cbb29e5e3d40b4a1490c
parentc1ccdf4f58fc6e384a5d9f74748e3cc979bb31bd
ocfs2: clear dinode links count in case of error

In ocfs2_mknod(), if error occurs after dinode successfully allocated,
ocfs2 i_links_count will not be 0.

So even though we clear inode i_nlink before iput in error handling, it
still won't wipe inode since we'll refresh inode from dinode during inode
lock.  So just like clear inode i_nlink, we clear ocfs2 i_links_count as
well.  Also do the same change for ocfs2_symlink().

Link: https://lkml.kernel.org/r/20221017130227.234480-2-joseph.qi@linux.alibaba.com
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