EDAC, ghes: Model a single, logical memory controller
[sfrench/cifs-2.6.git] / fs / namei.c
index ddb6a7c2b3d4aee1c3512e064350822533968dc5..c75ea03ca147ec81977f67929b7f4489b90cf42e 100644 (file)
@@ -447,8 +447,7 @@ static int sb_permission(struct super_block *sb, struct inode *inode, int mask)
                umode_t mode = inode->i_mode;
 
                /* Nobody gets write access to a read-only fs. */
-               if ((sb->s_flags & MS_RDONLY) &&
-                   (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
+               if (sb_rdonly(sb) && (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
                        return -EROFS;
        }
        return 0;
@@ -1129,9 +1128,18 @@ static int follow_automount(struct path *path, struct nameidata *nd,
         * of the daemon to instantiate them before they can be used.
         */
        if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
-                          LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) &&
-           path->dentry->d_inode)
-               return -EISDIR;
+                          LOOKUP_OPEN | LOOKUP_CREATE |
+                          LOOKUP_AUTOMOUNT))) {
+               /* Positive dentry that isn't meant to trigger an
+                * automount, EISDIR will allow it to be used,
+                * otherwise there's no mount here "now" so return
+                * ENOENT.
+                */
+               if (path->dentry->d_inode)
+                       return -EISDIR;
+               else
+                       return -ENOENT;
+       }
 
        if (path->dentry->d_sb->s_user_ns != &init_user_ns)
                return -EACCES;