···546546 * would make it unreachable from the root,547547 * we might still populate it if it was a548548 * working directory or similar).549549+ * We also need to leave mountpoints alone,550550+ * directory or not.549551 */550550- if (dentry->d_count > 1) {551551- if (dentry->d_inode && S_ISDIR(dentry->d_inode->i_mode)) {552552+ if (dentry->d_count > 1 && dentry->d_inode) {553553+ if (S_ISDIR(dentry->d_inode->i_mode) || d_mountpoint(dentry)) {552554 spin_unlock(&dentry->d_lock);553555 return -EBUSY;554556 }