svn commit: r230252 - head/sys/fs/tmpfs
Mikolaj Golub
trociny at freebsd.org
Sun Jan 22 17:32:28 UTC 2012
On Sun, 22 Jan 2012 15:42:18 +0200 Jaakko Heinonen wrote:
JH> Hi,
JH> On 2012-01-22, Mikolaj Golub wrote:
>> JH> # mount -u -o ro /mnt
>> JH> mount: tmpfs : Operation not supported
>> JH> # mount -u -o ro,export /mnt
>> JH> #
>>
>> There is no error but ro is still ignored, so this is only the issue with
>> reporting. Note, the code for nullfs (as an example) looks the same.
JH> This is not true. "ro" is not ignored:
JH> # mount -t tmpfs
JH> tmpfs on /mnt (tmpfs, local)
JH> # mount -u -o ro /mnt
JH> mount: tmpfs: Operation not supported
JH> # mount -t tmpfs
JH> tmpfs on /mnt (tmpfs, local)
JH> # mount -u -o ro,export /mnt
JH> # mount -t tmpfs
JH> tmpfs on /mnt (tmpfs, local, read-only)
Sorry, yes I was wrong. vfs_domount_update() stores old MNT flags and applies
new ones, then calls VFS_MOUNT(), and if it only fails it will restore the old
flags.
So nullfs has the same issue now although the bug is more difficult to expose
as nullfs uses its own mount_nullfs, which currently does not support update
option. Thus to trigger the bug someone has to use nmount(2).
>> It could be fixed with vfs_filteropt(9), not sure if this is worth doing here
>> though.
JH> The problem with vfs_filteropt(9) is that it will allow some additional
JH> options (global_opts list in vfs_mount.c). However those options might
JH> already work sufficiently with update mount. Here is a mostly untested
JH> patch:
When I was looking at mount option interface it also looked for me a bit
"complicated" :-), that is why I hoped we could just ignore the issue if it
were just reporting an error...
Also, may be we should allow remounting ro (and may be some othe options) for
tmpfs?
JH> %%%
JH> Index: sys/fs/tmpfs/tmpfs_vfsops.c
JH> ===================================================================
JH> --- sys/fs/tmpfs/tmpfs_vfsops.c (revision 230328)
JH> +++ sys/fs/tmpfs/tmpfs_vfsops.c (working copy)
JH> @@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = {
JH> NULL
JH> };
JH>
JH> +static const char *tmpfs_updateopts[] = {
JH> + "from", "export", NULL
JH> +};
JH> +
JH> /* --------------------------------------------------------------------- */
JH>
JH> static int
JH> @@ -150,12 +154,10 @@ tmpfs_mount(struct mount *mp)
JH> return (EINVAL);
JH>
JH> if (mp->mnt_flag & MNT_UPDATE) {
JH> - /*
JH> - * Only support update mounts for NFS export.
JH> - */
JH> - if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0))
JH> - return (0);
JH> - return (EOPNOTSUPP);
JH> + /* Only support update mounts for certain options. */
JH> + if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
JH> + return (EOPNOTSUPP);
JH> + return (0);
JH> }
JH>
JH> vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
JH> %%%
JH> --
JH> Jaakko
--
Mikolaj Golub
More information about the svn-src-all
mailing list