From patchwork Sat Mar 8 13:22:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Dickson X-Patchwork-Id: 3798291 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F3657BF540 for ; Sat, 8 Mar 2014 13:22:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0088720155 for ; Sat, 8 Mar 2014 13:22:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12D8B20374 for ; Sat, 8 Mar 2014 13:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751330AbaCHNWt (ORCPT ); Sat, 8 Mar 2014 08:22:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44968 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbaCHNWs (ORCPT ); Sat, 8 Mar 2014 08:22:48 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s28DMmfi031953 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 8 Mar 2014 08:22:48 -0500 Received: from smallhat.boston.devel.redhat.com (vpn-53-96.rdu2.redhat.com [10.10.53.96]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s28DMlaH023403 for ; Sat, 8 Mar 2014 08:22:48 -0500 From: Steve Dickson To: Linux NFS Mailing list Subject: [PATCH] mount.nfs: background mount now do directly into background Date: Sat, 8 Mar 2014 08:22:44 -0500 Message-Id: <1394284964-12997-1-git-send-email-steved@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Modern day kernel will no longer return all timeout errors instead the process spins endlessly in the kernel. This behavior will cause the foreground mount to hang, never allowing the mount to go into background. So this patch eliminates the foreground mount cause background mounts to go directly into background Signed-off-by: Steve Dickson --- utils/mount/stropts.c | 31 ++++++++----------------------- 1 files changed, 8 insertions(+), 23 deletions(-) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index a642394..92a7245 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -913,28 +913,6 @@ static int nfsmount_fg(struct nfsmount_info *mi) } /* - * Handle "background" NFS mount [first try] - * - * Returns a valid mount command exit code. - * - * EX_BG should cause the caller to fork and invoke nfsmount_child. - */ -static int nfsmount_parent(struct nfsmount_info *mi) -{ - if (nfs_try_mount(mi)) - return EX_SUCCESS; - - /* retry background mounts when the server is not up */ - if (nfs_is_permanent_error(errno) && errno != EOPNOTSUPP) { - mount_error(mi->spec, mi->node, errno); - return EX_FAIL; - } - - sys_mount_errors(mi->hostname, errno, 1, 1); - return EX_BG; -} - -/* * Handle "background" NFS mount [retry daemon] * * Returns a valid mount command exit code: EX_SUCCESS if successful, @@ -982,7 +960,14 @@ static int nfsmount_child(struct nfsmount_info *mi) static int nfsmount_bg(struct nfsmount_info *mi) { if (!mi->child) - return nfsmount_parent(mi); + /* + * Modern day kernels no longer return all + * timeouts errors in all cases, instead + * the process spins in the kernel, which + * will hang a foreground mount. So background + * mounts have to go directly into background + */ + return EX_BG; else return nfsmount_child(mi); }