Commit 2f676cbc authored by Dave Hansen's avatar Dave Hansen Committed by Al Viro

[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()
Acked-by: default avatarAl Viro <>
Signed-off-by: default avatarChristoph Hellwig <>
Signed-off-by: default avatarDave Hansen <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarAl Viro <>
parent 9ac9b847
......@@ -459,8 +459,17 @@ asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode)
if(res || !(mode & S_IWOTH) ||
goto out_path_release;
* 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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment