Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2401141imm; Tue, 4 Sep 2018 03:58:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZcDMpi9QrS9Xr4Z74PJVe4W/2ndhtzk2NLaCNe2rsGspPh4pR7AV24hvBqX2oZHHkAihpx X-Received: by 2002:aa7:8118:: with SMTP id b24-v6mr34432719pfi.78.1536058698384; Tue, 04 Sep 2018 03:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536058698; cv=none; d=google.com; s=arc-20160816; b=Yx7bpgbQKO3J1wmXPaM1aoi061K6bunVvr5g/v44LR+RAMRO+Wc2ZJfopx5DIiL0xA SSu1GH4FhqOClKId1klPyaQh5JYTADu3MQ+5owNeTG8XCPV0E0x3y+EBQgx2msIVCSvJ YT29213LlxESMHNQ6UZyRMiYDWBBYmqWQpuB0tI/J9nRseXOcb5Gyhx2KtooB9KuMNFI 1tPqOsBH6vHnufn337dy0gCvWnjI+fAmhHkPBrpOCauFdDnI3Q5Sv68CyUACb4/OxG3U 5O/Dgi7/qn2zjHnDGCyDm/ugufL4l0a+4QvfwbdFxr93+nPtSWg2wkq5KxDXDNoPqYkq BCfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=OprbpS3vhusD9yY8I6Dv1ZZO0fM3KLRhcUIMBCLFvQo=; b=l/Ci+U96NoDW1zRU2f0yi2DIxY7miWAdv6GzInUUL31mKukM5sx4R48NUNx3fQaAFe iFsU0d/GrUubFnpn8A5c0kRMEG4vq62L+p4Y/lxGvOFAqWEzZ8JDss2foLOv5et2XzkG PMfFNDuXlnfNecCSBtWdPvD5M+vGnii45nSssfmthzfaZo57JmeXEWI8LUBBUBeV1qa0 dSgEEav3YXANzIoAaIf/agybodb7xJyXIAH5Xz0OKXn1VLr0QDCdcXC1yGR8u9HVgHnI WOct5Lhw9+g4XfSUwPuWof6b7kyoJfaomfyIzxuhDOcilYwvj9nI0S+0y8jMQuowNf01 W7gw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i184-v6si23276290pfb.98.2018.09.04.03.58.02; Tue, 04 Sep 2018 03:58:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727255AbeIDPVa (ORCPT + 99 others); Tue, 4 Sep 2018 11:21:30 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:46319 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727024AbeIDPVa (ORCPT ); Tue, 4 Sep 2018 11:21:30 -0400 Received: by mail-yb1-f195.google.com with SMTP id y20-v6so1096469ybi.13 for ; Tue, 04 Sep 2018 03:56:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=OprbpS3vhusD9yY8I6Dv1ZZO0fM3KLRhcUIMBCLFvQo=; b=fAeelqIH3bTMyoZ5oJ2IjJAOnSgYVbHYDsZIMFrRZPx/+EQbonh+gE30MJx5CUss/U GC2L1BGJ0qHsta96x+TRNtKiw65UBDchc5ORXUb5ei/5JxH6PKWURS4vuG5MUO/ZqR2p yovEiIRSQVjyvAMfVhzm3PrTt8Pe55CtkV8G0NcyL4QGPJDZX/A6Bz6B3fNf1Pp6Kymp 8BOl+hSEuAQOQlhCk870UkOHMiPJ6pXvUihesZnVMTq1e3eJa3RAkpamzzeWWFXZNEMj 0m5QkQJKvnY2laA66pL2vDKhzyIk6h1f4Myb2Vt4sUK+SWLag2yN5zZ3OYtQfc9RoNzl 3OuA== X-Gm-Message-State: APzg51AUlQyT4DN3r1JriGhFho252xjIj/YcuDZa4EQpdlYEak20NSqV ahSnY4vXnQm3OpnhbXpvj1DNJw== X-Received: by 2002:a5b:749:: with SMTP id s9-v6mr10144281ybq.79.1536058614925; Tue, 04 Sep 2018 03:56:54 -0700 (PDT) Received: from tleilax.poochiereds.net (cpe-2606-A000-1100-DB-0-0-0-161.dyn6.twc.com. [2606:a000:1100:db::161]) by smtp.gmail.com with ESMTPSA id t10-v6sm9253434ywg.74.2018.09.04.03.56.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Sep 2018 03:56:54 -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" X-Mailer: Evolution 3.28.5 (3.28.5-1.fc28) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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