Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Nov 2012 20:36:09 +0100
From:      =?iso-8859-2?Q?Edward_Tomasz_Napiera=B3a?= <trasz@FreeBSD.org>
To:        Gavin Atkinson <gavin@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r243246 - head/sbin/growfs
Message-ID:  <2AAD2265-B2D9-4407-B44E-FB3235A9B385@FreeBSD.org>
In-Reply-To: <alpine.BSF.2.00.1211181922150.77783@thunderhorn.york.ac.uk>
References:  <201211181901.qAIJ11AY090588@svn.freebsd.org> <alpine.BSF.2.00.1211181922150.77783@thunderhorn.york.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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?




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2AAD2265-B2D9-4407-B44E-FB3235A9B385>