]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/open.c
[PATCH] r/o bind mounts: make access() use new r/o helper
[linux-2.6-omap-h63xx.git] / fs / open.c
index 4d690e33446f854f960645a1b57258e133dd5e11..e58382d57e721cf3f381c7c49edb03d547d75135 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -459,8 +459,17 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
        if(res || !(mode & S_IWOTH) ||
           special_file(nd.path.dentry->d_inode->i_mode))
                goto out_path_release;
-
-       if(IS_RDONLY(nd.path.dentry->d_inode))
+       /*
+        * This is a rare case where using __mnt_is_readonly()
+        * is OK without a mnt_want/drop_write() pair.  Since
+        * no actual write to the fs is performed here, we do
+        * not need to telegraph to that to anyone.
+        *
+        * By doing this, we accept that this access is
+        * inherently racy and know that the fs may change
+        * state before we even see this result.
+        */
+       if (__mnt_is_readonly(nd.path.mnt))
                res = -EROFS;
 
 out_path_release: