From: Arvin Schnell Date: Thu, 27 Aug 2020 10:07:54 +0000 (+0200) Subject: - call fsync after writing snapshot info file (bsc#1078336) X-Git-Tag: v0.8.13~1^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d99a6cdcb88a368fb40dc730707ad8e7d7a4d7c6;p=thirdparty%2Fsnapper.git - call fsync after writing snapshot info file (bsc#1078336) --- diff --git a/LIBVERSION b/LIBVERSION index 0062ac97..6b244dcd 100644 --- a/LIBVERSION +++ b/LIBVERSION @@ -1 +1 @@ -5.0.0 +5.0.1 diff --git a/VERSION b/VERSION index 7eff8ab9..c2f73c6e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.12 +0.8.13 diff --git a/package/snapper.changes b/package/snapper.changes index 04dc9fbf..2543b8f6 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Aug 27 12:04:44 CEST 2020 - aschnell@suse.com + +- call fsync after writing snapshot info file (bsc#1078336) +- version 0.8.13 + ------------------------------------------------------------------- Thu Jul 23 11:52:31 CEST 2020 - aschnell@suse.com diff --git a/snapper/FileUtils.cc b/snapper/FileUtils.cc index 7c8f2358..0b3c453d 100644 --- a/snapper/FileUtils.cc +++ b/snapper/FileUtils.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2011-2014] Novell, Inc. - * Copyright (c) 2018 SUSE LLC + * Copyright (c) [2018-2020] SUSE LLC * * All Rights Reserved. * @@ -379,6 +379,13 @@ namespace snapper } + int + SDir::fsync() const + { + return ::fsync(dirfd); + } + + int SDir::mktemp(string& name) const { diff --git a/snapper/FileUtils.h b/snapper/FileUtils.h index 21eed797..3cd2e56e 100644 --- a/snapper/FileUtils.h +++ b/snapper/FileUtils.h @@ -1,5 +1,6 @@ /* * Copyright (c) [2011-2014] Novell, Inc. + * Copyright (c) 2020 SUSE LLC * * All Rights Reserved. * @@ -90,6 +91,7 @@ namespace snapper int chmod(const string& name, mode_t mode, int flags) const; int chown(const string& name, uid_t owner, gid_t group, int flags) const; int rename(const string& oldname, const string& newname) const; + int fsync() const; int mktemp(string& name) const; bool mkdtemp(string& name) const; diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 89db0472..f242d464 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -1,6 +1,6 @@ /* * Copyright (c) [2011-2015] Novell, Inc. - * Copyright (c) [2016-2019] SUSE LLC + * Copyright (c) [2016-2020] SUSE LLC * * All Rights Reserved. * @@ -491,6 +491,8 @@ namespace snapper SN_THROW(IOErrorException(sformat("rename info.xml failed infoDir:%s errno:%d (%s)", info_dir.fullname().c_str(), errno, stringerror(errno).c_str()))); + + info_dir.fsync(); } diff --git a/snapper/XmlFile.cc b/snapper/XmlFile.cc index bf3f6385..ee5d9b85 100644 --- a/snapper/XmlFile.cc +++ b/snapper/XmlFile.cc @@ -1,5 +1,6 @@ /* * Copyright (c) [2010-2012] Novell, Inc. + * Copyright (c) 2020 SUSE LLC * * All Rights Reserved. * @@ -75,6 +76,8 @@ namespace snapper throw IOErrorException("xmlDocFormatDump failed"); } + fflush(f); + fsync(fileno(f)); fclose(f); }