cifs: Fix null pointer check in cifs_read
[linux-2.6-microblaze.git] / fs / dcache.c
index f7931b6..b280e07 100644 (file)
@@ -319,7 +319,7 @@ static inline void __d_set_inode_and_type(struct dentry *dentry,
        flags = READ_ONCE(dentry->d_flags);
        flags &= ~(DCACHE_ENTRY_TYPE | DCACHE_FALLTHRU);
        flags |= type_flags;
-       WRITE_ONCE(dentry->d_flags, flags);
+       smp_store_release(&dentry->d_flags, flags);
 }
 
 static inline void __d_clear_type_and_inode(struct dentry *dentry)
@@ -903,17 +903,19 @@ struct dentry *dget_parent(struct dentry *dentry)
 {
        int gotref;
        struct dentry *ret;
+       unsigned seq;
 
        /*
         * Do optimistic parent lookup without any
         * locking.
         */
        rcu_read_lock();
+       seq = raw_seqcount_begin(&dentry->d_seq);
        ret = READ_ONCE(dentry->d_parent);
        gotref = lockref_get_not_zero(&ret->d_lockref);
        rcu_read_unlock();
        if (likely(gotref)) {
-               if (likely(ret == READ_ONCE(dentry->d_parent)))
+               if (!read_seqcount_retry(&dentry->d_seq, seq))
                        return ret;
                dput(ret);
        }
@@ -1679,7 +1681,7 @@ EXPORT_SYMBOL(d_invalidate);
  * copied and the copy passed in may be reused after this call.
  */
  
-struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
+static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
 {
        struct dentry *dentry;
        char *dname;