All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [patch 1/4] ocfs2: prune the dcache before deleting the dentry of directory
@ 2015-02-05  0:00 akpm at linux-foundation.org
  2015-02-05 22:03 ` Mark Fasheh
  0 siblings, 1 reply; 2+ messages in thread
From: akpm at linux-foundation.org @ 2015-02-05  0:00 UTC (permalink / raw)
  To: ocfs2-devel

From: alex chen <alex.chen@huawei.com>
Subject: ocfs2: prune the dcache before deleting the dentry of directory

In ocfs2_dentry_convert_worker, we should prune the dcache before deleting
the dentry of directory, otherwise, in the following cases the inode of
directory will still remain in orphan directory until the device being
umounted.

Mount point: /mnt/ocfs2
Node A                              Node B
mkdir /mnt/ocfs2/testdir
  ocfs2_mkdir
  ->ocfs2_mknod
  ->ocfs2_dentry_attach_lock
  ->ocfs2_dentry_lock(dentry, 0)
  ... ...
touch /mnt/ocfs2/testdir/testfile
                                    unlink /mnt/test/testdir/testfile
                                    rmdir /mnt/ocfs2/testdir
                                      ocfs2_unlink
                                      ->ocfs2_remote_dentry_delete
                                      ->ocfs2_dentry_lock(dentry, 1)
                                      ... ...
... ...
ocfs2_downconvert_thread
->ocfs2_unblock_lock
->ocfs2_dentry_convert_worker
->ocfs2_find_local_alias
  ->dget_dlock
->d_delete
Here the dentry can not be
released because the children's
dentry is negative but still exist.
Finally, this inode will still remain
in orphan directory until its children
are destroyed.

So before deleting dentry of directory, we should prune the dcache to
remove unused children of the parent dentry by shrink_dcache_parent().

Signed-off-by: Alex Chen <alex.chen@huawei.com>
Reviewed-by: Joseph Qi <joseph.qi@huawei.com>
Reviewed-by: joyce.xue <xuejiufei@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/ocfs2/dlmglue.c |    3 +++
 1 file changed, 3 insertions(+)

diff -puN fs/ocfs2/dlmglue.c~ocfs2-prune-the-dcache-before-deleting-the-dentry-of-directory fs/ocfs2/dlmglue.c
--- a/fs/ocfs2/dlmglue.c~ocfs2-prune-the-dcache-before-deleting-the-dentry-of-directory
+++ a/fs/ocfs2/dlmglue.c
@@ -3750,6 +3750,9 @@ static int ocfs2_dentry_convert_worker(s
 			break;
 		spin_unlock(&dentry_attach_lock);
 
+		if (S_ISDIR(dl->dl_inode->i_mode))
+			shrink_dcache_parent(dentry);
+
 		mlog(0, "d_delete(%pd);\n", dentry);
 
 		/*
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Ocfs2-devel] [patch 1/4] ocfs2: prune the dcache before deleting the dentry of directory
  2015-02-05  0:00 [Ocfs2-devel] [patch 1/4] ocfs2: prune the dcache before deleting the dentry of directory akpm at linux-foundation.org
@ 2015-02-05 22:03 ` Mark Fasheh
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Fasheh @ 2015-02-05 22:03 UTC (permalink / raw)
  To: ocfs2-devel

On Wed, Feb 04, 2015 at 04:00:47PM -0800, Andrew Morton wrote:
> From: alex chen <alex.chen@huawei.com>
> Subject: ocfs2: prune the dcache before deleting the dentry of directory
> 
> In ocfs2_dentry_convert_worker, we should prune the dcache before deleting
> the dentry of directory, otherwise, in the following cases the inode of
> directory will still remain in orphan directory until the device being
> umounted.

... 

> Signed-off-by: Alex Chen <alex.chen@huawei.com>
> Reviewed-by: Joseph Qi <joseph.qi@huawei.com>
> Reviewed-by: joyce.xue <xuejiufei@huawei.com>

Looks good, thanks Alex!

Reviewed-by: Mark Fasheh <mfasheh@suse.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-05 22:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05  0:00 [Ocfs2-devel] [patch 1/4] ocfs2: prune the dcache before deleting the dentry of directory akpm at linux-foundation.org
2015-02-05 22:03 ` Mark Fasheh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.