From patchwork Wed Mar 8 07:58:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 9610565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A9D960414 for ; Wed, 8 Mar 2017 08:45:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0C4428582 for ; Wed, 8 Mar 2017 08:45:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A575128586; Wed, 8 Mar 2017 08:45:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BB6328582 for ; Wed, 8 Mar 2017 08:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751968AbdCHIpN (ORCPT ); Wed, 8 Mar 2017 03:45:13 -0500 Received: from mx2.suse.de ([195.135.220.15]:43285 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751235AbdCHIn6 (ORCPT ); Wed, 8 Mar 2017 03:43:58 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2855DABCD; Wed, 8 Mar 2017 07:58:03 +0000 (UTC) Subject: Re: [PATCH] zram: set physical queue limits to avoid array out of bounds accesses To: Minchan Kim References: <20170306102335.9180-1-jthumshirn@suse.de> <20170307052242.GA29458@bbox> <95c31a93-32cd-ad06-6cc0-e11b42ec2f68@suse.de> <20170307085545.GA538@bbox> <10a2335c-0ed0-43de-1cbd-625845301aef@suse.de> <20170308051118.GA11206@bbox> Cc: Hannes Reinecke , Jens Axboe , Nitin Gupta , Christoph Hellwig , Sergey Senozhatsky , yizhan@redhat.com, Linux Block Layer Mailinglist , Linux Kernel Mailinglist From: Johannes Thumshirn Message-ID: <1073055f-e71b-bb07-389a-53b60ccdee20@suse.de> Date: Wed, 8 Mar 2017 08:58:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <20170308051118.GA11206@bbox> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 03/08/2017 06:11 AM, Minchan Kim wrote: > And could you test this patch? It avoids split bio so no need new bio > allocations and makes zram code simple. > > From f778d7564d5cd772f25bb181329362c29548a257 Mon Sep 17 00:00:00 2001 > From: Minchan Kim > Date: Wed, 8 Mar 2017 13:35:29 +0900 > Subject: [PATCH] fix > > Not-yet-Signed-off-by: Minchan Kim > --- [...] Yup, this works here. I did a mkfs.xfs /dev/nvme0n1 dd if=/dev/urandom of=/test.bin bs=1M count=128 sha256sum test.bin mount /dev/nvme0n1 /dir mv test.bin /dir/ sha256sum /dir/test.bin No panics and sha256sum of the 128MB test file still matches Tested-by: Johannes Thumshirn Reviewed-by: Johannes Thumshirn Now that you removed the one page limit in zram_bvec_rw() you can also add this hunk to remove the queue splitting: atomic64_inc(&zram->stats.invalid_io); Byte, Johannes diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 85f4df8..27b168f6 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -868,8 +868,6 @@ static blk_qc_t zram_make_request(struct request_queue *queue, struct bio *bio) { struct zram *zram = queue->queuedata; - blk_queue_split(queue, &bio, queue->bio_split); - if (!valid_io_request(zram, bio->bi_iter.bi_sector, bio->bi_iter.bi_size)) {