ufs freeze does not work

Hongjiang Zhang honzhan at microsoft.com
Wed Oct 12 05:29:57 UTC 2016

Hi Edward,

I have another question about UFS suspend. Shall I call "sync" before freezing the fs? See it in my code. 
Another question is do you think it is necessary for FreeBSD to provide a such tool? Is there any stat tool for user to know which file partition is freezed?

sync(); // Is this necessary?
error = ioctl(fso, UFSSUSPEND, &statfsp->f_fsid);

Hongjiang Zhang

-----Original Message-----
From: Edward Tomasz Napierała [mailto:etnapierala at gmail.com] On Behalf Of Edward Tomasz Napierala
Sent: Wednesday, June 29, 2016 12:32 PM
To: Mateusz Guzik <mjguzik at gmail.com>
Cc: Hongjiang Zhang <honzhan at microsoft.com>; freebsd-fs at freebsd.org
Subject: Re: ufs freeze does not work

On 0628T2157, Mateusz Guzik wrote:
> On Tue, Jun 28, 2016 at 08:55:23PM +0200, Edward Tomasz Napierała wrote:
> > As I said, the suspension is released when the ufssuspend file 
> > descriptor gets closed - which is what happens when the calling 
> > process exits.  It's a protection mechanism, to avoid the situation 
> > where the process malfunction (eg a crash) would leave the system in unrecoverable (suspended) state.
> > 
> > You probably want your process to just execute another one, and wait 
> > until it exits.
> > 
> The example with freeze -f strongly hints this is supposed to work as 
> a drop in replacement for linux scripts.
> As such, maybe ufs should grow another operation which does not 
> automagically unfreeze.

I'm not sure it's a good idea to provide an inferior mechanism just for backward compatibility with Linux.  Especially given how easy it is to do it properly, modeling the utility after eg lockf(1).

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: freezefs.c
URL: <http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20161012/9eab3e64/attachment.c>

More information about the freebsd-fs mailing list