Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936119AbaFJA2e (ORCPT ); Mon, 9 Jun 2014 20:28:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58624 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934621AbaFJAWt (ORCPT ); Mon, 9 Jun 2014 20:22:49 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Andrzej Siewior , Nicholas Bellinger , Ben Hutchings , Rui Xiang Subject: [PATCH 3.4 71/88] target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping Date: Mon, 9 Jun 2014 17:25:21 -0700 Message-Id: <20140610002426.831923318@linuxfoundation.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <20140610002424.500996570@linuxfoundation.org> References: <20140610002424.500996570@linuxfoundation.org> User-Agent: quilt/0.63-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sebastian Andrzej Siewior commit 40ff2c3b3da35dd3a00ac6722056a59b4b3f2caf upstream. This patch changes vectored file I/O to use kmap + kunmap when mapping incoming SGL memory -> struct iovec in order to properly support 32-bit highmem configurations. This is because an extra bounce buffer may be required when processing scatterlist pages allocated with GFP_KERNEL. Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Nicholas Bellinger [bwh: Backported to 3.2: use task->task_sg{,_nents} for iteration] Signed-off-by: Ben Hutchings Cc: Rui Xiang Signed-off-by: Greg Kroah-Hartman --- drivers/target/target_core_file.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -299,7 +299,7 @@ static int fd_do_readv(struct se_task *t for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { iov[i].iov_len = sg->length; - iov[i].iov_base = sg_virt(sg); + iov[i].iov_base = kmap(sg_page(sg)) + sg->offset; } old_fs = get_fs(); @@ -307,6 +307,8 @@ static int fd_do_readv(struct se_task *t ret = vfs_readv(fd, &iov[0], task->task_sg_nents, &pos); set_fs(old_fs); + for_each_sg(task->task_sg, sg, task->task_sg_nents, i) + kunmap(sg_page(sg)); kfree(iov); /* * Return zeros and GOOD status even if the READ did not return @@ -352,7 +354,7 @@ static int fd_do_writev(struct se_task * for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { iov[i].iov_len = sg->length; - iov[i].iov_base = sg_virt(sg); + iov[i].iov_base = kmap(sg_page(sg)) + sg->offset; } old_fs = get_fs(); @@ -360,6 +362,9 @@ static int fd_do_writev(struct se_task * ret = vfs_writev(fd, &iov[0], task->task_sg_nents, &pos); set_fs(old_fs); + for_each_sg(task->task_sg, sg, task->task_sg_nents, i) + kunmap(sg_page(sg)); + kfree(iov); if (ret < 0 || ret != task->task_size) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/