Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3129991ybi; Thu, 18 Jul 2019 21:36:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw8ONNk+i/sE+/GgU10jLL6I+gffUhAVbcxqb7bDrCApbr8i30N8Tf0m8LMXSTH0ZCCEWM X-Received: by 2002:a17:90a:37ac:: with SMTP id v41mr52923383pjb.6.1563511014783; Thu, 18 Jul 2019 21:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563511014; cv=none; d=google.com; s=arc-20160816; b=nTX6x/MGgikTGlb6gerJHelppdLVToc4Ywe2q8K8g0P5D5HOzOojHTvxfYfg4Vanbr kArSgZyuX3XVhEKUw/QxQnD27cPcjWXYCuilvCc34sUQQMMyO1ljMGIDrW5DbFB8actN 32bRZkgTlkgWemr74FJ0KGwu53w743jJ76AyjBDlY2U5YW5vYnsMOZwU2hu3VpxqMXGs 6rRE8vlpGT/lfh9WFc7gxCFmoMRkDfcj9ycMvmXuRgU06aTKrSYv4ILRzV6MMhASTx/4 TyJGhQ4Fsu5CarkpQRfbtgQ3FmYU5Td/tK7fKrs8Gql4/QrOvm2ScduW++ojSErT6z9Y dYIg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iXdkT+V+qEKPN9KqCuRhp3WT7KTuoM+dAY8UVLEcuTs=; b=a5pZP0wZLKTQGQqEQxm/JG9MStZyMXU9VtvEX4OhXBPL47rgRFDGFB09R4T5+93eVm i4guhPOYKsKAZaKSLSvS35yzoW5ln7/5xOKng3wLOnEf7H0IWfhmsZV3gug0kv0okGWI Waq2TE39GYvkvb8gXj4GRZ70Dd5M/uDMs143hG9TrF581h3+NWN5lmT4nG9WnTVsMY+/ jZihvGdKv3iUDR+6eAL8VTsSenz+n855EA1C8DGxj5OTUBsswzpXI5YUE4jg6YTh5NQd kGU3JAZZo+t2/hb8JJ51XssiuQaFrta6V4dlI5ScRgOAOTZM87gMX3CKMLkA0TF8au2G 4Dcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vF3iHJ8X; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y192si4985960pfg.172.2019.07.18.21.36.39; Thu, 18 Jul 2019 21:36:54 -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=vF3iHJ8X; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729533AbfGSEBg (ORCPT + 99 others); Fri, 19 Jul 2019 00:01:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:33192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729435AbfGSEB1 (ORCPT ); Fri, 19 Jul 2019 00:01:27 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 91B0B21852; Fri, 19 Jul 2019 04:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563508886; bh=CH3O2LPFoEMwAWzghnExfL2XH60fUknYpeXbotU+tPI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vF3iHJ8XAu869BlR4jRn/iu6KYViP56hR6tmSyI+ZYGYZmbC656AyOVCtW4Al/xW/ sV8hM0j22Xej1i0/1VPdw80U6DClRPYBhmAdR5G1+mwvIdhrdLQ2P75ualQAYQXOSe VOWxCi6+1QcWG8+xfOED3kRbMd6Q+yok35E2KsN8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Mikhail Skorzhinskii , Sagi Grimberg , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.2 137/171] nvme-tcp: don't use sendpage for SLAB pages Date: Thu, 18 Jul 2019 23:56:08 -0400 Message-Id: <20190719035643.14300-137-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190719035643.14300-1-sashal@kernel.org> References: <20190719035643.14300-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikhail Skorzhinskii [ 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