Merge tag 'fbdev-v5.2' of git://github.com/bzolnier/linux
[linux-2.6-block.git] / fs / dcache.c
index c663c602f9ef97dc74939a8b6ebba95a1b66a7ec..8136bda27a1f8c0cf4b4ca16c2b2c70602ea59c1 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/fs.h>
+#include <linux/fscrypt.h>
 #include <linux/fsnotify.h>
 #include <linux/slab.h>
 #include <linux/init.h>
@@ -284,25 +285,23 @@ static inline int dname_external(const struct dentry *dentry)
 void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry)
 {
        spin_lock(&dentry->d_lock);
+       name->name = dentry->d_name;
        if (unlikely(dname_external(dentry))) {
-               struct external_name *p = external_name(dentry);
-               atomic_inc(&p->u.count);
-               spin_unlock(&dentry->d_lock);
-               name->name = p->name;
+               atomic_inc(&external_name(dentry)->u.count);
        } else {
                memcpy(name->inline_name, dentry->d_iname,
                       dentry->d_name.len + 1);
-               spin_unlock(&dentry->d_lock);
-               name->name = name->inline_name;
+               name->name.name = name->inline_name;
        }
+       spin_unlock(&dentry->d_lock);
 }
 EXPORT_SYMBOL(take_dentry_name_snapshot);
 
 void release_dentry_name_snapshot(struct name_snapshot *name)
 {
-       if (unlikely(name->name != name->inline_name)) {
+       if (unlikely(name->name.name != name->inline_name)) {
                struct external_name *p;
-               p = container_of(name->name, struct external_name, name[0]);
+               p = container_of(name->name.name, struct external_name, name[0]);
                if (unlikely(atomic_dec_and_test(&p->u.count)))
                        kfree_rcu(p, u.head);
        }
@@ -1742,6 +1741,9 @@ struct dentry *d_alloc_cursor(struct dentry * parent)
  * never be anyone's children or parents.  Unlike all other
  * dentries, these will not have RCU delay between dropping the
  * last reference and freeing them.
+ *
+ * The only user is alloc_file_pseudo() and that's what should
+ * be considered a public interface.  Don't use directly.
  */
 struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name)
 {
@@ -1750,7 +1752,6 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name)
                dentry->d_flags |= DCACHE_NORCU;
        return dentry;
 }
-EXPORT_SYMBOL(d_alloc_pseudo);
 
 struct dentry *d_alloc_name(struct dentry *parent, const char *name)
 {
@@ -2797,6 +2798,7 @@ static void __d_move(struct dentry *dentry, struct dentry *target,
        list_move(&dentry->d_child, &dentry->d_parent->d_subdirs);
        __d_rehash(dentry);
        fsnotify_update_flags(dentry);
+       fscrypt_handle_d_move(dentry);
 
        write_seqcount_end(&target->d_seq);
        write_seqcount_end(&dentry->d_seq);