Package: dpkg
Version: 1.15.6.1
Severity: important
Tags: patch
User: [email protected]
Usertags: origin-ubuntu ubuntu-patch lucid

The fsync/rename deferral in 1.15.6.1 doesn't actually seem to work
properly; strace doesn't show fsync at all for tarobjects.  No wonder it
performed well!  Admittedly I'm testing with my attempt to backport this
change to Ubuntu, but nevertheless I think I found a real bug:

  if (ti->Type == NormalFile0 || ti->Type == NormalFile0) {

The second of those should be NormalFile1.  Since modern tar files
generally use NormalFile1 rather than NormalFile0, the rename-deferral
path is never taken.

Performance testing will need to be repeated after fixing this bug.  On
ext3, using Ubuntu's linux-headers-2.6.32-20_2.6.32-20.30_all.deb as a
test case, unpack times are within noise before and after the
fsync/rename deferral change with this bug fixed.  I'm seeking testing
on ext4.

Patch attached.

Thanks,

-- 
Colin Watson                                       [[email protected]]
>From 40a254a83dba8bf3b9030fb35b6d4e00eca46e01 Mon Sep 17 00:00:00 2001
From: Colin Watson <[email protected]>
Date: Wed, 14 Apr 2010 10:00:18 +0100
Subject: [PATCH] dpkg: fix rename deferral

Modern tar files typically use NormalFile1 rather than NormalFile0 for
file objects.  A typo meant that the former never triggered rename
deferral.
---
 debian/changelog |    5 +++++
 src/archives.c   |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3c14cc8..b385b80 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,11 @@ dpkg (1.15.6.2) UNRELEASED; urgency=low
     should now start using dpkg-buildflags instead. Closes: #560070
   * For Ubuntu set default value of LDFLAGS to -Wl,-Bsymbolic-functions.
 
+  [ Colin Watson ]
+  * Modern tar files typically use NormalFile1 rather than NormalFile0 for
+    file objects.  A typo meant that the former never triggered rename
+    deferral.
+
   [ Updated dpkg translations ]
   * German (Sven Joachim).
 
diff --git a/src/archives.c b/src/archives.c
index 79fef4e..0608137 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -779,7 +779,7 @@ int tarobject(struct TarInfo *ti) {
    * in dpkg-new.
    */
 
-  if (ti->Type == NormalFile0 || ti->Type == NormalFile0) {
+  if (ti->Type == NormalFile0 || ti->Type == NormalFile1) {
     nifd->namenode->flags |= fnnf_deferred_rename;
 
     debug(dbg_eachfiledetail, "tarobject done and installation deferred");
-- 
1.7.0

Reply via email to