From patchwork Mon Nov 5 15:22:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1698601 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 C0DFF40060 for ; Mon, 5 Nov 2012 15:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933155Ab2KEPX3 (ORCPT ); Mon, 5 Nov 2012 10:23:29 -0500 Received: from mail-gh0-f174.google.com ([209.85.160.174]:51474 "EHLO mail-gh0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933130Ab2KEPXX (ORCPT ); Mon, 5 Nov 2012 10:23:23 -0500 Received: by mail-gh0-f174.google.com with SMTP id g15so1012583ghb.19 for ; Mon, 05 Nov 2012 07:23:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=C3E0tZUV/GZv3u4zevSVtjESrlEdyhHVL3kt1GJ3hSo=; b=en1FlCmTELsvNqwQv9CcF+eu7mNCfmhOY10+I7ZuAj2Rmik5KhYe8tMAm38W2ovm/n /Ir6gOtV6QHiE/5GwweOvQSCEC38guCTYC/zFnp1858tF7+yRqOhtIiTwquMRNmMLhm8 PdT/3p5zdsEWbNb0LXrHYa7VoIAy2uWvV/tMTgLYYtQhgy+0F+gt2xalChjzugiTG6q7 m1dXDNqjQFJ5is4DtR+aMTtgoYgUlwwQ21zr3JfSr5pkEPH0YnubhnumxhcSb2mNf9i0 lZzQjTffVF3sg21IGSlO8PbtEgy3EgRo3o9WprQh3GzJac4OarmMEo2qhBRkY9q+W8xx KgbA== Received: by 10.236.71.33 with SMTP id q21mr9385254yhd.60.1352129002878; Mon, 05 Nov 2012 07:23:22 -0800 (PST) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id y18sm12026769anh.15.2012.11.05.07.23.21 (version=SSLv3 cipher=OTHER); Mon, 05 Nov 2012 07:23:22 -0800 (PST) From: Jeff Layton To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, michael.brantley@deshaw.com, hch@infradead.org, miklos@szeredi.hu, pstaubach@exagrid.com Subject: [PATCH v9 33/34] vfs: make number of ESTALE retries tunable Date: Mon, 5 Nov 2012 10:22:12 -0500 Message-Id: <1352128933-28526-34-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1352128933-28526-1-git-send-email-jlayton@redhat.com> References: <1352128933-28526-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQnGPAkYw6YHEvGDEnBv8ZwvTAzPJtO3dVBwdU0iwM/kYqmOzg07WyM6PcFAiWa+l9RvUhZX Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org In some situations, when there is a lot of "churn", a single retry is simply not enough. Since there is no single correct value for the number of times that these retries should occur, it makes some sense to allow the admin to tune that value. This patch adds a sysctl to allow the admin to tune the number of times to retry these operations before giving up. Signed-off-by: Jeff Layton --- fs/namei.c | 2 ++ include/linux/fs.h | 7 ++++--- kernel/sysctl.c | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index f0916e6..70592ec 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -110,6 +110,8 @@ * any extra contention... */ +unsigned int estale_retries __read_mostly = 1; + /* In order to reduce some races, while at the same time doing additional * checking and hopefully speeding things up, we copy filenames to the * kernel data space before using them.. diff --git a/include/linux/fs.h b/include/linux/fs.h index 3e42289..1789199 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2023,14 +2023,15 @@ extern int finish_open(struct file *file, struct dentry *dentry, int *opened); extern int finish_no_open(struct file *file, struct dentry *dentry); +extern unsigned int estale_retries; + /** * retry_estale - determine whether the caller should retry an operation * @error: the error that would currently be returned * @try: number of tries already performed * * Check to see if the error code was -ESTALE, and then determine whether - * to retry the call based on the number of tries so far. Currently, we only - * retry the call once. + * to retry the call based on the number of tries so far. * * Returns true if the caller should try the operation again. */ @@ -2040,7 +2041,7 @@ retry_estale(const long error, const unsigned int try) if (likely(error != -ESTALE)) return false; - return !try; + return (try <= estale_retries); } /* fs/ioctl.c */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 26f65ea..24735db 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1545,6 +1545,13 @@ static struct ctl_table fs_table[] = { .proc_handler = &pipe_proc_fn, .extra1 = &pipe_min_size, }, + { + .procname = "estale_retries", + .data = &estale_retries, + .maxlen = sizeof(unsigned int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, { } };