diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2008-02-15 17:37:55 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-04-19 00:29:26 -0400 |
commit | 2f676cbc0d60ae806216c7a61c6971bd72dedde8 (patch) | |
tree | 57287366150093260f18bdbe81596492e3e40aa1 /fs | |
parent | 9ac9b8474c39c3ae2c2b37d8e1f08db8a9146124 (diff) |
[PATCH] r/o bind mounts: make access() use new r/o helper
It is OK to let access() go without using a mnt_want/drop_write() pair because
it doesn't actually do writes to the filesystem, and it is inherently racy
anyway. This is a rare case when it is OK to use __mnt_is_readonly()
directly.
Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/open.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -459,8 +459,17 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) | |||
459 | if(res || !(mode & S_IWOTH) || | 459 | if(res || !(mode & S_IWOTH) || |
460 | special_file(nd.path.dentry->d_inode->i_mode)) | 460 | special_file(nd.path.dentry->d_inode->i_mode)) |
461 | goto out_path_release; | 461 | goto out_path_release; |
462 | 462 | /* | |
463 | if(IS_RDONLY(nd.path.dentry->d_inode)) | 463 | * This is a rare case where using __mnt_is_readonly() |
464 | * is OK without a mnt_want/drop_write() pair. Since | ||
465 | * no actual write to the fs is performed here, we do | ||
466 | * not need to telegraph to that to anyone. | ||
467 | * | ||
468 | * By doing this, we accept that this access is | ||
469 | * inherently racy and know that the fs may change | ||
470 | * state before we even see this result. | ||
471 | */ | ||
472 | if (__mnt_is_readonly(nd.path.mnt)) | ||
464 | res = -EROFS; | 473 | res = -EROFS; |
465 | 474 | ||
466 | out_path_release: | 475 | out_path_release: |