cachefiles: extend ro check to private mount
So far cachefiles only verified that the superblock wasn't read-only but
didn't check whether the mount was. This made sense when we did not use
a private mount because the read-only state could change at any point.
Now that we have a private mount and mount properties can't change
behind our back extend the read-only check to include the vfsmount.
The __mnt_is_readonly() helper will check both the mount and the
superblock. Note that before we checked root->d_sb and now we check
mnt->mnt_sb but since we have a matching <vfsmount, dentry> pair here
this is only syntactical change, not a semantic one.
Here's how this works:
mount -o ro --bind /var/cache/fscache/ /var/cache/fscache/
systemctl start cachefilesd
Job for cachefilesd.service failed because the control process exited with error code.
See "systemctl status cachefilesd.service" and "journalctl -xe" for details.
dmesg | grep CacheFiles
[ 2.922514] CacheFiles: Loaded
[ 272.206907] CacheFiles: Failed to register: -30
errno 30
EROFS 30 Read-only file system
Cc: David Howells <dhowells@redhat.com>
Cc: linux-cachefs@redhat.com
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
/* v2 */
patch introduced
1 file changed