From patchwork Mon Jan 7 20:37:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3.5.y.z, extended, stable] Patch "target/file: Fix 32-bit highmem breakage for SGL -> iovec" has been added to staging queue Date: Mon, 07 Jan 2013 10:37:04 -0000 From: Herton Ronaldo Krzesinski X-Patchwork-Id: 210195 Message-Id: <1357591024-20975-1-git-send-email-herton.krzesinski@canonical.com> To: Sebastian Andrzej Siewior Cc: kernel-team@lists.ubuntu.com, Nicholas Bellinger This is a note to let you know that I have just added a patch titled target/file: Fix 32-bit highmem breakage for SGL -> iovec to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Herton ------ >From 5a5f3f17e9f6439f3e521846842382a3310471d5 Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 5 Dec 2012 12:08:29 +0100 Subject: [PATCH] target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping 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 Signed-off-by: Herton Ronaldo Krzesinski --- drivers/target/target_core_file.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 1.7.9.5 diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index c0d6e6d..d2414e9 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -279,7 +279,7 @@ static int fd_do_readv(struct se_cmd *cmd, struct scatterlist *sgl, for_each_sg(sgl, sg, sgl_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(); @@ -287,6 +287,8 @@ static int fd_do_readv(struct se_cmd *cmd, struct scatterlist *sgl, ret = vfs_readv(fd, &iov[0], sgl_nents, &pos); set_fs(old_fs); + for_each_sg(sgl, sg, sgl_nents, i) + kunmap(sg_page(sg)); kfree(iov); /* * Return zeros and GOOD status even if the READ did not return @@ -332,7 +334,7 @@ static int fd_do_writev(struct se_cmd *cmd, struct scatterlist *sgl, for_each_sg(sgl, sg, sgl_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(); @@ -340,6 +342,9 @@ static int fd_do_writev(struct se_cmd *cmd, struct scatterlist *sgl, ret = vfs_writev(fd, &iov[0], sgl_nents, &pos); set_fs(old_fs); + for_each_sg(sgl, sg, sgl_nents, i) + kunmap(sg_page(sg)); + kfree(iov); if (ret < 0 || ret != cmd->data_length) {