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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: parted; Reported by: "Brian C. Lane" <bcl@HIDDEN>; Keywords: patch; dated Wed, 11 Sep 2013 20:15:05 UTC; Maintainer for parted is bug-parted@HIDDEN.

Message received at 15347 <at> debbugs.gnu.org:


Received: (at 15347) by debbugs.gnu.org; 29 Oct 2013 15:05:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 29 11:05:21 2013
Received: from localhost ([127.0.0.1]:51275 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VbArA-0002TE-It
	for submit <at> debbugs.gnu.org; Tue, 29 Oct 2013 11:05:20 -0400
Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.120]:55357)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <psusi@HIDDEN>) id 1VbAr7-0002Sl-6F
 for 15347 <at> debbugs.gnu.org; Tue, 29 Oct 2013 11:05:17 -0400
X-Authority-Analysis: v=2.0 cv=dZcCLAre c=1 sm=0 a=/DbS/tiKggfTkRRHPZEB4g==:17
 a=Qsx_du5GiBkA:10 a=sCfsyOEanakA:10 a=kehnMYD-ef0A:10 a=S1A5HrydsesA:10
 a=8nJEP1OIZ-IA:10 a=fxJcL_dCAAAA:8 a=KGjhK52YXX0A:10 a=_hPDvjQ2ZHgA:10
 a=20KFwNOVAAAA:8 a=QfKxxUxMAAAA:8 a=dsuz2wcTK2QiKA7Ud5UA:9 a=wPNLvfGTeEIA:10
 a=jEp0ucaQiEUA:10 a=/DbS/tiKggfTkRRHPZEB4g==:117
X-Cloudmark-Score: 0
X-Authenticated-User: 
X-Originating-IP: 67.78.168.186
Received: from [67.78.168.186] ([67.78.168.186:54465] helo=[10.1.1.236])
 by cdptpa-oedge01.mail.rr.com (envelope-from <psusi@HIDDEN>)
 (ecelerity 2.2.3.46 r()) with ESMTP
 id 20/6D-00725-7AECF625; Tue, 29 Oct 2013 15:05:11 +0000
Message-ID: <526FCEA7.9000902@HIDDEN>
Date: Tue, 29 Oct 2013 11:05:11 -0400
From: Phillip Susi <psusi@HIDDEN>
User-Agent: Mozilla/5.0 (Windows NT 6.1;
 rv:17.0) Gecko/20130801 Thunderbird/17.0.8
MIME-Version: 1.0
To: "Brian C. Lane" <bcl@HIDDEN>
Subject: Re: bug#15347: [PATCH 18/19] libparted: Flush parent device on open
 (#962611)
References: <1378927509-15215-1-git-send-email-bcl@HIDDEN>
 <1378927509-15215-19-git-send-email-bcl@HIDDEN>
In-Reply-To: <1378927509-15215-19-git-send-email-bcl@HIDDEN>
X-Enigmail-Version: 1.5.2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 15347
Cc: 15347 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

-----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@HIDDEN>
> 
> 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-----




Information forwarded to bug-parted@HIDDEN:
bug#15347; Package parted. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Sep 2013 20:14:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 11 16:14:53 2013
Received: from localhost ([127.0.0.1]:56479 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VJqoK-0004EF-R3
	for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:14:53 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45233)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bcl@HIDDEN>) id 1VJqoI-0004Dx-Hj
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:14:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqo5-00015V-4W
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:14:41 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_05 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:51391)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqo5-00015R-1M
 for submit <at> debbugs.gnu.org; Wed, 11 Sep 2013 16:14:33 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46910)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqnz-0002J4-2d
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:14:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqnt-000137-42
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:14:27 -0400
Received: from neil.brianlane.com ([24.113.37.65]:44100
 helo=lister.brianlane.com) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bcl@HIDDEN>) id 1VJqns-0000sS-R8
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 16:14:21 -0400
Received: from lister.brianlane.com (localhost [127.0.0.1])
 by lister.brianlane.com (8.14.7/8.14.7) with ESMTP id r8BJPKUI015346
 for <bug-parted@HIDDEN>; Wed, 11 Sep 2013 12:25:20 -0700
Received: (from bcl@localhost)
 by lister.brianlane.com (8.14.7/8.14.7/Submit) id r8BJPKGn015345
 for bug-parted@HIDDEN; Wed, 11 Sep 2013 12:25:20 -0700
From: "Brian C. Lane" <bcl@HIDDEN>
To: bug-parted@HIDDEN
Subject: [PATCH 18/19] libparted: Flush parent device on open (#962611)
Date: Wed, 11 Sep 2013 12:25:08 -0700
Message-Id: <1378927509-15215-19-git-send-email-bcl@HIDDEN>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1378927509-15215-1-git-send-email-bcl@HIDDEN>
References: <1378927509-15215-1-git-send-email-bcl@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

From: "Brian C. Lane" <bcl@HIDDEN>

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





Acknowledgement sent to "Brian C. Lane" <bcl@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-parted@HIDDEN. Full text available.
Report forwarded to bug-parted@HIDDEN:
bug#15347; Package parted. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

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