parted/0061-Revert-linux-commit-do-not-unnecessarily-open-partit.patch

94 lines
3.2 KiB
Diff
Raw Normal View History

From fb99ba5ebd0dc34204fc9f1014131d5d494805bc Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
Date: Sat, 5 Jan 2013 22:59:35 -0500
Subject: [PATCH 61/89] Revert "linux-commit: do not unnecessarily open
partition device nodes"
This reverts commit 2a6936fab4d4499a4b812dd330d3db50549029e0. The commit
disabled flushing the block buffer caches on the partition nodes to ensure
cache consistency on 2.6 kernels, supposedly because this was no longer
required. It appears this was incorrect, and the caches DO still need
flushed, otherwise a new fs written to the partition device does not show
up in the disk device cache, causing parted to still identify the old fs.
---
NEWS | 5 +++++
libparted/arch/linux.c | 25 +++----------------------
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/NEWS b/NEWS
index a05be02..6538c96 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,11 @@ GNU parted NEWS -*- outline -*-
** Bug Fixes
+ Fix cache coherency issue by flushing partition block devices.
+ This had been mistakenly disabled in parted 2.0, and resulted
+ in parted sometimes identifying the previous filesystem type
+ after running an mkfs to format a partition to a new type.
+
libparted: fix gpt end of disk handling. Previously if the backup
copy of the gpt was not at the end of the disk and you chose to
ignore this error, parted would move it to the end of the disk
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 05794d9..4b1b438 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -703,19 +703,6 @@ _get_linux_version ()
return kver = KERNEL_VERSION (major, minor, teeny);
}
-static int
-_have_kern26 ()
-{
- static int have_kern26 = -1;
- int kver;
-
- if (have_kern26 != -1)
- return have_kern26;
-
- kver = _get_linux_version();
- return have_kern26 = kver >= KERNEL_VERSION (2,6,0) ? 1 : 0;
-}
-
#if USE_BLKID
static void
get_blkid_topology (LinuxSpecific *arch_specific)
@@ -1567,8 +1554,8 @@ linux_is_busy (PedDevice* dev)
return 0;
}
-/* we need to flush the master device, and with kernel < 2.6 all the partition
- * devices, because there is no coherency between the caches with old kernels.
+/* we need to flush the master device, and all the partition devices,
+ * because there is no coherency between the caches.
* We should only flush unmounted partition devices, because:
* - there is never a need to flush them (we're not doing IO there)
* - flushing a device that is mounted causes unnecessary IO, and can
@@ -1586,10 +1573,6 @@ _flush_cache (PedDevice* dev)
ioctl (arch_specific->fd, BLKFLSBUF);
- /* With linux-2.6.0 and newer, we're done. */
- if (_have_kern26())
- return;
-
for (i = 1; i < 16; i++) {
char* name;
int fd;
@@ -1654,9 +1637,7 @@ retry:
dev->read_only = 0;
}
- /* With kernels < 2.6 flush cache for cache coherence issues */
- if (!_have_kern26())
- _flush_cache (dev);
+ _flush_cache (dev);
return 1;
}
--
1.8.5.3