[Natty][SRU][PATCH 0/2] eCryptfs: Clear i_nlink in rmdir

Colin King colin.king at canonical.com
Fri Mar 2 17:08:31 UTC 2012

From: Colin Ian King <colin.king at canonical.com>

Note: This is a re-posting (I forgot to request it for Natty).
I originally requested these for Lucid but they also apply cleanly
and fix the issue for Natty too.

SRU Justification:

The IN_DELETE_SELF mask for inotify_add_watch indicates that an event
should be emitted when the watched path is deleted, however, this does
not happen on an eCryptfs mount. 

To reproduce:

mkdir upper lower
sudo mount -t ecryptfs lower upper

and compile and run the following test program in the upper directory:


This test program hangs waiting for the IN_DELETE_SELF event that never

Fix: the following two patches address the bug. The first patch removes
and an unnecessary d_delete from ecryptfs_rmdir.  The second patch clears
the inode's i_nlink after a successful vfs_rmdir() on the lower directory.
Without the second patch inode evict and destroy paths are missed and
hence IN_DELETE_SELF inotify events do not occur.

With the fix, the test inotify program receives the IN_DELETE_SELF event
and completes.


These patches are clean cherry picks of upstream commits
35ffa948b2f7bdf79e488cd496232935d095087a and

Tyler Hicks (2):
  eCryptfs: Remove extra d_delete in ecryptfs_rmdir
  eCryptfs: Clear i_nlink in rmdir

 fs/ecryptfs/inode.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

More information about the kernel-team mailing list