From owner-svn-src-head@FreeBSD.ORG Sun Jan 22 17:32:28 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B43A4106564A; Sun, 22 Jan 2012 17:32:28 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 471A08FC13; Sun, 22 Jan 2012 17:32:27 +0000 (UTC) Received: by bkbc12 with SMTP id c12so2366809bkb.13 for ; Sun, 22 Jan 2012 09:32:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=JuSKv8RMa9ugnNiSW1NjUxBCF91ERJxw//RcFWHAf74=; b=VsLPpttUVsVwrvS1OK/09rpIyFB1H+njvtZHlhx9bLEDQyTJalQ4drW7qDZguxZpVt rTlTTPkjEmGnfQoHzkeVRpe3ian4g2gFRtOCQ57XnTxC8K6l8uYaLhpHVIdoWdVCjy5e 5DgoZyTBEqI4fdxNMNPTNi/5iarzskLYWCuYw= Received: by 10.205.128.4 with SMTP id hc4mr1957696bkc.13.1327253546362; Sun, 22 Jan 2012 09:32:26 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id d2sm22101155bky.11.2012.01.22.09.32.24 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 22 Jan 2012 09:32:25 -0800 (PST) From: Mikolaj Golub To: Jaakko Heinonen References: <201201170125.q0H1PrlJ061058@svn.freebsd.org> <20120117171031.GA2316@a91-153-116-96.elisa-laajakaista.fi> <86obtvvr4v.fsf@kopusha.home.net> <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> X-Comment-To: Jaakko Heinonen Sender: Mikolaj Golub Date: Sun, 22 Jan 2012 19:32:22 +0200 In-Reply-To: <20120122134218.GA2247@a91-153-116-96.elisa-laajakaista.fi> (Jaakko Heinonen's message of "Sun, 22 Jan 2012 15:42:18 +0200") Message-ID: <86lioztzh5.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Kevin Lo , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r230252 - head/sys/fs/tmpfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2012 17:32:28 -0000 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