Commit ae56fb16 authored by Michael Halcrow's avatar Michael Halcrow Committed by Linus Torvalds

[PATCH] eCryptfs: CIFS nlink fixes

When CIFS is the lower filesystem, the old lower dentry needs to be explicitly
dropped from inside eCryptfs to force a revalidate.  In addition, when CIFS is
the lower filesystem, the inode attributes need to be copied back up from the
lower inode to the eCryptfs inode on an eCryptfs revalidate.
Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 31be8309
...@@ -57,6 +57,12 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd) ...@@ -57,6 +57,12 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd); rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd);
nd->dentry = dentry_save; nd->dentry = dentry_save;
nd->mnt = vfsmount_save; nd->mnt = vfsmount_save;
if (dentry->d_inode) {
struct inode *lower_inode =
ecryptfs_inode_to_lower(dentry->d_inode);
ecryptfs_copy_attr_all(dentry->d_inode, lower_inode);
}
out: out:
return rc; return rc;
} }
......
...@@ -470,6 +470,7 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -470,6 +470,7 @@ static int ecryptfs_link(struct dentry *old_dentry, struct inode *dir,
unlock_dir(lower_dir_dentry); unlock_dir(lower_dir_dentry);
dput(lower_new_dentry); dput(lower_new_dentry);
dput(lower_old_dentry); dput(lower_old_dentry);
d_drop(lower_old_dentry);
d_drop(new_dentry); d_drop(new_dentry);
d_drop(old_dentry); d_drop(old_dentry);
return rc; return rc;
...@@ -484,7 +485,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -484,7 +485,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
lock_parent(lower_dentry); lock_parent(lower_dentry);
rc = vfs_unlink(lower_dir_inode, lower_dentry); rc = vfs_unlink(lower_dir_inode, lower_dentry);
if (rc) { if (rc) {
ecryptfs_printk(KERN_ERR, "Error in vfs_unlink\n"); printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
goto out_unlock; goto out_unlock;
} }
ecryptfs_copy_attr_times(dir, lower_dir_inode); ecryptfs_copy_attr_times(dir, lower_dir_inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment