GNU bug report logs - #15347
[PATCH 18/19] libparted: Flush parent device on open (#962611)

Previous Next

Package: parted;

Reported by: "Brian C. Lane" <bcl <at> redhat.com>

Date: Wed, 11 Sep 2013 20:15:05 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 15347 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#15347; Package parted. (Wed, 11 Sep 2013 20:15:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Brian C. Lane" <bcl <at> redhat.com>:
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Wed, 11 Sep 2013 20:15:07 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: bug-parted <at> gnu.org
Subject: [PATCH 18/19] libparted: Flush parent device on open (#962611)
Date: Wed, 11 Sep 2013 12:25:08 -0700
From: "Brian C. Lane" <bcl <at> redhat.com>

Parted probes for filesystems using geometry offsets into the parent
device, not the partition device itself. This means it may get stale
information if a partition has just been formatted.

On kernels before 2.6 this will also flush all partition devices. On 2.6
and newer kernels it will only flush the parent device.

* libparted/arch/linux.c (linux_open): Always call _flush_cache
---
 libparted/arch/linux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 375be83..492f828 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -1669,9 +1669,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.3.1





Information forwarded to bug-parted <at> gnu.org:
bug#15347; Package parted. (Tue, 29 Oct 2013 15:06:02 GMT) Full text and rfc822 format available.

Message #8 received at 15347 <at> debbugs.gnu.org (full text, mbox):

From: Phillip Susi <psusi <at> ubuntu.com>
To: "Brian C. Lane" <bcl <at> redhat.com>
Cc: 15347 <at> debbugs.gnu.org
Subject: Re: bug#15347: [PATCH 18/19] libparted: Flush parent device on open
 (#962611)
Date: Tue, 29 Oct 2013 11:05:11 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I believe I know why this seems to work for you, and how to show that
it doesn't:  If you run mkfs on the partition and it is the only thing
that has an open handle to it, when it exits, the kernel automatically
flushes the partition.  If you have another process with an open fd to
the partition ( sleep 300 < /dev/sda1 & ) then you can run mkfs
immediately followed by parted print, and it should read the stale
data, since the partition is not flushed when mkfs exits, due to the
other open handle.

On 9/11/2013 3:25 PM, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl <at> redhat.com>
> 
> Parted probes for filesystems using geometry offsets into the
> parent device, not the partition device itself. This means it may
> get stale information if a partition has just been formatted.
> 
> On kernels before 2.6 this will also flush all partition devices.
> On 2.6 and newer kernels it will only flush the parent device.
> 
> * libparted/arch/linux.c (linux_open): Always call _flush_cache 
> --- libparted/arch/linux.c | 4 +--- 1 file changed, 1 insertion(+),
> 3 deletions(-)
> 
> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c index
> 375be83..492f828 100644 --- a/libparted/arch/linux.c +++
> b/libparted/arch/linux.c @@ -1669,9 +1669,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; }
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJSb86mAAoJEJrBOlT6nu75XagIAMD1i+OXsK3QvE82DpLOby+7
UaB0SFXkr2Er0Mcwx1oSA4hctMOLfz0BaMPWDiy28LLafyvmY56uwP0K8i7d4jjo
PSN1RqpJUfkUhk6JYj1EalqHBv0/YT4ZjPLSKrVfJEziQPq0/wlQMSrNH3GJ4vc6
LZzTctS4v4LLXb1p0KHFq09RwD16c8xJW/5vzZy60nNnn+4SoIRjF8EU2MSi8nQ9
EJpf3F9JzIJX+x+6LLvyOtG+rgqQoyYS0BFHf5B3AYYwLAnEHDvKhC35uq53JtmX
wPfv374jGH8PSuusNxdC/PiueqUNqaL30yAmyCcg6iwsHhk74DDICk2hgZpCxAY=
=87SO
-----END PGP SIGNATURE-----




This bug report was last modified 11 years and 234 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.