Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dentry.c
Go to the documentation of this file.
1 
25 #include <linux/dcache.h>
26 #include <linux/namei.h>
27 #include <linux/mount.h>
28 #include <linux/fs_stack.h>
29 #include <linux/slab.h>
30 #include "ecryptfs_kernel.h"
31 
45 static int ecryptfs_d_revalidate(struct dentry *dentry, unsigned int flags)
46 {
47  struct dentry *lower_dentry;
48  struct vfsmount *lower_mnt;
49  int rc = 1;
50 
51  if (flags & LOOKUP_RCU)
52  return -ECHILD;
53 
54  lower_dentry = ecryptfs_dentry_to_lower(dentry);
55  lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
56  if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate)
57  goto out;
58  rc = lower_dentry->d_op->d_revalidate(lower_dentry, flags);
59  if (dentry->d_inode) {
60  struct inode *lower_inode =
61  ecryptfs_inode_to_lower(dentry->d_inode);
62 
63  fsstack_copy_attr_all(dentry->d_inode, lower_inode);
64  }
65 out:
66  return rc;
67 }
68 
70 
77 static void ecryptfs_d_release(struct dentry *dentry)
78 {
79  if (ecryptfs_dentry_to_private(dentry)) {
80  if (ecryptfs_dentry_to_lower(dentry)) {
81  dput(ecryptfs_dentry_to_lower(dentry));
82  mntput(ecryptfs_dentry_to_lower_mnt(dentry));
83  }
84  kmem_cache_free(ecryptfs_dentry_info_cache,
85  ecryptfs_dentry_to_private(dentry));
86  }
87  return;
88 }
89 
91  .d_revalidate = ecryptfs_d_revalidate,
92  .d_release = ecryptfs_d_release,
93 };