From owner-freebsd-current@FreeBSD.ORG Tue Sep 15 04:00:32 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1060) id 4F345106566C; Tue, 15 Sep 2009 04:00:32 +0000 (UTC) Date: Tue, 15 Sep 2009 04:00:32 +0000 From: Craig Rodrigues To: Jaakko Heinonen Message-ID: <20090915040032.GA68823@crodrigues.org> References: <20090908202553.GA1368@mr-happy.com> <200909090902.34055.mel.flynn+fbsd.current@mailing.thruhere.net> <20090910091329.GA2726@a91-153-125-115.elisa-laajakaista.fi> <200909140302.03003.mel.flynn+fbsd.current@mailing.thruhere.net> <20090914173208.GA4273@a91-153-125-115.elisa-laajakaista.fi> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="CE+1k2dSO48ffgeK" Content-Disposition: inline In-Reply-To: <20090914173208.GA4273@a91-153-125-115.elisa-laajakaista.fi> User-Agent: Mutt/1.4.2.1i Cc: Mel Flynn , freebsd-current@freebsd.org, Pawel Jakub Dawidek , Jeff Blank Subject: Re: 8.0-BETA4 panic: ffs_sync: rofs mod X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 04:00:32 -0000 --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Sep 14, 2009 at 08:32:09PM +0300, Jaakko Heinonen wrote: > Calling nmount() with "update" and "export" string options shouldn't > affect to any other options in any way. The problem is that the mount > point has both "ro" and "rw" options active before mountd calls > nmount(). Because of the "ro" option FFS mount code changes the file > system to read-only. The FFS code looks for "ro" string option only when > doing mount updates. Hi, Instead of using your proposed patch, could you try this patch? I originally wrote all the has_rw/has_ro stuff for nmount() in 2006. Getting the mount update behavior for ro -> rw was a big pain in the neck, especially because the userland mount programs and the mount code for the various file systems were slightly inconsistent. Looking back, I should have done it this way, but at the time I wasn't sure how all the mount update stuff worked across the different file systems. -- Craig Rodrigues rodrigc@crodrigues.org --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="vfs_mount.c.txt" Index: sys/kern/vfs_mount.c =================================================================== --- sys/kern/vfs_mount.c (revision 190314) +++ sys/kern/vfs_mount.c (working copy) @@ -583,16 +583,13 @@ vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions) { struct vfsoptlist *optlist; - struct vfsopt *opt, *noro_opt, *tmp_opt; + struct vfsopt *opt, *tmp_opt; char *fstype, *fspath, *errmsg; int error, fstypelen, fspathlen, errmsg_len, errmsg_pos; - int has_rw, has_noro; errmsg = NULL; errmsg_len = 0; errmsg_pos = -1; - has_rw = 0; - has_noro = 0; error = vfs_buildopts(fsoptions, &optlist); if (error) @@ -686,11 +683,11 @@ } else if (strcmp(opt->name, "noro") == 0) { fsflags &= ~MNT_RDONLY; - has_noro = 1; } else if (strcmp(opt->name, "rw") == 0) { + free(opt->name, M_MOUNT); + opt->name = strdup("noro", M_MOUNT); fsflags &= ~MNT_RDONLY; - has_rw = 1; } else if (strcmp(opt->name, "ro") == 0) fsflags |= MNT_RDONLY; @@ -708,20 +705,6 @@ } /* - * If "rw" was specified as a mount option, and we - * are trying to update a mount-point from "ro" to "rw", - * we need a mount option "noro", since in vfs_mergeopts(), - * "noro" will cancel "ro", but "rw" will not do anything. - */ - if (has_rw && !has_noro) { - noro_opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK); - noro_opt->name = strdup("noro", M_MOUNT); - noro_opt->value = NULL; - noro_opt->len = 0; - TAILQ_INSERT_TAIL(optlist, noro_opt, link); - } - - /* * Be ultra-paranoid about making sure the type and fspath * variables will fit in our mp buffers, including the * terminating NUL. --CE+1k2dSO48ffgeK--