From patchwork Wed Apr 16 04:03:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 3997511 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7BA329F2BA for ; Wed, 16 Apr 2014 04:22:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADD8D2021A for ; Wed, 16 Apr 2014 04:22:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFF7020200 for ; Wed, 16 Apr 2014 04:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754196AbaDPETi (ORCPT ); Wed, 16 Apr 2014 00:19:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:38857 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041AbaDPETh (ORCPT ); Wed, 16 Apr 2014 00:19:37 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 88305AB0E; Wed, 16 Apr 2014 04:19:36 +0000 (UTC) From: NeilBrown To: linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 16 Apr 2014 14:03:37 +1000 Subject: [PATCH 15/19] nfsd: set PF_FSTRANS when client_mutex is held. Cc: xfs@oss.sgi.com Message-ID: <20140416040336.10604.67828.stgit@notabene.brown> In-Reply-To: <20140416033623.10604.69237.stgit@notabene.brown> References: <20140416033623.10604.69237.stgit@notabene.brown> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 When loop-back NFS with NFSv4 is in use, client_mutex might be needed to reclaim memory, so any memory allocation while client_mutex is held must avoid __GFP_FS, so best to set PF_FSTRANS. Signed-off-by: NeilBrown --- fs/nfsd/nfs4state.c | 3 +++ 1 file changed, 3 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index d5d070fbeb35..7b7fbcbe20cb 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -75,6 +75,7 @@ static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner /* Currently used for almost all code touching nfsv4 state: */ static DEFINE_MUTEX(client_mutex); +static unsigned int client_mutex_pflags; /* * Currently used for the del_recall_lru and file hash table. In an @@ -93,6 +94,7 @@ void nfs4_lock_state(void) { mutex_lock(&client_mutex); + current_set_flags_nested(&client_mutex_pflags, PF_FSTRANS); } static void free_session(struct nfsd4_session *); @@ -127,6 +129,7 @@ static __be32 nfsd4_get_session_locked(struct nfsd4_session *ses) void nfs4_unlock_state(void) { + current_restore_flags_nested(&client_mutex_pflags, PF_FSTRANS); mutex_unlock(&client_mutex); }