From owner-svn-src-head@FreeBSD.ORG Sun Nov 18 19:36:17 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1EC83E6B; Sun, 18 Nov 2012 19:36:17 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-ea0-f182.google.com (mail-ea0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 27CC98FC08; Sun, 18 Nov 2012 19:36:15 +0000 (UTC) Received: by mail-ea0-f182.google.com with SMTP id a14so236552eaa.13 for ; Sun, 18 Nov 2012 11:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; bh=Qs5ub4KTIBrQTL3Lzdx1HZ+FDmLqoV1iDAqg5fHON54=; b=qgiNP8oe7CNXPDlGah5sKqYki9uzAmudJ/S8SyuDYd7TbLUuGbVUyDxM+4Ko1DGY1T 9pQAuqBHGcPzwMjJLCYrcwVgL/pb2fYkAyY5fk3ifNhWEG4NRfoby5gFn3cwWECIj0TL F0e2fOPyZp79nO7xgPGTgQIBU81YJbdtwK6gz5dR/DJdzfbCW3wMlFTpgYguyFcxMnJA tYrvMJ6BtD8UuZZit1DPNbiVn3p967QrIla6QqHasKQpXTlVgHU1uNXR0i2AOiU005Fi 6E0dpJRgkc2TpbF1bFZhb0inrVGixTt2uZqwzq/lO/+wIKaDQNyrF9z5fwOuyReWv3Dz Ku/w== Received: by 10.14.215.197 with SMTP id e45mr16919700eep.0.1353267375194; Sun, 18 Nov 2012 11:36:15 -0800 (PST) Received: from [192.168.1.104] (45.81.datacomsa.pl. [195.34.81.45]) by mx.google.com with ESMTPS id f2sm19468442eep.2.2012.11.18.11.36.12 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Nov 2012 11:36:14 -0800 (PST) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Subject: Re: svn commit: r243246 - head/sbin/growfs Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=iso-8859-2 From: =?iso-8859-2?Q?Edward_Tomasz_Napiera=B3a?= In-Reply-To: Date: Sun, 18 Nov 2012 20:36:09 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <2AAD2265-B2D9-4407-B44E-FB3235A9B385@FreeBSD.org> References: <201211181901.qAIJ11AY090588@svn.freebsd.org> To: Gavin Atkinson X-Mailer: Apple Mail (2.1283) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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, 18 Nov 2012 19:36:17 -0000 Wiadomo=B6=E6 napisana przez Gavin Atkinson w dniu 18 lis 2012, o godz. = 20:25: > On Sun, 18 Nov 2012, Edward Tomasz Napierala wrote: >=20 >> Author: trasz >> Date: Sun Nov 18 19:01:00 2012 >> New Revision: 243246 >> URL: http://svnweb.freebsd.org/changeset/base/243246 >>=20 >> Log: >> Make it possible to resize filesystems mounted read-write, using = newly >> introduced UFS write suspension mechanism. >>=20 >> Modified: head/sbin/growfs/growfs.c >> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >> --- 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 =3D -1; >> } else { >> - fso =3D open(device, O_WRONLY); >> - if (fso < 0) >> - err(1, "%s", device); >> + if (statfsp !=3D NULL && (statfsp->f_flags & MNT_RDONLY) = =3D=3D 0) { >> + fso =3D open(_PATH_UFSSUSPEND, O_RDWR); >> + if (fso =3D=3D -1) >> + err(1, "unable to open %s", = _PATH_UFSSUSPEND); >> + error =3D ioctl(fso, UFSSUSPEND, = &statfsp->f_fsid); >> + if (error !=3D 0) >> + err(1, "UFSSUSPEND"); >> + } else { >> + fso =3D open(device, O_WRONLY); >> + if (fso < 0) >> + err(1, "%s", device); >> + } >> } >=20 > It is excellent to see this functionality, and it will be very much=20 > appreciated especially for people using virtual machines. Thanks! > All the way through later code there are calls to err() on failure. =20= > What happens to the suspended filesystem if that happens and growfs = exits=20 > before the matching UFSRESUME? Kernel releases the suspension when the process keeping the = filedescriptor exits. It could be said that the UFSRESUME ioctl is there mostly for completeness. And the changes performed by growfs(8) are ordered in a way that keeps the filesystem consistent, so it should be safe to ^C growfs execution without breaking things. --=20 If you cut off my head, what would I say? Me and my head, or me and my = body?