svn commit: r230252 - head/sys/fs/tmpfs

Jaakko Heinonen jh at FreeBSD.org
Mon Jan 23 15:35:05 UTC 2012


On 2012-01-22, Mikolaj Golub wrote:
> Also, may be we should allow remounting ro (and may be some othe options) for
> tmpfs?

Yes, the patch below does that. I suspect that flipping the MNT_RDONLY
flag may be enough for tmpfs but I am not sure.

>  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> %%%

-- 
Jaakko


More information about the svn-src-head mailing list