Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1389193imm; Thu, 6 Sep 2018 22:36:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaLfc+3yU/PYu9c6x0/MH+1bB0kCjO56QmK4BL6lA47fyZIOiCEZyTGMYknrOZ0dqm7eXDq X-Received: by 2002:a63:2354:: with SMTP id u20-v6mr6503786pgm.122.1536298606534; Thu, 06 Sep 2018 22:36:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536298606; cv=none; d=google.com; s=arc-20160816; b=bVSFVRBtt+teYspvbLBAV+aqrZk0Cxb1Lw5n+DxSv7YwZ8rE5NPLbfjtJLjVObgNW4 5wzO2FiW39NpalzUC8sx9seavls7y973ZT4isbJ42H4TFQENMWz7oF8bcjfc2y8IUwJS yipyp+giMADyES9+VOmNNU3jJlhwZjKWBbT3vfKsRkJm7IbhjZX6QmJiE98W+so7apEp PbwSEbiy7GVget+OjnHAIXFXzfAkh2C0+Q6NZGXCfQCSzPgikRy7nPx4GDQx3Mb+G6vL s5K5JvUdn60saDYAcWMpYoH20vSknqheUCWpNMmRF47Cbl11V5q2ql0l+W0zyA0KOYxc UBFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=jaXoIHqdpDLpZuWRYEbvfErEw2frBzQUP84BTMa8FCI=; b=0ucShdIVEmMzZ1jYp688Ov2GawaGe/nMs5td6+C94VOVgu8VwVyNQ5z4aZKMRSI2NM ywCJ9sBG3ldldhXUib839us5lOkNkOi4xXf9Dshr6DmpEMKfcrWN+p6rq3TgHJOfIA46 qO6B7oMOiH2Vd+yDv/SyRVZAm6PN1B8tj8Y4W0FtKOlC5mnhazm45IqjMEVe5w/g+IcX aV+ABwXuJUCcI7EJVsvzbiq9F8ks1H70e/IEqwZm2+XvLKHSbHwhVkJuLI1+/W86Yku/ WNimjQCvcfUG3XuoNUEksYAXyJ9HQgqDdDSmmhLcXoE+uOUtNG98EGlRdf9kNUqWDsCN WSDw== ARC-Authentication-Results: i=1; mx.google.com; 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 e1-v6si7057007ple.262.2018.09.06.22.36.13; Thu, 06 Sep 2018 22:36:46 -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; 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 S1727289AbeIGJ3q (ORCPT + 99 others); Fri, 7 Sep 2018 05:29:46 -0400 Received: from nautica.notk.org ([91.121.71.147]:33650 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727043AbeIGJ3q (ORCPT ); Fri, 7 Sep 2018 05:29:46 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id 39653C009; Fri, 7 Sep 2018 06:50:37 +0200 (CEST) From: Dominique Martinet To: Eric Van Hensbergen , Latchesar Ionkov Cc: Dinu-Razvan Chis-Serban , v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Dominique Martinet Subject: [PATCH] 9p locks: add mount option for lock retry interval Date: Fri, 7 Sep 2018 06:50:27 +0200 Message-Id: <1536295827-3181-1-git-send-email-asmadeus@codewreck.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinu-Razvan Chis-Serban 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. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195727 Signed-off-by: Dinu-Razvan Chis-Serban Signed-off-by: Dominique Martinet --- This patch also has been in bugzilla for a bit over a year, and looks fine to me. I'll get it in linux-next around next week at the same time as the other bz patch I sent recently after some testing, and will see with Razvan (not sure how to call you in "short" version?) on how we fix comments to it but can take are of that if required. fs/9p/v9fs.c | 21 +++++++++++++++++++++ fs/9p/v9fs.h | 1 + fs/9p/vfs_file.c | 5 ++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 89bac3d2f05b..619128b55837 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; @@ -359,6 +363,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 374bc1c72048..c608b98c0188 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,7 @@ 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; } -- 2.17.1