FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Kernel Team

 
 
LinkBack Thread Tools
 
Old 02-27-2012, 02:56 PM
Colin King
 
Default eCryptfs: Clear i_nlink in rmdir

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

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:

https://launchpadlibrarian.net/64953109/inotify.c

This test program hangs waiting for the IN_DELETE_SELF event that never
occurs.

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.

https://bugs.launchpad.net/bugs/723518

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

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(-)


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 02-27-2012, 02:56 PM
Colin King
 
Default eCryptfs: Clear i_nlink in rmdir

From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>

eCryptfs wasn't clearing the eCryptfs inode's i_nlink after a successful
vfs_rmdir() on the lower directory. This resulted in the inode evict and
destroy paths to be missed.

https://bugs.launchpad.net/ecryptfs/+bug/723518

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: <stable@kernel.org>
---
fs/ecryptfs/inode.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 79ae6a7..4434e8f 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -575,6 +575,8 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
dget(lower_dentry);
rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
dput(lower_dentry);
+ if (!rc && dentry->d_inode)
+ clear_nlink(dentry->d_inode);
fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
unlock_dir(lower_dir_dentry);
--
1.7.0.4


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 03-02-2012, 04:08 PM
Colin King
 
Default eCryptfs: Clear i_nlink in rmdir

From: Colin Ian King <colin.king@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:

https://launchpadlibrarian.net/64953109/inotify.c

This test program hangs waiting for the IN_DELETE_SELF event that never
occurs.

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.

https://bugs.launchpad.net/bugs/723518

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

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(-)


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 
Old 03-02-2012, 04:08 PM
Colin King
 
Default eCryptfs: Clear i_nlink in rmdir

From: Tyler Hicks <tyhicks@linux.vnet.ibm.com>

eCryptfs wasn't clearing the eCryptfs inode's i_nlink after a successful
vfs_rmdir() on the lower directory. This resulted in the inode evict and
destroy paths to be missed.

https://bugs.launchpad.net/ecryptfs/+bug/723518

Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: <stable@kernel.org>
---
fs/ecryptfs/inode.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 79ae6a7..4434e8f 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -575,6 +575,8 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)
dget(lower_dentry);
rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
dput(lower_dentry);
+ if (!rc && dentry->d_inode)
+ clear_nlink(dentry->d_inode);
fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
unlock_dir(lower_dir_dentry);
--
1.7.0.4


--
kernel-team mailing list
kernel-team@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/kernel-team
 

Thread Tools




All times are GMT. The time now is 07:40 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org