Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2262857ybl; Thu, 19 Dec 2019 10:37:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxBgWNBqFan8fAqfDRCU2t8UrfOouQvUcJO7PHzLK9QtEZQ+ZP6UTMR7B69uyojKICtqCre X-Received: by 2002:a05:6830:2099:: with SMTP id y25mr9905855otq.87.1576780677729; Thu, 19 Dec 2019 10:37:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576780677; cv=none; d=google.com; s=arc-20160816; b=Zw1oEPuFurnX+8fI4to53FS7ZGh2xW7KRXe4uSisrKWmrTMJ/CPIViq+Def78IDI1m DKQnCYbfe1Nl0JgYjlsIbXDAsDZwuu98s1ZKaWv0kodEIlK/x/7n6ZHqfHAMovOOQrIj wFoYVcmnkrHJtz8nWlUGlDr/jscJo+5DuMkQck3ZTyo/qOZqzRQ8w2xuS2Yxxetg574k TsgDyniPj8Nsdttw9Jmx9Y7fPqNWyw7jnrmHbXZOrQXVT93V8w2sJPds7I3zCZ/Hqi2r uo+d4NQIM9M0xup+UUBCEXTWAyDQCxxq06l5VN7NpW86uagoGphyPgNQFIcgAaDPcrLu nwJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HKy0mM10eIY3/WCov0s4E3EhDDJoGfkqBwTmgZ7/rBU=; b=eexMh4njE5CFl1zM3t58zcMfOVl3UK1Y6m4Xobhcu/V0IfDShhOzycEzGDBymylihM h53A8RzH/54rOU9pxhXJb2LmqSCEOd88+VcwsuKV6oyb3pfSrVla1fWL/IBYEK5ocsd6 Mhjz6hfgaZv2+WAZ7DQjOP9TXSV47qVoFe6Lb/t58jBkCFi+pvEYr+WN2uEjCUMuMzLD PgQzIDr1m0BvYVzaQhTLD1Vw6KrJCensFK72Wsz8KlVeJEsVle2ZTpd8CWN3Nt2m/1kB faHyZcBThndAuRNZ+CGIqjumCOtXmLKpn7N/WSGC0/XZo1PCzq9nuEFq8iJ3UjSZzf8g nRUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yFi5C8fH; 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 m16si3644855otl.265.2019.12.19.10.37.45; Thu, 19 Dec 2019 10:37:57 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=yFi5C8fH; 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 S1727641AbfLSSgg (ORCPT + 99 others); Thu, 19 Dec 2019 13:36:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:53616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727632AbfLSSge (ORCPT ); Thu, 19 Dec 2019 13:36:34 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4AEBF2467B; Thu, 19 Dec 2019 18:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576780593; bh=8TgAuhidk5oSTwZ1eaoHs9t4kw2w9ZuWglFYXHYxt9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yFi5C8fHUcLx3GyaqCd2bx80xo3EcAK+sVGkBCeOl34A7VmnoY46TbJqMXsxJLs3g FEsLzL730aVuGjwZp+SB8OnBPthJpdy8dUDuZOvyKQeRIVVAhIrfppfxHczbY364R1 Id2a9oOBfQZT4pkXZoMVq1scqcRIV+aSvSU3djNg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Mayhew , "J. Bruce Fields" , Sasha Levin Subject: [PATCH 4.4 038/162] nfsd: fix a warning in __cld_pipe_upcall() Date: Thu, 19 Dec 2019 19:32:26 +0100 Message-Id: <20191219183210.143633078@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183150.477687052@linuxfoundation.org> References: <20191219183150.477687052@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Scott Mayhew [ Upstream commit b493fd31c0b89d9453917e977002de58bebc3802 ] __cld_pipe_upcall() emits a "do not call blocking ops when !TASK_RUNNING" warning due to the dput() call in rpc_queue_upcall(). Fix it by using a completion instead of hand coding the wait. Signed-off-by: Scott Mayhew Signed-off-by: J. Bruce Fields Signed-off-by: Sasha Levin --- fs/nfsd/nfs4recover.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index e3d47091b191d..2cb2e61cdbf6c 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c @@ -655,7 +655,7 @@ struct cld_net { struct cld_upcall { struct list_head cu_list; struct cld_net *cu_net; - struct task_struct *cu_task; + struct completion cu_done; struct cld_msg cu_msg; }; @@ -664,23 +664,18 @@ __cld_pipe_upcall(struct rpc_pipe *pipe, struct cld_msg *cmsg) { int ret; struct rpc_pipe_msg msg; + struct cld_upcall *cup = container_of(cmsg, struct cld_upcall, cu_msg); memset(&msg, 0, sizeof(msg)); msg.data = cmsg; msg.len = sizeof(*cmsg); - /* - * Set task state before we queue the upcall. That prevents - * wake_up_process in the downcall from racing with schedule. - */ - set_current_state(TASK_UNINTERRUPTIBLE); ret = rpc_queue_upcall(pipe, &msg); if (ret < 0) { - set_current_state(TASK_RUNNING); goto out; } - schedule(); + wait_for_completion(&cup->cu_done); if (msg.errno < 0) ret = msg.errno; @@ -747,7 +742,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) if (copy_from_user(&cup->cu_msg, src, mlen) != 0) return -EFAULT; - wake_up_process(cup->cu_task); + complete(&cup->cu_done); return mlen; } @@ -762,7 +757,7 @@ cld_pipe_destroy_msg(struct rpc_pipe_msg *msg) if (msg->errno >= 0) return; - wake_up_process(cup->cu_task); + complete(&cup->cu_done); } static const struct rpc_pipe_ops cld_upcall_ops = { @@ -893,7 +888,7 @@ restart_search: goto restart_search; } } - new->cu_task = current; + init_completion(&new->cu_done); new->cu_msg.cm_vers = CLD_UPCALL_VERSION; put_unaligned(cn->cn_xid++, &new->cu_msg.cm_xid); new->cu_net = cn; -- 2.20.1