From patchwork Mon Jun 18 17:25:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 10472403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 681AE601D7 for ; Mon, 18 Jun 2018 17:25:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C2F328AEB for ; Mon, 18 Jun 2018 17:25:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F37028AFD; Mon, 18 Jun 2018 17:25:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8B5E28AEB for ; Mon, 18 Jun 2018 17:25:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935303AbeFRRZo (ORCPT ); Mon, 18 Jun 2018 13:25:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44708 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935166AbeFRRZo (ORCPT ); Mon, 18 Jun 2018 13:25:44 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 46B5630C1107; Mon, 18 Jun 2018 17:25:44 +0000 (UTC) Received: from steved.boston.devel.redhat.com (ovpn-116-130.phx2.redhat.com [10.3.116.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4AA260BE3; Mon, 18 Jun 2018 17:25:43 +0000 (UTC) From: Steve Dickson To: Trond Myklebust , Anna Schumaker Cc: Linux NFS Mailing list Subject: [PATCH] Stop mounts hanging in upcalls to rpc.gssd. Date: Mon, 18 Jun 2018 13:25:42 -0400 Message-Id: <20180618172542.45519-1-steved@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 18 Jun 2018 17:25:44 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To stop mounts hanging forever due to a hung upcall to rpc.gssd, this patch adds a 5 sec timeout to that upcall. When the upcall does hung the mount will timeout in about a min or so due to all the retries by the sunrpc layer. The mount will either fail when a krb5 flavor is specified or roll back to a sys flavor mount. Signed-off-by: Steve Dickson --- net/sunrpc/auth_gss/auth_gss.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index be8f103d22fd..407a9a571be0 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -75,6 +75,8 @@ static unsigned int gss_key_expire_timeo = GSS_KEY_EXPIRE_TIMEO; * using integrity (two 4-byte integers): */ #define GSS_VERF_SLACK 100 +#define GSS_UPCALL_TIMEO (5 * HZ) + static DEFINE_HASHTABLE(gss_auth_hash_table, 4); static DEFINE_SPINLOCK(gss_auth_hash_lock); @@ -658,7 +660,14 @@ gss_create_upcall(struct gss_auth *gss_auth, struct gss_cred *gss_cred) err = -ERESTARTSYS; goto out_intr; } - schedule(); + if (schedule_timeout(GSS_UPCALL_TIMEO) == 0) { + warn_gssd(); + if (!gssd_running(net)) + err = -EACCES; + else + err = -ETIMEDOUT; + goto out_intr; + } } if (gss_msg->ctx) gss_cred_set_ctx(cred, gss_msg->ctx);