From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-f196.google.com ([209.85.219.196]:40549 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726951AbeIDPVa (ORCPT ); Tue, 4 Sep 2018 11:21:30 -0400 Received: by mail-yb1-f196.google.com with SMTP id t71-v6so1107256ybi.7 for ; Tue, 04 Sep 2018 03:56:55 -0700 (PDT) Message-ID: <486f6105fd4076c1af67dae7fdfe6826019f7ff4.camel@redhat.com> Subject: Re: POSIX violation by writeback error From: Jeff Layton To: =?UTF-8?Q?=E7=84=A6=E6=99=93=E5=86=AC?= , linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Rogier Wolff Date: Tue, 04 Sep 2018 06:56:53 -0400 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, 2018-09-04 at 13:42 +0800, 焦晓冬 wrote: > Hi, > > After reading several writeback error handling articles from LWN, I > begin to be upset about writeback error handling. > > Jlayton's patch is simple but wonderful idea towards correct error > reporting. It seems one crucial thing is still here to be fixed. Does > anyone have some idea? > > The crucial thing may be that a read() after a successful open()- > write()-close() may return old data. > That may happen where an async writeback error occurs after close() > and the inode/mapping get evicted before read(). > > That violate POSIX as POSIX requires that a read() that can be proved > to occur after a write() has returned will return the new data. That can happen even before a close(), and it varies by filesystem. Most filesystems just pretend the page is clean after writeback failure. It's quite possible to do: write() kernel attempts to write back page and fails page is marked clean and evicted from the cache read() Now your write is gone and there were no calls between the write and read. The question we still need to answer is this: When we attempt to write back some data from the cache and that fails, what should happen to the dirty pages? Unfortunately, there are no good answers given the write/fsync/read model for I/O. I tend to think that in the long run we may need new interfaces to handle this better. -- Jeff Layton