Index: sys/fs/tmpfs/tmpfs.h =================================================================== --- sys/fs/tmpfs/tmpfs.h +++ sys/fs/tmpfs/tmpfs.h @@ -502,6 +502,8 @@ * specific ones. */ +#define VP_TMPFS_ISRO(vp) ((vp)->v_mount->mnt_flag & MNT_RDONLY) + static inline struct tmpfs_mount * VFS_TO_TMPFS(struct mount *mp) { Index: sys/fs/tmpfs/tmpfs_subr.c =================================================================== --- sys/fs/tmpfs/tmpfs_subr.c +++ sys/fs/tmpfs/tmpfs_subr.c @@ -1509,7 +1509,7 @@ return (EOPNOTSUPP); /* Disallow this operation if the file system is mounted read-only. */ - if (vp->v_mount->mnt_flag & MNT_RDONLY) + if (VP_TMPFS_ISRO(vp)) return EROFS; /* @@ -1559,7 +1559,7 @@ node = VP_TO_TMPFS_NODE(vp); /* Disallow this operation if the file system is mounted read-only. */ - if (vp->v_mount->mnt_flag & MNT_RDONLY) + if (VP_TMPFS_ISRO(vp)) return EROFS; /* Immutable or append-only files cannot be modified, either. */ @@ -1628,7 +1628,7 @@ MPASS(uid != VNOVAL && gid != VNOVAL); /* Disallow this operation if the file system is mounted read-only. */ - if (vp->v_mount->mnt_flag & MNT_RDONLY) + if (VP_TMPFS_ISRO(vp)) return EROFS; /* Immutable or append-only files cannot be modified, either. */ @@ -1693,7 +1693,7 @@ return EISDIR; case VREG: - if (vp->v_mount->mnt_flag & MNT_RDONLY) + if (VP_TMPFS_ISRO(vp)) return EROFS; break; @@ -1742,7 +1742,7 @@ node = VP_TO_TMPFS_NODE(vp); /* Disallow this operation if the file system is mounted read-only. */ - if (vp->v_mount->mnt_flag & MNT_RDONLY) + if (VP_TMPFS_ISRO(vp)) return EROFS; /* Immutable or append-only files cannot be modified, either. */ @@ -1823,7 +1823,8 @@ tmpfs_update(struct vnode *vp) { - tmpfs_itimes(vp, NULL, NULL); + if (!VP_TMPFS_ISRO(vp)) + tmpfs_itimes(vp, NULL, NULL); } int Index: sys/fs/tmpfs/tmpfs_vnops.c =================================================================== --- sys/fs/tmpfs/tmpfs_vnops.c +++ sys/fs/tmpfs/tmpfs_vnops.c @@ -339,7 +339,7 @@ case VLNK: /* FALLTHROUGH */ case VREG: - if (accmode & VWRITE && vp->v_mount->mnt_flag & MNT_RDONLY) { + if (accmode & VWRITE && VP_TMPFS_ISRO(vp)) { error = EROFS; goto out; }