From: Trond Myklebust The nfs_permission() code needs to check for "local" mount flags such as "ro" *before* it decides to optimize away any permissions tests. --- fs/nfs/dir.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff -puN fs/nfs/dir.c~nfs-readonly-mounts-fix fs/nfs/dir.c --- 25/fs/nfs/dir.c~nfs-readonly-mounts-fix 2004-01-08 18:38:42.000000000 -0800 +++ 25-akpm/fs/nfs/dir.c 2004-01-08 18:38:42.000000000 -0800 @@ -1281,13 +1281,8 @@ nfs_permission(struct inode *inode, int int mode = inode->i_mode; int res; - /* Are we checking permissions on anything other than lookup? */ - if (!(mask & MAY_EXEC)) { - /* We only need to check permissions on file open() and access() */ - if (!nd || !(nd->flags & (LOOKUP_OPEN|LOOKUP_ACCESS))) - return 0; - } - + if (mask == 0) + return 0; if (mask & MAY_WRITE) { /* * @@ -1306,6 +1301,12 @@ nfs_permission(struct inode *inode, int if (IS_IMMUTABLE(inode)) return -EACCES; } + /* Are we checking permissions on anything other than lookup/execute? */ + if ((mask & MAY_EXEC) == 0) { + /* We only need to check permissions on file open() and access() */ + if (!nd || !(nd->flags & (LOOKUP_OPEN|LOOKUP_ACCESS))) + return 0; + } lock_kernel(); _