Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[firefly-linux-kernel-4.4.55.git] / drivers / block / drbd / drbd_debugfs.c
index 9a950022ff885d40ba539438f0ff529c34152a47..a6ee3d750c302b435a41533d83c9fa83efd90d06 100644 (file)
@@ -424,7 +424,7 @@ static int in_flight_summary_show(struct seq_file *m, void *pos)
  * So we have our own inline version of it above.  :-( */
 static inline int debugfs_positive(struct dentry *dentry)
 {
-        return dentry->d_inode && !d_unhashed(dentry);
+        return d_really_is_positive(dentry) && !d_unhashed(dentry);
 }
 
 /* make sure at *open* time that the respective object won't go away. */
@@ -439,15 +439,15 @@ static int drbd_single_open(struct file *file, int (*show)(struct seq_file *, vo
         * or has debugfs_remove() already been called? */
        parent = file->f_path.dentry->d_parent;
        /* not sure if this can happen: */
-       if (!parent || !parent->d_inode)
+       if (!parent || d_really_is_negative(parent))
                goto out;
        /* serialize with d_delete() */
-       mutex_lock(&parent->d_inode->i_mutex);
+       mutex_lock(&d_inode(parent)->i_mutex);
        /* Make sure the object is still alive */
        if (debugfs_positive(file->f_path.dentry)
        && kref_get_unless_zero(kref))
                ret = 0;
-       mutex_unlock(&parent->d_inode->i_mutex);
+       mutex_unlock(&d_inode(parent)->i_mutex);
        if (!ret) {
                ret = single_open(file, show, data);
                if (ret)