From owner-svn-src-all@FreeBSD.ORG Sun Nov 18 19:26:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 027C5B2A; Sun, 18 Nov 2012 19:26:04 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw12.york.ac.uk (mail-gw12.york.ac.uk [144.32.129.162]) by mx1.freebsd.org (Postfix) with ESMTP id 2F1AF8FC13; Sun, 18 Nov 2012 19:26:03 +0000 (UTC) Received: from ury.york.ac.uk ([144.32.108.81]:10556) by mail-gw12.york.ac.uk with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1TaAV9-0000jN-Hs; Sun, 18 Nov 2012 19:25:55 +0000 Date: Sun, 18 Nov 2012 19:25:55 +0000 (GMT) From: Gavin Atkinson X-X-Sender: gavin@thunderhorn.york.ac.uk To: Edward Tomasz Napierala Subject: Re: svn commit: r243246 - head/sbin/growfs In-Reply-To: <201211181901.qAIJ11AY090588@svn.freebsd.org> Message-ID: References: <201211181901.qAIJ11AY090588@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Sun, 18 Nov 2012 19:26:04 -0000 On Sun, 18 Nov 2012, Edward Tomasz Napierala wrote: > Author: trasz > Date: Sun Nov 18 19:01:00 2012 > New Revision: 243246 > URL: http://svnweb.freebsd.org/changeset/base/243246 > > Log: > Make it possible to resize filesystems mounted read-write, using newly > introduced UFS write suspension mechanism. > > Modified: head/sbin/growfs/growfs.c > ============================================================================== > --- head/sbin/growfs/growfs.c Sun Nov 18 18:57:19 2012 (r243245) > +++ head/sbin/growfs/growfs.c Sun Nov 18 19:01:00 2012 (r243246) > @@ -1555,9 +1557,18 @@ main(int argc, char **argv) > if (Nflag) { > fso = -1; > } else { > - fso = open(device, O_WRONLY); > - if (fso < 0) > - err(1, "%s", device); > + if (statfsp != NULL && (statfsp->f_flags & MNT_RDONLY) == 0) { > + fso = open(_PATH_UFSSUSPEND, O_RDWR); > + if (fso == -1) > + err(1, "unable to open %s", _PATH_UFSSUSPEND); > + error = ioctl(fso, UFSSUSPEND, &statfsp->f_fsid); > + if (error != 0) > + err(1, "UFSSUSPEND"); > + } else { > + fso = open(device, O_WRONLY); > + if (fso < 0) > + err(1, "%s", device); > + } > } It is excellent to see this functionality, and it will be very much appreciated especially for people using virtual machines. All the way through later code there are calls to err() on failure. What happens to the suspended filesystem if that happens and growfs exits before the matching UFSRESUME? Thanks, Gavin