Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp883069yba; Thu, 18 Apr 2019 11:09:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeJs88Om+P+rnfgSv7S4JSpJk5AneIug3GN3Usf/m2J33zGB1DIBOTEKbWig7RrwSK2CLE X-Received: by 2002:a62:5144:: with SMTP id f65mr98525065pfb.13.1555610958534; Thu, 18 Apr 2019 11:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555610958; cv=none; d=google.com; s=arc-20160816; b=Hy95WNv9xCM07jGkFuh5ytiLbLrxxQrVbMQT+gm7PKp+ShqXZaokuAiyAOLW4ILNeG LQuamutH+D2673oTJxl6AyJk9Bkj/sXBUvf67uspebiu4jkEd7VVF94YsZnBW59j1l5n SDtHNcrpSQozDthToRRlQ9DrH0viMQN2PZEAMxGMHzEDBYUccK4sfSO7weFFJkKEins4 cNjd3IQ5mJ20qRNVbxEWvGnRiNo41qdZZXN7izw1juhRFMkHdUwLdgVRwAO55iln1IdU /ESgO8M/uvI1kTbmh98OFXJn+Mljii5Ti/JJj5FmZuxCQEFhkq7viB6/Yvl/LGdlyYly /iFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NCYdbP6/EObM4FHfaySxKrVidbV9WxLQLV/dRXtuZqk=; b=d4zapujS2swIp7oSXjAZ0QxshGS33KlwA0p+CMft7S6yZE/4jt7ep10o9XKHX9oY55 DAnUfOlTnpIhwJDUvpbg7QK7D9Bqu3p6nIBHQQnTMCR9g0l+dLI1gNmp4A+uImQwoO7N GRYLwZAeaIAcxXiXOIgc5+blqvaJNxDlpqBzLSLxccMdJnxoupj12pRDK4LHIANlcd+P 7SW2ENi4Coim0734G/wJ7BQfS0xELKdWRDIxKK4HH3B0OeQZViTJNcV2CcVZ9S+sbSmS 85ztn9YqzBmaoGOkcxX9xrL4K+SNFlEhcy5Gz8WXzuxsQX4rnOZ13axR5dt1qTPHPDQ7 dVWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="ykt/HWd2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e14si2842259pfn.203.2019.04.18.11.09.03; Thu, 18 Apr 2019 11:09:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@kernel.org header.s=default header.b="ykt/HWd2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391431AbfDRSGI (ORCPT + 99 others); Thu, 18 Apr 2019 14:06:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:35658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390791AbfDRSGC (ORCPT ); Thu, 18 Apr 2019 14:06:02 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1BC1F2186A; Thu, 18 Apr 2019 18:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555610761; bh=5P++KmmtWG0+D9fiTJHCW5o7lWb/RMEOInXBuNIQtIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ykt/HWd25bH+U48oS3EYEcdIKEll0bILje5N00gt9jqR/vh7bMRRggtZENLfNTHs4 JjvsUXTKA+D3pz/Oa+t172LPMSLDwFVXyTOI5zbu+BeQxZw6tWkVw12TllgHprUoRJ fkoi5qCYl9Pp9FE9LdIiDDzD5byCx99wTwz10l2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinu-Razvan Chis-Serban , Dominique Martinet , Sasha Levin Subject: [PATCH 4.14 41/92] 9p locks: add mount option for lock retry interval Date: Thu, 18 Apr 2019 19:56:59 +0200 Message-Id: <20190418160433.838258617@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160430.325165109@linuxfoundation.org> References: <20190418160430.325165109@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 5e172f75e51e3de1b4274146d9b990f803cb5c2a ] The default P9_LOCK_TIMEOUT can be too long for some users exporting a local file system to a guest VM (30s), make this configurable at mount time. Link: http://lkml.kernel.org/r/1536295827-3181-1-git-send-email-asmadeus@codewreck.org Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195727 Signed-off-by: Dinu-Razvan Chis-Serban Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin --- fs/9p/v9fs.c | 21 +++++++++++++++++++++ fs/9p/v9fs.h | 1 + fs/9p/vfs_file.c | 6 +++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 8fb89ddc6cc7..c52f10efdc9c 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -61,6 +61,8 @@ enum { Opt_cache_loose, Opt_fscache, Opt_mmap, /* Access options */ Opt_access, Opt_posixacl, + /* Lock timeout option */ + Opt_locktimeout, /* Error token */ Opt_err }; @@ -80,6 +82,7 @@ static const match_table_t tokens = { {Opt_cachetag, "cachetag=%s"}, {Opt_access, "access=%s"}, {Opt_posixacl, "posixacl"}, + {Opt_locktimeout, "locktimeout=%u"}, {Opt_err, NULL} }; @@ -187,6 +190,7 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) #ifdef CONFIG_9P_FSCACHE v9ses->cachetag = NULL; #endif + v9ses->session_lock_timeout = P9_LOCK_TIMEOUT; if (!opts) return 0; @@ -360,6 +364,23 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) #endif break; + case Opt_locktimeout: + r = match_int(&args[0], &option); + if (r < 0) { + p9_debug(P9_DEBUG_ERROR, + "integer field, but no integer?\n"); + ret = r; + continue; + } + if (option < 1) { + p9_debug(P9_DEBUG_ERROR, + "locktimeout must be a greater than zero integer.\n"); + ret = -EINVAL; + continue; + } + v9ses->session_lock_timeout = (long)option * HZ; + break; + default: continue; } diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index 982e017acadb..129e5243a6bf 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h @@ -116,6 +116,7 @@ struct v9fs_session_info { struct p9_client *clnt; /* 9p client */ struct list_head slist; /* list of sessions registered with v9fs */ struct rw_semaphore rename_sem; + long session_lock_timeout; /* retry interval for blocking locks */ }; /* cache_validity flags */ diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index af8cac975a74..89e69904976a 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -154,6 +154,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) uint8_t status = P9_LOCK_ERROR; int res = 0; unsigned char fl_type; + struct v9fs_session_info *v9ses; fid = filp->private_data; BUG_ON(fid == NULL); @@ -189,6 +190,8 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) if (IS_SETLKW(cmd)) flock.flags = P9_LOCK_FLAGS_BLOCK; + v9ses = v9fs_inode2v9ses(file_inode(filp)); + /* * if its a blocked request and we get P9_LOCK_BLOCKED as the status * for lock request, keep on trying @@ -202,7 +205,8 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) break; if (status == P9_LOCK_BLOCKED && !IS_SETLKW(cmd)) break; - if (schedule_timeout_interruptible(P9_LOCK_TIMEOUT) != 0) + if (schedule_timeout_interruptible(v9ses->session_lock_timeout) + != 0) break; /* * p9_client_lock_dotl overwrites flock.client_id with the -- 2.19.1