From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([65.50.211.133]:58245 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752368AbeAQSsb (ORCPT ); Wed, 17 Jan 2018 13:48:31 -0500 From: Christoph Hellwig To: git@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH] enable core.fsyncObjectFiles by default Date: Wed, 17 Jan 2018 19:48:28 +0100 Message-Id: <20180117184828.31816-1-hch@lst.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: fsync is required for data integrity as there is no gurantee that data makes it to disk at any specified time without it. Even for ext3 with data=ordered mode the file system will only commit all data at some point in time that is not guaranteed. I've lost data on development machines with various times countless times due to the lack of this option, and now lost trees on a git server with ext4 as well yesterday. It's time to make git safe by default. Signed-off-by: Christoph Hellwig --- Documentation/config.txt | 6 ++---- environment.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index 0e25b2c92..9a1cec5c8 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -866,10 +866,8 @@ core.whitespace:: core.fsyncObjectFiles:: This boolean will enable 'fsync()' when writing object files. + -This is a total waste of time and effort on a filesystem that orders -data writes properly, but can be useful for filesystems that do not use -journalling (traditional UNIX filesystems) or that only journal metadata -and not file contents (OS X's HFS+, or Linux ext3 with "data=writeback"). +This option is enabled by default and ensures actual data integrity +by calling fsync after writing object files. core.preloadIndex:: Enable parallel index preload for operations like 'git diff' diff --git a/environment.c b/environment.c index 63ac38a46..c74375b5e 100644 --- a/environment.c +++ b/environment.c @@ -36,7 +36,7 @@ const char *git_hooks_path; int zlib_compression_level = Z_BEST_SPEED; int core_compression_level; int pack_compression_level = Z_DEFAULT_COMPRESSION; -int fsync_object_files; +int fsync_object_files = 1; size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE; size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT; size_t delta_base_cache_limit = 96 * 1024 * 1024; -- 2.14.2