VFS: Fix automount for negative autofs dentries (rhbz#719607)

This commit is contained in:
Chuck Ebbert 2011-08-25 01:09:30 -04:00
parent a22cd81f84
commit 8b2df4baf0
2 changed files with 66 additions and 0 deletions

View File

@ -609,6 +609,7 @@ Patch1501: xen-blkfront-name-adjust.patch
# nouveau + drm fixes
Patch1810: drm-nouveau-updates.patch
Patch1811: drm-ttm-nouveau-oops-fix.patch
# intel drm is all merged upstream
Patch1824: drm-intel-next.patch
# make sure the lvds comes back on lid open
@ -669,6 +670,9 @@ Patch21002: arm-readl.patch
Patch21003: TEGRA-2.6.40.2-enable-USB-ports.patch
# rhbz#719607
Patch21004: vfs-fix-automount-for-negative-autofs-dentries.patch
%endif
BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@ -1207,6 +1211,9 @@ ApplyPatch iwlagn-revert-max-aggregate-size.patch
ApplyPatch utrace.patch
# rhbz#719607
ApplyPatch vfs-fix-automount-for-negative-autofs-dentries.patch
# END OF PATCH APPLICATIONS
%endif
@ -1827,6 +1834,9 @@ fi
# and build.
%changelog
* Thu Aug 25 2011 Chuck Ebbert <cebbert@redhat.com>
- VFS: Fix automount for negative autofs dentries (rhbz#719607)
* Thu Aug 25 2011 Ben Skeggs <bskeggs@redhat.com>
- nouveau: add patch fixing ttm issues that lead to oopses/corruption (rhbz#699551)

View File

@ -0,0 +1,56 @@
From: David Howells <dhowells@redhat.com>
Date: Mon, 11 Jul 2011 13:20:57 +0000 (+0100)
Subject: VFS: Fix automount for negative autofs dentries
X-Git-Tag: v3.1-rc1~91^2~12
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=5a30d8a2b8ddd5102c440c7e5a7c8e1fd729c818
VFS: Fix automount for negative autofs dentries
[ backport for 3.0.x: LOOKUP_PARENT => LOOKUP_CONTINUE ]
Autofs may set the DCACHE_NEED_AUTOMOUNT flag on negative dentries. These
need attention from the automounter daemon regardless of the LOOKUP_FOLLOW flag.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/fs/namei.c b/fs/namei.c
index f8c69d3..445fd5d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -716,19 +716,25 @@ static int follow_automount(struct path *path, unsigned flags,
if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_CONTINUE))
return -EISDIR; /* we actually want to stop here */
- /* We want to mount if someone is trying to open/create a file of any
- * type under the mountpoint, wants to traverse through the mountpoint
- * or wants to open the mounted directory.
- *
+ /*
* We don't want to mount if someone's just doing a stat and they've
* set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and
* appended a '/' to the name.
*/
- if (!(flags & LOOKUP_FOLLOW) &&
- !(flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
- LOOKUP_OPEN | LOOKUP_CREATE)))
- return -EISDIR;
-
+ if (!(flags & LOOKUP_FOLLOW)) {
+ /* We do, however, want to mount if someone wants to open or
+ * create a file of any type under the mountpoint, wants to
+ * traverse through the mountpoint or wants to open the mounted
+ * directory.
+ * Also, autofs may mark negative dentries as being automount
+ * points. These will need the attentions of the daemon to
+ * instantiate them before they can be used.
+ */
+ if (!(flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
+ LOOKUP_OPEN | LOOKUP_CREATE)) &&
+ path->dentry->d_inode)
+ return -EISDIR;
+ }
current->total_link_count++;
if (current->total_link_count >= 40)
return -ELOOP;