Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1559903ybl; Wed, 28 Aug 2019 17:08:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqykd+syZPuer5MBhoywgor1rlFCOluGBaMiGahVMqMDcCyY1CgY2utVAH2x0zGd3gquP1jc X-Received: by 2002:a17:90a:9f01:: with SMTP id n1mr6786581pjp.103.1567037282739; Wed, 28 Aug 2019 17:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567037282; cv=none; d=google.com; s=arc-20160816; b=UQns0qw0mOCcIL07aBdP751kc6kcuAKrOmKX5Nr0/fIs2qWR6Eq/h105kq3dLckVcx iktkIdad59iSgNQTRaOmxEKD8miQQQjhGggnbMJX7Vt50M8LmSGNjRB55NeH/WMgzJAB UQXIb7oo94BzeEeREoUK2zg/RUdwQi0ozjWtiZcXAfPDEAtbvzD4kzXkrPTJ7737QXUd AKJTXAD3ax7u9hjJvmb2AIZ+B37keQppx70lvSBZmg5+6B+f4fWX4s2Z2f/gXCTglZ8T v9Hh0IISrONe7ucNDqlAiOupWnAk0VH0O+9N8RZvAPThWw4UQrK3mf/79h32e44X6OVh /v+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Wspgap3Tf9JL/6azrZxB+h+6c/nV/dmEy9Ir2yl5KrQ=; b=AomKzFdeJbWJDKEhR9cFyLc6D+Elueym/kvGFCtu1pEK/Cww/l8p4oZnSzJ7t8ocHB Y3JZn4JZpgND8sZqUp8tI4E2f/1ON30Ow09+5KRyBYfoTRGZTsF0MA2zWLQ7dTry4hKZ pqr8Begl9gteN35Nr2974Lw+CFTyhDAcBaQNfSUSsujczWPbWSLBwZFBVM+dPl6Nhhmb 8qXlmPAEZD095eBw0ot5KUyYeQDtLFyuqaH/4GdC5AmKXrO4vVtb7wjZvY5gBPDFkUCR FPcTU//ffpfykGkLa3cER+lwa/D8lWyVzS+Dq3ueF9MV40HJ6etutFOuTP39tsQZtZyV B84w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TbFpvo9P; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k67si519132pgc.26.2019.08.28.17.07.37; Wed, 28 Aug 2019 17:08:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TbFpvo9P; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726926AbfH2AGR (ORCPT + 99 others); Wed, 28 Aug 2019 20:06:17 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43364 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbfH2AGR (ORCPT ); Wed, 28 Aug 2019 20:06:17 -0400 Received: by mail-pg1-f195.google.com with SMTP id k3so559185pgb.10 for ; Wed, 28 Aug 2019 17:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Wspgap3Tf9JL/6azrZxB+h+6c/nV/dmEy9Ir2yl5KrQ=; b=TbFpvo9PpaHCR6YW+JQ12YiRJ9k3A25bK9ANjq1tGMedJiQImOQ+IbGo9aOXHTPgYs aAxfWYDJj93N993CgGdaXndV2AlOHYEPx7/VnPOWMBPltFh0XV15blrLeQQqdsXQeZTg bn7+d1UYp+h9ha/rj4cAfNgd1XiA3v09cjwJ/uMrVdLF8aHYSdkfTcRACTy0oU17aLyZ ft9t3IMH+9e45fuYEKduuO+s1Lrz+dktcyVf3fKwOeRu/Q5VbQGxUHYvGVmuDEbEj6/d zYIRuFDIs+DGo/qgJGILXVuedmQQ8oPv5b8s+UAaAI95bywtFOfi9q2h4viheXwOw9Qr V19Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Wspgap3Tf9JL/6azrZxB+h+6c/nV/dmEy9Ir2yl5KrQ=; b=HJvxsk4I8je1ME3WMVVwgTVViIZhFOK/iiCbnCy+htOFzZDjNAiFmg+yGJmRcq7AH9 RFOZ/nJpKalJB6ZivoN/Wf8uEP0KLfBUSTz1DwdXBrJt+xsI8O0qzcMPqDZ3N3mpEZ+v qb8jSm9U4IlHRJD/kQ3l//CEB2hExMuUvRJSI34eQAK84/iwLyUjYrqkeq2cn4ORDB67 G5UL6OT9iS8c3W26RE8cB1e6Wcwc/sMaFFooYnT9bTPC5ZAE0VHpBY2ixzFbhCpV8OJY 4mIAovcltQVysT2O92mwCxNDwB/BqDbg9GhZWTgDNxNdIoDTaLuqqj4nWqUWV7UB6tax JewA== X-Gm-Message-State: APjAAAUxqbA0llHGlQFG4sC2B5LhK7ZtgdFqC1dP5LPVXpSMd2Z/vC/c CpGPllJUt1T1LYctfP98P2c= X-Received: by 2002:a17:90a:b288:: with SMTP id c8mr6894939pjr.135.1567037176611; Wed, 28 Aug 2019 17:06:16 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id e9sm282404pja.17.2019.08.28.17.06.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Aug 2019 17:06:16 -0700 (PDT) Date: Thu, 29 Aug 2019 08:06:08 +0800 From: Murphy Zhou To: Trond Myklebust Cc: "linux-nfs@vger.kernel.org" , "jencce.kernel@gmail.com" , "ltp@lists.linux.it" Subject: Re: nfs-for-5.3-3 update "breaks" NFSv4 directIO somehow Message-ID: <20190829000608.hugn6q5tgmttxxw5@XZHOUW.usersys.redhat.com> References: <20190828102256.3nhyb2ngzitwd7az@XZHOUW.usersys.redhat.com> <00923c9f5d5a69e8225640abcf7ad54df2cb62d2.camel@hammerspace.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <00923c9f5d5a69e8225640abcf7ad54df2cb62d2.camel@hammerspace.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Aug 28, 2019 at 03:32:25PM +0000, Trond Myklebust wrote: > On Wed, 2019-08-28 at 18:22 +0800, Murphy Zhou wrote: > > Hi, > > > > If write to file with O_DIRECT, then read it without O_DIRECT, read > > returns 0. > > From tshark output, looks like the READ call is missing. > > > > LTP[1] dio tests spot this. Things work well before this update. > > > > Bisect log is pointing to: > > > > commit 7e10cc25bfa0dd3602bbcf5cc9c759a90eb675dc > > Author: Trond Myklebust > > Date: Fri Aug 9 12:06:43 2019 -0400 > > > > NFS: Don't refresh attributes with mounted-on-file > > informatio > > > > With this commit reverted, the tests pass again. > > > > It's only about NFSv4(4.0 4.1 and 4.2), NFSv3 works well. > > > > Bisect log, outputs of tshark, sample test programme derived from > > LTP diotest02.c and a simple test script are attached. > > > > If this is an expected change, we will need to update the testcases. > > That is not intentional, so thanks for reporting it! Does the following > fix help? This patch fixed the issue. Thanks! Murphy > > 8<------------------------ > From ce61618bc085d8cea8a614b5e1eb09e16ea8e036 Mon Sep 17 00:00:00 2001 > From: Trond Myklebust > Date: Wed, 28 Aug 2019 11:26:13 -0400 > Subject: [PATCH] NFS: Fix inode fileid checks in attribute revalidation code > > We want to throw out the attrbute if it refers to the mounted on fileid, > and not the real fileid. However we do not want to block cache consistency > updates from NFSv4 writes. > > Reported-by: Murphy Zhou > Fixes: 7e10cc25bfa0 ("NFS: Don't refresh attributes with mounted-on-file...") > Signed-off-by: Trond Myklebust > --- > fs/nfs/inode.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c > index c764cfe456e5..d7e78b220cf6 100644 > --- a/fs/nfs/inode.c > +++ b/fs/nfs/inode.c > @@ -1404,10 +1404,11 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat > return 0; > > /* No fileid? Just exit */ > - if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) > - return 0; > + if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) { > + if (fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) > + return 0; > /* Has the inode gone and changed behind our back? */ > - if (nfsi->fileid != fattr->fileid) { > + } else if (nfsi->fileid != fattr->fileid) { > /* Is this perhaps the mounted-on fileid? */ > if ((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) && > nfsi->fileid == fattr->mounted_on_fileid) > @@ -1808,10 +1809,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) > atomic_read(&inode->i_count), fattr->valid); > > /* No fileid? Just exit */ > - if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) > - return 0; > + if (!(fattr->valid & NFS_ATTR_FATTR_FILEID)) { > + if (fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) > + return 0; > /* Has the inode gone and changed behind our back? */ > - if (nfsi->fileid != fattr->fileid) { > + } else if (nfsi->fileid != fattr->fileid) { > /* Is this perhaps the mounted-on fileid? */ > if ((fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) && > nfsi->fileid == fattr->mounted_on_fileid) > -- > 2.21.0 > > -- > Trond Myklebust > Linux NFS client maintainer, Hammerspace > trond.myklebust@hammerspace.com > >