From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D861C71153 for ; Sun, 27 Aug 2023 02:07:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbjH0CHM (ORCPT ); Sat, 26 Aug 2023 22:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjH0CGn (ORCPT ); Sat, 26 Aug 2023 22:06:43 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77884119; Sat, 26 Aug 2023 19:06:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+9WTEtdJoJCdWG/RW/iQ4SvvA0PSXrKGPAz3wgthcMM=; b=v98jyUypfXy2g3KPttVluyqAaX Wv05VqDdXl4GcezmDMflND5YpP3R9szkoVnwJCR0HFMfkAmaAidU0nzDWpZOcaDJV0Ex74z3RXl8X zMIh+11cKBYDjtreX22RKoiBFKBwEMcrUK1fVqzlUY9o0KWlSMg73pziPR6FAawHVV9xwZ7lwslnx YjF62Tu6pKljXWrDjBjKqpXl8Cjg12d5Qag4GoRWWflAVQgAUxL8MwG+uMQEwzpPbHs6B12kQXk+F M5P0ycqT8BWC+O2MwfakU8NI5QaGnmeb6VdZfU+9yAZzJOu14gvRACWY23eaB9BQt4uRdokNRvoaa Qwf8OQiQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1qa5Ah-001D9H-0v; Sun, 27 Aug 2023 02:06:35 +0000 Date: Sun, 27 Aug 2023 03:06:35 +0100 From: Al Viro To: Joshua Hudson Cc: Bagas Sanjaya , Linux Kernel Mailing List , Linux IDE and libata , Hans de Goede , Jens Axboe , Damien Le Moal , OGAWA Hirofumi Subject: Re: Cache coherency bug: stale reads on /dev/sda1 Message-ID: <20230827020635.GQ3390869@ZenIV> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org On Sat, Aug 26, 2023 at 06:25:58PM -0700, Joshua Hudson wrote: > I am presuming you mean "Are you sure this not a hardware issue?" > > I am sure it is not, for two reasons. > > 1) If it were a hardware issue I would still expect the two device > nodes (whole disk and partition) to report the *same* data. > > 2) I have since developed a workaround involving BLKFLSDEV. The > workaround is really ugly. Whole disk and all partitions have page caches of their own. There is no coherency between those; write through one, then read through another and you are not guaranteed that read won't see the stale cached data. Doctor, it hurts when I do it... Incidentally, read from device/write to the place you've read via file/read from device again also has no coherency warranties, for exact same reason. IOW, not a bug.