From patchwork Tue May 23 23:27:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9744411 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 BEE916032B for ; Tue, 23 May 2017 23:28:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF7F228831 for ; Tue, 23 May 2017 23:28:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FD3528848; Tue, 23 May 2017 23:28:07 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_TVD_MIME_EPI 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 2893B28831 for ; Tue, 23 May 2017 23:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758117AbdEWX2G (ORCPT ); Tue, 23 May 2017 19:28:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:33276 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751670AbdEWX2F (ORCPT ); Tue, 23 May 2017 19:28:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BDB78ABF0; Tue, 23 May 2017 23:28:03 +0000 (UTC) From: NeilBrown To: Trond Myklebust , Anna Schumaker , Chuck Lever Date: Wed, 24 May 2017 09:27:55 +1000 Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH/RFC] NFSv4: don't let hanging mounts block other mounts Message-ID: <87vaori26c.fsf@notabene.neil.brown.name> MIME-Version: 1.0 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 If you try an NFSv4 mount from an inaccessible server, it will hang as you would expect. If you then try an NFSv4 mount from a different accessible server, it will also hang. This is not expected. The second mount is blocked in nfs4_init_client() -> nfs4_discover_server_trunking() -> nfs40_discover_server_trunking() -> nfs40_walk_client_list() -> nfs4_match_client() -> nfs_wait_client_init_complete() It is waiting for the first mount to complete so that it can then see if the two servers are really one and the same. It is not necessary to wait here when an nfs_client cl_cons_state is NFS_CS_INITING. Such a client will, after changing cl_cons_state, call nfs4_discover_server_trunking() itself. So if the current client just skips those clients, trunking will still be discovered if necessary. I am unsure of situation with NFS_CS_SESSION_INITING, but I suspect that the comment "Wait for CREATE_SESSION to finish" implies that it is only clients in NFS_CS_SESSION_INITING that need to be waited for. Signed-off-by: NeilBrown --- fs/nfs/nfs4client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index 692a7a8bfc7a..386901dfdca7 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -481,7 +481,7 @@ static int nfs4_match_client(struct nfs_client *pos, struct nfs_client *new, * remaining fields in "pos", especially the client * ID and serverowner fields. Wait for CREATE_SESSION * to finish. */ - if (pos->cl_cons_state > NFS_CS_READY) { + if (pos->cl_cons_state == NFS_CS_SESSION_INITING) { atomic_inc(&pos->cl_count); spin_unlock(&nn->nfs_client_lock);