From patchwork Mon Feb 4 13:18:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2091811 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CAFBD3FD56 for ; Mon, 4 Feb 2013 13:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755133Ab3BDNSQ (ORCPT ); Mon, 4 Feb 2013 08:18:16 -0500 Received: from mail-gg0-f177.google.com ([209.85.161.177]:43929 "EHLO mail-gg0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754819Ab3BDNSP (ORCPT ); Mon, 4 Feb 2013 08:18:15 -0500 Received: by mail-gg0-f177.google.com with SMTP id q1so181717gge.22 for ; Mon, 04 Feb 2013 05:18:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=SHSa++b5pOFfGec8U5X/t9pLqUfN9djBIKkiyNxuvWg=; b=Wnj79xymWE1fnanWfWLWKq5gbnRmF3PANWfC+t809olQFkoo76ulR4BkT0l79IN3Sk Uq6gYDvk8obxPc0bsqQfObtlvilYdP3/t/H3H5/AheeH24sW9QEgsJKFhBjnSWblczqp sHTebyCDUvgq4MVGxotEBYDH40dSkLoTFZBYti8eh2cAnjTjA7qSM6hMkkvpSGrRFvkw mAzyfhf8JL+tHKy0aGSkFIaa0HuFrGUP85fK0BjRqmHkNmlohB+YjQAx/rUAtmb/2nmn lwJfCAOM2mIc8bEzEghKIwzJ31J0jXAqUkIWqIQ462Uyhs0srvpQFZ1NlZnwQUd8l54p jFAA== X-Received: by 10.236.156.194 with SMTP id m42mr26499417yhk.6.1359983894447; Mon, 04 Feb 2013 05:18:14 -0800 (PST) Received: from salusa.poochiereds.net (cpe-107-015-113-143.nc.res.rr.com. [107.15.113.143]) by mx.google.com with ESMTPS id d80sm980595yhg.4.2013.02.04.05.18.12 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 04 Feb 2013 05:18:13 -0800 (PST) From: Jeff Layton To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 1/8] nfsd: always move DRC entries to the end of LRU list when updating timestamp Date: Mon, 4 Feb 2013 08:18:00 -0500 Message-Id: <1359983887-28535-2-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1359983887-28535-1-git-send-email-jlayton@redhat.com> References: <1359983887-28535-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQmRk8cbdvfGn7/5rqA2j1mA7eIuGQQa/s7K9bhTHWyFdR+h978vWv25JtwhpGyDXffOz/nn Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org ...otherwise, we end up with the list ordering wrong. Currently, it's not a problem since we skip RC_INPROG entries, but keeping the ordering strict will be necessary for a later patch that adds a cache cleaner. Signed-off-by: Jeff Layton --- fs/nfsd/nfscache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index b89e7c8..9d80dfa 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c @@ -129,6 +129,7 @@ void nfsd_reply_cache_shutdown(void) static void lru_put_end(struct svc_cacherep *rp) { + rp->c_timestamp = jiffies; list_move_tail(&rp->c_lru, &lru_head); } @@ -245,9 +246,9 @@ nfsd_cache_lookup(struct svc_rqst *rqstp) rpc_set_port((struct sockaddr *)&rp->c_addr, rpc_get_port(svc_addr(rqstp))); rp->c_prot = proto; rp->c_vers = vers; - rp->c_timestamp = jiffies; hash_refile(rp); + lru_put_end(rp); /* release any buffer */ if (rp->c_type == RC_REPLBUFF) { @@ -262,7 +263,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp) found_entry: /* We found a matching entry which is either in progress or done. */ age = jiffies - rp->c_timestamp; - rp->c_timestamp = jiffies; lru_put_end(rp); rtn = RC_DROPIT; @@ -354,7 +354,6 @@ nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, __be32 *statp) rp->c_secure = rqstp->rq_secure; rp->c_type = cachetype; rp->c_state = RC_DONE; - rp->c_timestamp = jiffies; spin_unlock(&cache_lock); return; }