Merge branch 'fscache' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells...
[platform/adaptation/renesas_rcar/renesas_kernel.git] / fs / nfs / dir.c
index 4c5edcc..9a8676f 100644 (file)
@@ -1139,7 +1139,13 @@ out_zap_parent:
        if (inode && S_ISDIR(inode->i_mode)) {
                /* Purge readdir caches. */
                nfs_zap_caches(inode);
-               if (dentry->d_flags & DCACHE_DISCONNECTED)
+               /*
+                * We can't d_drop the root of a disconnected tree:
+                * its d_hash is on the s_anon list and d_drop() would hide
+                * it from shrink_dcache_for_unmount(), leading to busy
+                * inodes on unmount and further oopses.
+                */
+               if (IS_ROOT(dentry))
                        goto out_valid;
        }
        /* If we have submounts, don't unhash ! */
@@ -1458,7 +1464,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry,
 
        trace_nfs_atomic_open_enter(dir, ctx, open_flags);
        nfs_block_sillyrename(dentry->d_parent);
-       inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr);
+       inode = NFS_PROTO(dir)->open_context(dir, ctx, open_flags, &attr, opened);
        nfs_unblock_sillyrename(dentry->d_parent);
        if (IS_ERR(inode)) {
                err = PTR_ERR(inode);