Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Nov 2012 19:25:55 +0000 (GMT)
From:      Gavin Atkinson <gavin@FreeBSD.org>
To:        Edward Tomasz Napierala <trasz@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:  <alpine.BSF.2.00.1211181922150.77783@thunderhorn.york.ac.uk>
In-Reply-To: <201211181901.qAIJ11AY090588@svn.freebsd.org>
References:  <201211181901.qAIJ11AY090588@svn.freebsd.org>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.1211181922150.77783>