From owner-svn-src-all@FreeBSD.ORG Mon Jan 23 21:05:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DE891065670; Mon, 23 Jan 2012 21:05:49 +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 AA3078FC13; Mon, 23 Jan 2012 21:05:47 +0000 (UTC) Received: by bkbc12 with SMTP id c12so3719712bkb.13 for ; Mon, 23 Jan 2012 13:05:46 -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=M2MZaP/4+TJw4hIBVLC5690KhddqOO5d0GgDVqggnx8=; b=bfysHsgWTc3l3IFA3pkN1KA84tewTDfMIdXA2RzrA+GQL3gfBZJkyNkJLPJy+P9tW9 aCd6EqkMo6vj5ylpL6pOddsFUiYQJHChALjjbTR6C203fHQAsTU7+ilgLH/lcyujqSV0 6pafXpCL2hWqcbxqXRHSesg//RBZt1QKhqyLg= Received: by 10.204.10.82 with SMTP id o18mr3944297bko.20.1327352746676; Mon, 23 Jan 2012 13:05:46 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id iu2sm31116982bkb.0.2012.01.23.13.05.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 13:05:45 -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> <86lioztzh5.fsf@kopusha.home.net> <20120123153457.GA2246@a91-153-116-96.elisa-laajakaista.fi> X-Comment-To: Jaakko Heinonen Sender: Mikolaj Golub Date: Mon, 23 Jan 2012 23:05:42 +0200 In-Reply-To: <20120123153457.GA2246@a91-153-116-96.elisa-laajakaista.fi> (Jaakko Heinonen's message of "Mon, 23 Jan 2012 17:34:57 +0200") Message-ID: <86vco2yvrt.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-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2012 21:05:49 -0000 On Mon, 23 Jan 2012 17:34:57 +0200 Jaakko Heinonen wrote: JH> On 2012-01-22, Mikolaj Golub wrote: >> Also, may be we should allow remounting ro (and may be some othe options) for >> tmpfs? JH> Yes, the patch below does that. I suspect that flipping the MNT_RDONLY JH> flag may be enough for tmpfs but I am not sure. I see two issues with this patch: 1) 'mount -u -o rw /mnt' does not upgrade to rw, although it returns success. 2) if you have a file open for write, after remounting ro you still can write to the file. The expected behaviour: remount fails with EBUSY if force option is not specified; after remounting with force writing to the fail fails with EIO. I think when remounting ro you should call vflush(), something like below: flags = WRITECLOSE; if (mp->mnt_flag & MNT_FORCE) flags |= FORCECLOSE; error = vflush(mp, 0, flags, curthread); if (error != 0) return (error); MNT_ILOCK(mp); mp->mnt_flag |= MNT_RDONLY; MNT_IUNLOCK(mp); and when upgrading to rw reset MNT_RDONLY flag: MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_RDONLY; MNT_IUNLOCK(mp); I have no idea if something else is needed 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