Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2754399pxj; Mon, 31 May 2021 09:55:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2b0vkqys7zDkZ369Y1iERXbvLWrXTKjndayG7kLMQHOWLsV4G8xb/NiTUicU0OXinXkWk X-Received: by 2002:a17:906:51d8:: with SMTP id v24mr9708003ejk.264.1622480103830; Mon, 31 May 2021 09:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622480103; cv=none; d=google.com; s=arc-20160816; b=Cwrwff7T0mIIsxSe2HMDnJGg/gPdCiGnB/BoQehKMKKAlW/Upz1E3OQIy+NDFtwBKR lofgHxLYdgmXMvno0bkMjdiWATSXK/VjbhrZ4Hn53enf1gC9sgMrZYCMXpNA+CBeMk7B sk0DQSfLHfLUnIBDlNeW46A281vP7+CNnuLBzKMdlaQ1/r1JN7qH7Ss8VC5OkJZG32Um IdFK2MEuwGGYx5d63vcQOMyGQuEzAPV/7l8QHiIBnDaA/OZ9GNn0g9NUatwOqDGsF1jr OG0YY6g9f3dO5HhtEEm9C5bO33WynmgE0M1JRlGW1uxyHRZljiDxLfXIIpVDatuXYMC8 9nDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=56GYCCZoOcpv3spdXmW0EdKJV8hMkP2gXt49fdg5fQM=; b=yfyCzpQoyu6ZgEdEFsVT563wZV9IK97j2Dj1BEXGU6Sp9uDcYk6KtZRF0B4y9JE24o 2SzqS/+nl7ZY/mIZIN6LT6nh16crxORZ2NUn1z20Wb8k4J7GoVNDhw5b3QFBN6faBK4v 84jUXRV+bE0N5uMR9HUGFfNcznjWP2Rwvg9OFmyZ9NnplfqvD8pZABL5gwNJc+2ubCw9 sQQoOhoR4mNLiTcKzT0y/A6yXE/neJzATrg5dgp42NsUNTLRp6UaLoK4pVeEauK7vF3I PwgxCEEePZe/UH/1YPLFceUycQY+rp6gyJAqX6kgowGJSP1SnnkY0bgTTac99DxVXqf5 qfCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yZyz0uR7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fl21si13434070ejc.601.2021.05.31.09.54.41; Mon, 31 May 2021 09:55:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yZyz0uR7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232981AbhEaQwb (ORCPT + 99 others); Mon, 31 May 2021 12:52:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:51370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234463AbhEaO7t (ORCPT ); Mon, 31 May 2021 10:59:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A29F561946; Mon, 31 May 2021 14:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469704; bh=D63P77HwMmhGS9UdU6aGgjUqACebIidGZofYsJ/azHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yZyz0uR7ARUBqY4m/r5jG0oVkw93wL3UvOfJKX9FmYTC/hiZ+yqpPospu4dfGq6Kw apnkz0bU5VFroGKFgnfUUJcv432C+EQ068FWgx1FT0iEGOP2AvnHNu3gsStzAnfegG U4QepfTetqKY0dApMJQw+cieHc8o91VnMMH14zjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , Trond Myklebust , Sasha Levin Subject: [PATCH 5.12 288/296] xprtrdma: Revert 586a0787ce35 Date: Mon, 31 May 2021 15:15:43 +0200 Message-Id: <20210531130713.396050902@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuck Lever [ Upstream commit ae605ee9830840f14566a3b1cde27fa8096dbdd4 ] Commit 9ed5af268e88 ("SUNRPC: Clean up the handling of page padding in rpc_prepare_reply_pages()") [Dec 2020] affects RPC Replies that have a data payload (i.e., Write chunks). rpcrdma_prepare_readch(), as its name suggests, sets up Read chunks which are data payloads within RPC Calls. Those payloads are constructed by xdr_write_pages(), which continues to stuff the call buffer's tail kvec with the payload's XDR roundup. Thus removing the tail buffer logic in rpcrdma_prepare_readch() was the wrong thing to do. Fixes: 586a0787ce35 ("xprtrdma: Clean up rpcrdma_prepare_readch()") Signed-off-by: Chuck Lever Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- net/sunrpc/xprtrdma/rpc_rdma.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index 21ddd78a8c35..15e0c4e7b24a 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -628,8 +628,9 @@ out_mapping_err: return false; } -/* The tail iovec might not reside in the same page as the - * head iovec. +/* The tail iovec may include an XDR pad for the page list, + * as well as additional content, and may not reside in the + * same page as the head iovec. */ static bool rpcrdma_prepare_tail_iov(struct rpcrdma_req *req, struct xdr_buf *xdr, @@ -747,19 +748,27 @@ static bool rpcrdma_prepare_readch(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req, struct xdr_buf *xdr) { - struct kvec *tail = &xdr->tail[0]; - if (!rpcrdma_prepare_head_iov(r_xprt, req, xdr->head[0].iov_len)) return false; - /* If there is a Read chunk, the page list is handled + /* If there is a Read chunk, the page list is being handled * via explicit RDMA, and thus is skipped here. */ - if (tail->iov_len) { - if (!rpcrdma_prepare_tail_iov(req, xdr, - offset_in_page(tail->iov_base), - tail->iov_len)) + /* Do not include the tail if it is only an XDR pad */ + if (xdr->tail[0].iov_len > 3) { + unsigned int page_base, len; + + /* If the content in the page list is an odd length, + * xdr_write_pages() adds a pad at the beginning of + * the tail iovec. Force the tail's non-pad content to + * land at the next XDR position in the Send message. + */ + page_base = offset_in_page(xdr->tail[0].iov_base); + len = xdr->tail[0].iov_len; + page_base += len & 3; + len -= len & 3; + if (!rpcrdma_prepare_tail_iov(req, xdr, page_base, len)) return false; kref_get(&req->rl_kref); } -- 2.30.2