]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ocfs2: make direntry invalid when deleting it
authorWengang Wang <wen.gang.wang@oracle.com>
Tue, 12 Jul 2011 08:43:14 +0000 (16:43 +0800)
committerXiaowei.Hu <xiaowei.hu@oracle.com>
Wed, 29 Aug 2012 06:08:43 +0000 (14:08 +0800)
commit403053c364c3099fdc083d6632b9629e07d0415c
tree075847ca93af48c84e75af4444ca52d451601f1a
parent12114736d04ab9d42c95c4273982cd35a694130b
ocfs2: make direntry invalid when deleting it

When we deleting a direntry from a directory, if it's the first in a block we
invalid it by setting inode to 0; otherwise, we merge the deleted one to the
prior and contiguous direntry. And we don't truncate directories.

There is a problem for the later case since inode is not set to 0.
This problem happens when the caller passes a file position as parameter to
ocfs2_dir_foreach_blk(). If the position happens to point to a stale(not
the first, deleted in betweens of ocfs2_dir_foreach_blk()s) direntry, we are
not able to recognize its staleness. So that we treat it as a live one wrongly.

The fix is to set inode to 0 in both cases indicating the direntry is stale.
This won't introduce additional IOs.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Joel Becker <jlbec@evilplan.org>
(cherry picked from commit 8298524803339a9a8df053ebdfebc2975ec55be9)

Signed-off-by: Xiaowei.Hu <xiaowei.hu@oracle.com>
fs/ocfs2/dir.c