aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c
index f8c69d373793..445fd5da11fa 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -716,19 +716,25 @@ static int follow_automount(struct path *path, unsigned flags,
716 if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT)) 716 if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_PARENT))
717 return -EISDIR; /* we actually want to stop here */ 717 return -EISDIR; /* we actually want to stop here */
718 718
719 /* We want to mount if someone is trying to open/create a file of any 719 /*
720 * type under the mountpoint, wants to traverse through the mountpoint
721 * or wants to open the mounted directory.
722 *
723 * We don't want to mount if someone's just doing a stat and they've 720 * We don't want to mount if someone's just doing a stat and they've
724 * set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and 721 * set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and
725 * appended a '/' to the name. 722 * appended a '/' to the name.
726 */ 723 */
727 if (!(flags & LOOKUP_FOLLOW) && 724 if (!(flags & LOOKUP_FOLLOW)) {
728 !(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | 725 /* We do, however, want to mount if someone wants to open or
729 LOOKUP_OPEN | LOOKUP_CREATE))) 726 * create a file of any type under the mountpoint, wants to
730 return -EISDIR; 727 * traverse through the mountpoint or wants to open the mounted
731 728 * directory.
729 * Also, autofs may mark negative dentries as being automount
730 * points. These will need the attentions of the daemon to
731 * instantiate them before they can be used.
732 */
733 if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
734 LOOKUP_OPEN | LOOKUP_CREATE)) &&
735 path->dentry->d_inode)
736 return -EISDIR;
737 }
732 current->total_link_count++; 738 current->total_link_count++;
733 if (current->total_link_count >= 40) 739 if (current->total_link_count >= 40)
734 return -ELOOP; 740 return -ELOOP;