Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4133080ybi; Mon, 29 Jul 2019 19:59:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLziDO2YlTos7Vljc+P0KuLdNd0zuKtqsl38qQIeqrdNKe5HlZbC2rilI0xi672MFwM/lD X-Received: by 2002:a63:e54f:: with SMTP id z15mr106606806pgj.4.1564455591475; Mon, 29 Jul 2019 19:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564455591; cv=none; d=google.com; s=arc-20160816; b=DqKJQ/1QNf9UGTt6bxlD48YU+5SKl4JLns9NIg1wLZDBdMFc1wy9elvEOlzt8oUF+L 1DCQdVLlKDb+lmPsyzzVQIMVsgPh2AEA7YiRdqGqMA8SptexcR3wuhE8oWOEBtr6mldp LTjQncxRyorJA0sRs8QezONyH45xBNpo7+0Px43O6R7xmwLUVd13uym61QI0hKBa/N0l 63yFNrCaaghrh3WyNEg8MaC2q+tTOs8p58Pupg+RNMKcfkhA0zqmth8AZwabneJhrT5D 6FCEK3+LXUnGm9+8xV6vzfN19sFej7oRrL53VoUtciQxkHTaKRlNBwIsgLrH6USvcSI6 onGw== 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=F3yO6t+UrsN/0ESixcg8wLfp2IGyjTyodCg4OenaIx4=; b=Z4CimZswxb916ButYRsY+Ngy32/wcOP9R5R1B/5widdID6tF3BPtQA4hnyAOENWEh9 gSAfp8vX8Jy0LnqlxW/XiBiiBb9CX0u0g2Vk3JFOKbVtA6qK22uuPmxeYtP+Hf2d5TY8 9ZLwvFKf/8epCFH/DR8PMxrxhhAQeKF/K29MWT1xtUvF5fWviBtP+wQc9JG2pOKO831h Epxd7eSWwpTiXR6IKfVlXEBT08Nj/1o3jcNx6E/07hileRl0iv/6knO+2xYa5u7Gxszr SIx0ILuYegOPBapcBJUHiGuZ43Xt9HuwCFpnpFSWUuWXbS4lx9YYI2WrshQ9KBKf2C8n OWQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LxSrKCH9; 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 v8si29559403pfm.83.2019.07.29.19.59.37; Mon, 29 Jul 2019 19:59:51 -0700 (PDT) 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=LxSrKCH9; 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 S2391059AbfG2UBA (ORCPT + 99 others); Mon, 29 Jul 2019 16:01:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:43438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403887AbfG2Tvs (ORCPT ); Mon, 29 Jul 2019 15:51:48 -0400 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 BCC2B204EC; Mon, 29 Jul 2019 19:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429907; bh=sizR6Xq3/RQtR4jQO/vuWDORMl5pzGPn+/xcWFwpwYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxSrKCH9yVK1Ie1P5NPiOt4lpwafiOTCASNo5XZNg4LHeakJy7MDqsWq05HTbc0vC 7h/qwnXnyPF5QpQvZNZi2MjOf8mKmn4wTIAZCS3h/eGBbe3ZLfd9WCyN9KPoHbVYfH mBGQ2wWX4fdHsAQ0DgLzz0UAvfG/EEbI9xRDMbmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikhail Skorzhinskii , Sagi Grimberg , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.2 134/215] nvme-tcp: dont use sendpage for SLAB pages Date: Mon, 29 Jul 2019 21:22:10 +0200 Message-Id: <20190729190802.778876364@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@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 [ Upstream commit 37c15219599f7a4baa73f6e3432afc69ba7cc530 ] According to commit a10674bf2406 ("tcp: detecting the misuse of .sendpage for Slab objects") and previous discussion, tcp_sendpage should not be used for pages that is managed by SLAB, as SLAB is not taking page reference counters into consideration. Signed-off-by: Mikhail Skorzhinskii Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/tcp.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 08a2501b9357..606b13d35d16 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -860,7 +860,14 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) else flags |= MSG_MORE; - ret = kernel_sendpage(queue->sock, page, offset, len, flags); + /* can't zcopy slab pages */ + if (unlikely(PageSlab(page))) { + ret = sock_no_sendpage(queue->sock, page, offset, len, + flags); + } else { + ret = kernel_sendpage(queue->sock, page, offset, len, + flags); + } if (ret <= 0) return ret; -- 2.20.1