From patchwork Sat Feb 4 05:41:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 9555507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0631B604EB for ; Sat, 4 Feb 2017 05:42:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BCAE27FBB for ; Sat, 4 Feb 2017 05:42:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 004F02815E; Sat, 4 Feb 2017 05:42:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9551C27FBB for ; Sat, 4 Feb 2017 05:42:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753540AbdBDFmc (ORCPT ); Sat, 4 Feb 2017 00:42:32 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:33343 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753539AbdBDFmc (ORCPT ); Sat, 4 Feb 2017 00:42:32 -0500 Received: by mail-io0-f194.google.com with SMTP id 101so4274126iom.0 for ; Fri, 03 Feb 2017 21:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=w4g9Kbc7jlFWgYrpWF669G8OQHR92xX4LCoewCCKLlE=; b=cXO4Wrm/XMMFqEFdHjWWpa1SwkD5jfwZZYYEG8tLHH7ivP2IfVNxEIJkI0CPerEI8t e6QMQZwSjnA71QpBw3SfoJjvTtuFA+swlpyBABwrNVxKEpJ7Ybj5dCWb93BwO4rbVU4Z hceJQB/csmEV5g5Gt1Yn4zDVBbjOjMA14uM581PwZ2oWdIsMmCSNptPe8WdUA3fX8Ecw zwUgZfnlykmgC4EczWpMMauChBew6w71pZF4wjXLalbB5e7UZism2/B5vlFFNjYeffkf at2CyKefDN2+hSq7mO4u0lsJkFsREU0lwMT3fq9CHuaeyFZ1as2YW92DffjAA0XoeNSP 6X0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=w4g9Kbc7jlFWgYrpWF669G8OQHR92xX4LCoewCCKLlE=; b=H09cRDH8KwHeyMG5S+ctRUEuh8oZxm2eo7p7Z3JguBgMJN2Bx3dset703M9ce8f53A bjkIFWxNu6xZIcRk0TaFAOoriJVNfR+y8BeEmNEjkuPLorC5szWF0YJXd+UwGdubzKM8 qtjsjqiqKRZLvsP1DZWx2gSC4i5D9Jii3bfCtkLbPO1ltrm7a5dHNwXDSYUw1AHBx2A1 f0LgS0wf2bEdwj3yysVDFXmIis6xSBQvzFmUoT5a0RMVi+0S5/FFpgQAsOZxW1/mo/oN FfhTUgiE6JmfNObgd56NZ8NHngUJ/np1u5+mV0a8GOrYEA9iL9bW8rP/GODisThrsiTR 2Odg== X-Gm-Message-State: AMke39lnnylijpLgrXzRa8Vsib22txs47PvcFOMfjBpoy7NB0K3sWepPNZ4e773nHWNTXA== X-Received: by 10.107.46.165 with SMTP id u37mr432084iou.126.1486186951598; Fri, 03 Feb 2017 21:42:31 -0800 (PST) Received: from [192.168.0.107] ([182.139.117.200]) by smtp.gmail.com with ESMTPSA id v197sm457883ita.2.2017.02.03.21.42.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Feb 2017 21:42:31 -0800 (PST) From: Kinglong Mee Subject: [PATCH] sunrpc/cache: skip checking the pending cache expired To: "J. Bruce Fields" , linux-nfs@vger.kernel.org Cc: Trond Myklebust , NeilBrown , Kinglong Mee Message-ID: Date: Sat, 4 Feb 2017 13:41:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When the first time pynfs runs after rpc/nfsd startup, always get the warning, Got error: Connection closed Commit 778620364ef5 "sunrpc/cache: make cache flushing more reliable." lets cache_is_expired() checking expired as, return (h->expiry_time < seconds_since_boot()) || (detail->flush_time >= h->last_refresh); The detail->flush_time is equal to h->last_refresh time, when the cache is new created and then do the upcall immediately. So that, the cache will be treated as expired and be cleaned when write_flush(). This patch skips checking the pending cache expired when doing upcall. Signed-off-by: Kinglong Mee --- include/linux/sunrpc/cache.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index 62a60ee..9961c1f 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -204,8 +204,11 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd) kref_put(&h->ref, cd->cache_put); } -static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h) +static inline bool cache_is_expired(struct cache_detail *detail, struct cache_head *h) { + if (test_bit(CACHE_PENDING, &h->flags)) + return false; + return (h->expiry_time < seconds_since_boot()) || (detail->flush_time >= h->last_refresh); }