Преглед на файлове

Remove --enable-sync-sync codepath

Using sync() on unpack causes _all_ filesystems to be sync'd, which is
not so great when one of those is a thumb drive, mounted over a network,
or otherwise slow. Remove the sync-instead-of-fsync codepath due to
those side-effects and to simplify maintenance.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Guillem Jover <guillem@debian.org>
Jonathan Nieder преди 15 години
родител
ревизия
fdce08c3b9
променени са 4 файла, в които са добавени 4 реда и са изтрити 37 реда
  1. 0 1
      configure.ac
  2. 4 0
      debian/changelog
  3. 0 28
      m4/dpkg-funcs.m4
  4. 0 8
      src/archives.c

+ 0 - 1
configure.ac

@@ -77,7 +77,6 @@ DPKG_DECL_SYS_SIGLIST
 # Checks for library functions.
 DPKG_FUNC_VA_COPY
 DPKG_FUNC_C99_SNPRINTF
-DPKG_FUNC_SYNC_SYNC
 DPKG_CHECK_DECL([offsetof], [stddef.h])
 DPKG_CHECK_DECL([WCOREDUMP], [sys/wait.h])
 DPKG_CHECK_DECL([TIOCNOTTY], [sys/ioctl.h])

+ 4 - 0
debian/changelog

@@ -36,6 +36,10 @@ dpkg (1.16.0) UNRELEASED; urgency=low
     upstream files in Format "1.0" when unpacking to a non-standard
     directory.
 
+  [ Jonathan Nieder ]
+  * Remove support for use of synchronous sync(2), due to its pernicious
+    side-effects and to ease maintenance.
+
   [ Updated programs translations ]
   * Portuguese (Miguel Figueiredo).
   * Spanish (Javier Fernandez-Sanguino).

+ 0 - 28
m4/dpkg-funcs.m4

@@ -85,34 +85,6 @@ AC_DEFUN([DPKG_MMAP],
   ])
 ])
 
-# DPKG_FUNC_SYNC_SYNC
-# --------------------
-# Define USE_SYNC_SYNC if sync() is synchronous and it has been enabled
-# on configure
-AC_DEFUN([DPKG_FUNC_SYNC_SYNC],
-[
-  AC_REQUIRE([AC_CANONICAL_HOST])
-
-  AC_MSG_CHECKING([whether sync is synchronous])
-  AS_CASE([$host_os],
-          [linux-*], [dpkg_cv_sync_sync=yes],
-          [dpkg_cv_sync_sync=no])
-  AC_MSG_RESULT([$dpkg_cv_sync_sync])
-
-  AC_ARG_ENABLE([sync-sync],
-    AS_HELP_STRING([--enable-sync-sync],
-                   [enable usage of synchronous sync(2) if available]),
-    [],
-    [enable_sync_sync=no])
-  AC_MSG_CHECKING([whether to use synchronous sync])
-  AS_IF([test "x$dpkg_cv_sync_sync" = "xyes" &&
-         test "x$enable_sync_sync" = "xyes"],
-        [AC_DEFINE([USE_SYNC_SYNC], 1,
-                   [Define to 1 if sync(2) is synchronous])],
-        [enable_sync_sync=no])
-  AC_MSG_RESULT([$enable_sync_sync])
-])# DPKG_FUNC_SYNC_SYNC
-
 # DPKG_CHECK_COMPAT_FUNCS(LIST)
 # -----------------------
 # Check each function and define an automake conditional

+ 0 - 8
src/archives.c

@@ -895,13 +895,7 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
   struct filenamenode *usenode;
   const char *usename;
 
-#if defined(USE_SYNC_SYNC)
-  debug(dbg_general, "deferred extract mass sync");
-  if (!fc_unsafe_io)
-    sync();
-#else
   tar_writeback_barrier(files, pkg);
-#endif
 
   for (cfile = files; cfile; cfile = cfile->next) {
     debug(dbg_eachfile, "deferred extract of '%.255s'", cfile->namenode->name);
@@ -914,7 +908,6 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
 
     setupfnamevbs(usename);
 
-#if !defined(USE_SYNC_SYNC)
     if (cfile->namenode->flags & fnnf_deferred_fsync) {
       int fd;
 
@@ -930,7 +923,6 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
 
       cfile->namenode->flags &= ~fnnf_deferred_fsync;
     }
-#endif
 
     debug(dbg_eachfiledetail, "deferred extract needs rename");