From patchwork Tue Jun 5 09:30:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 10449847 X-Patchwork-Delegate: snitzer@redhat.com 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 BFE6360467 for ; Wed, 6 Jun 2018 08:37:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE1142977B for ; Wed, 6 Jun 2018 08:37:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A20E2297E7; Wed, 6 Jun 2018 08:37:41 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2E5E92977B for ; Wed, 6 Jun 2018 08:37:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C4F081102; Wed, 6 Jun 2018 08:37:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C230B1001F44; Wed, 6 Jun 2018 08:37:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 43E251800FD8; Wed, 6 Jun 2018 08:37:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w559V2EB014208 for ; Tue, 5 Jun 2018 05:31:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6923D3001A59; Tue, 5 Jun 2018 09:31:02 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28888300193F; Tue, 5 Jun 2018 09:30:50 +0000 (UTC) Received: from mail-qt0-f195.google.com (mail-qt0-f195.google.com [209.85.216.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC96B315C4C7; Tue, 5 Jun 2018 09:30:38 +0000 (UTC) Received: by mail-qt0-f195.google.com with SMTP id i18-v6so1620889qtp.12; Tue, 05 Jun 2018 02:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CL7tN30e8urGpky+W8C5ABfwFj1RisQSs58R+YCj6Dg=; b=UdvFUY5BO+bj1by0JIiRLQSL5ETNE0y0DWCIYkJr01a3kZfFQVRnQs5vm7Xo2JHOSc z3SCMYAW8bHsMA+9D26h9Tv8ijg4cWZ/6L0WdJU8D6QUn+CjfN7PwXeFYmcNZL83jCHt 2yWkOOTMGpHd9GF5F2zgNM4woGfqY84nwm3tRju32V+EpVPQFLuD7G10IK6XT+cRk//Q HLi9Xc4FuHNArueqOeUQbt6174npw12Cq0gC/iNRh6DTGv+D9KEXPxjE0/bUUNmAz9+K mzY/4kwUkEJAPXHnw/yPZ21ioQDUDMlo2kDQH8jbnaKifEpuBL6DE8noEz/ks9i3QU7f FpWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CL7tN30e8urGpky+W8C5ABfwFj1RisQSs58R+YCj6Dg=; b=mYio9cvSnW6jfK1ySy5PyP+ZrMDFBULWKPbnGWV3hD0PibWzVpJG1cGk83012rqYBN 8/Q438JLh3iZU9stF3n1BAI6/3CVMIu6O5K1j1nQIYOxMtd2SnYAv/Pcn+BNQ876HW8u IBcRYCmJhHy9IBrjwH8IQ8rYldBDnRVHWOtResURem3URC6uXn7JitilzhXpEUQ0wqw4 cirjMdQWbjlXphzKHX043Ty06ej/uvVKN5117f4wuelWxzxspoka4EnyYTNi5GClTzq/ R2AgxC3MlJTZzTkCaVta+LKxfyg/pD0lYu4SvJpz8Fup9FNFLMvQBkmTW/cIH5Iz3fvW /yvA== X-Gm-Message-State: APt69E3CqtiEMVpqxMHZ/ADlMEcDtypZvbUb4LBI8EZuLJs4jkJ6d4RL kq4HJ1u+1LBkpNA38LlZZjGFAas= X-Google-Smtp-Source: ADUXVKKOZq2vs8updgkJWmoKLRiESElLSV7TyhsUx4C9/++g52B8vOs2NRqhegE7U7QgVQmtPG5eJw== X-Received: by 2002:ac8:72ca:: with SMTP id o10-v6mr24665469qtp.409.1528191037860; Tue, 05 Jun 2018 02:30:37 -0700 (PDT) Received: from kmo-pixel (c-71-234-172-214.hsd1.vt.comcast.net. [71.234.172.214]) by smtp.gmail.com with ESMTPSA id j28-v6sm17075283qtk.56.2018.06.05.02.30.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 02:30:36 -0700 (PDT) Date: Tue, 5 Jun 2018 05:30:34 -0400 From: Kent Overstreet To: Ming Lei Message-ID: <20180605093034.GB17780@kmo-pixel> References: <20180605080835.GH28826@ming.t460p> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20180605080835.GH28826@ming.t460p> User-Agent: Mutt/1.10.0 (2018-05-17) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 05 Jun 2018 09:30:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 05 Jun 2018 09:30:39 +0000 (UTC) for IP:'209.85.216.195' DOMAIN:'mail-qt0-f195.google.com' HELO:'mail-qt0-f195.google.com' FROM:'kent.overstreet@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.281 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.216.195 mail-qt0-f195.google.com 209.85.216.195 mail-qt0-f195.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Wed, 06 Jun 2018 04:37:31 -0400 Cc: dm-devel@redhat.com, Mike Snitzer Subject: Re: [dm-devel] [Bug] kernel oops when running xfstests(ext4) generic/081 X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 06 Jun 2018 08:37:40 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jun 05, 2018 at 04:08:37PM +0800, Ming Lei wrote: > Hi, > > The following failure is triggered when running xfstests(ext4) > generic/081 with the linus tree(4.17.0_716a685fdb89). > > It might be related with recent mempool change. Yeah that would be correct. I just tested and confirmed and mailed out the patch below, you want to double check for me? commit 1678b1f8d46c9f8f52372edfde7b9a94e9b416fe Author: Kent Overstreet Date: Tue Jun 5 05:05:51 2018 -0400 dm: Use kzalloc for all structs with embedded biosets/mempools mempool_init()/bioset_init() require that the mempools/biosets be zeroed first; they probably should not _require_ this, but not allocating those structs with kzalloc is a fairly nonsensical thing to do (calling mempool_exit()/bioset_exit() on an uninitialized mempool/bioset is legal and safe, but only works if said memory was zeroed.) Signed-off-by: Kent Overstreet --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/md/dm-bio-prison-v1.c b/drivers/md/dm-bio-prison-v1.c index 8e33a38083..e794e3662f 100644 --- a/drivers/md/dm-bio-prison-v1.c +++ b/drivers/md/dm-bio-prison-v1.c @@ -33,7 +33,7 @@ static struct kmem_cache *_cell_cache; */ struct dm_bio_prison *dm_bio_prison_create(void) { - struct dm_bio_prison *prison = kmalloc(sizeof(*prison), GFP_KERNEL); + struct dm_bio_prison *prison = kzalloc(sizeof(*prison), GFP_KERNEL); int ret; if (!prison) diff --git a/drivers/md/dm-bio-prison-v2.c b/drivers/md/dm-bio-prison-v2.c index 601b156920..f866bc97b0 100644 --- a/drivers/md/dm-bio-prison-v2.c +++ b/drivers/md/dm-bio-prison-v2.c @@ -35,7 +35,7 @@ static struct kmem_cache *_cell_cache; */ struct dm_bio_prison_v2 *dm_bio_prison_create_v2(struct workqueue_struct *wq) { - struct dm_bio_prison_v2 *prison = kmalloc(sizeof(*prison), GFP_KERNEL); + struct dm_bio_prison_v2 *prison = kzalloc(sizeof(*prison), GFP_KERNEL); int ret; if (!prison) diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 53c6ed0eaa..81ffc59d05 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c @@ -51,7 +51,7 @@ struct dm_io_client *dm_io_client_create(void) unsigned min_ios = dm_get_reserved_bio_based_ios(); int ret; - client = kmalloc(sizeof(*client), GFP_KERNEL); + client = kzalloc(sizeof(*client), GFP_KERNEL); if (!client) return ERR_PTR(-ENOMEM); diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c index c89a675a2a..ce7efc7434 100644 --- a/drivers/md/dm-kcopyd.c +++ b/drivers/md/dm-kcopyd.c @@ -882,7 +882,7 @@ struct dm_kcopyd_client *dm_kcopyd_client_create(struct dm_kcopyd_throttle *thro int r; struct dm_kcopyd_client *kc; - kc = kmalloc(sizeof(*kc), GFP_KERNEL); + kc = kzalloc(sizeof(*kc), GFP_KERNEL); if (!kc) return ERR_PTR(-ENOMEM); diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c index 43149eb493..abf3521b80 100644 --- a/drivers/md/dm-region-hash.c +++ b/drivers/md/dm-region-hash.c @@ -180,7 +180,7 @@ struct dm_region_hash *dm_region_hash_create( ; nr_buckets >>= 1; - rh = kmalloc(sizeof(*rh), GFP_KERNEL); + rh = kzalloc(sizeof(*rh), GFP_KERNEL); if (!rh) { DMERR("unable to allocate region hash memory"); return ERR_PTR(-ENOMEM); diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index b11ddc55f2..f745404da7 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -1120,7 +1120,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) origin_mode = FMODE_WRITE; } - s = kmalloc(sizeof(*s), GFP_KERNEL); + s = kzalloc(sizeof(*s), GFP_KERNEL); if (!s) { ti->error = "Cannot allocate private snapshot structure"; r = -ENOMEM; diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 6c923824ec..5772756c63 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -2861,7 +2861,7 @@ static struct pool *pool_create(struct mapped_device *pool_md, return (struct pool *)pmd; } - pool = kmalloc(sizeof(*pool), GFP_KERNEL); + pool = kzalloc(sizeof(*pool), GFP_KERNEL); if (!pool) { *error = "Error allocating memory for pool"; err_p = ERR_PTR(-ENOMEM);