From: Kinglong Mee <kinglongmee@gmail.com>
To: "J. Bruce Fields" <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Cc: Trond Myklebust <trond.myklebust@primarydata.com>,
NeilBrown <neilb@suse.com>, Kinglong Mee <kinglongmee@gmail.com>
Subject: [PATCH] sunrpc/cache: skip checking the pending cache expired
Date: Sat, 4 Feb 2017 13:41:30 +0800 [thread overview]
Message-ID: <cb2a552c-51ec-f230-0b39-0bd4002e351d@gmail.com> (raw)
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 <kinglongmee@gmail.com>
---
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);
}
--
2.9.3
next reply other threads:[~2017-02-04 5:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-04 5:41 Kinglong Mee [this message]
2017-02-05 10:37 ` [PATCH] sunrpc/cache: skip checking the pending cache expired Kinglong Mee
2017-02-05 12:41 ` Kinglong Mee
2017-02-05 22:28 ` NeilBrown
2017-02-06 0:59 ` Kinglong Mee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb2a552c-51ec-f230-0b39-0bd4002e351d@gmail.com \
--to=kinglongmee@gmail.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.com \
--cc=trond.myklebust@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).