Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Feb 2002 21:23:08 -0800
From:      Kirk McKusick <mckusick@mckusick.com>
To:        Maxim Sobolev <sobomax@FreeBSD.ORG>
Cc:        des@ofug.org (Dag-Erling Smorgrav), cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/kern vfs_subr.c src/sys/ufs/ffs ffs_inode.c ffs_vfsops.c src/sys/ufs/ufs ufs_inode.c ufs_vnops.c 
Message-ID:  <200202110523.g1B5N8i06332@beastie.mckusick.com>
In-Reply-To: Your message of "Tue, 15 Jan 2002 16:02:05 %2B0200." <200201151403.g0FE3P321197@vega.vega.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
    From: Maxim Sobolev <sobomax@FreeBSD.ORG>
    Subject: Re: cvs commit: src/sys/kern vfs_subr.c src/sys/ufs/ffs ffs_inode.c ffs_vfsops.c src/sys/ufs/ufs ufs_inode.c ufs_vnops.c
    To: des@ofug.org (Dag-Erling Smorgrav)
    Date: Tue, 15 Jan 2002 16:02:05 +0200 (EET)
    Cc: mckusick@FreeBSD.ORG (Kirk McKusick), cvs-committers@FreeBSD.ORG,
       cvs-all@FreeBSD.ORG

    > 
    > Kirk McKusick <mckusick@FreeBSD.org> writes:
    > >   Log:
    > >   When downgrading a filesystem from read-write to read-only, operations
    > >   involving file removal or file update were not always being fully
    > >   committed to disk. The result was lost files or corrupted file data.
    > >   This change ensures that the filesystem is properly synced to disk
    > >   before the filesystem is down-graded.
    > 
    > Thank you, thank you, thank you, thank you!

    Could we have similar behaviour (i.e. data syncing) when going into a
    sleep mode? Several days ago I've lost a file that I saved right before
    my battery went low and then for some reason the system refused to resume
    properly after a sleep. BTW, I wonder how it's possible on a softupdates
    fs - my understanding was that I should have either older or newer version
    of the file - not obsolutely useless zero-sized file (and nothing in
    /lost+found). :(((

    -Maxim

What soft updates guarrantees is that you do not end up with a file
full of garbage. You may get one of zero length if the data has not
been written. Applications (like editors) are supposed to do fsync
before removing the old copy. Specifically, they should do the
equivalent of:

	write file.new
	fsync file.new
	rename file.new file

and if you want to make sure that the name file will refer to the
new contents rather than the old ones:

	fsync file

		Kirk McKusick

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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