Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbdFZC6T (ORCPT ); Sun, 25 Jun 2017 22:58:19 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34833 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751656AbdFZC6K (ORCPT ); Sun, 25 Jun 2017 22:58:10 -0400 Date: Mon, 26 Jun 2017 11:58:18 +0900 From: Sergey Senozhatsky To: Sergey Senozhatsky Cc: Sami Kerola , Minchan Kim , Nitin Gupta , linux-kernel@vger.kernel.org, Andrew Morton , Karel Zak , util-linux Subject: Re: zram hot_add device busy Message-ID: <20170626025818.GB373@jagdpanzerIV.localdomain> References: <20170626023912.GA373@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170626023912.GA373@jagdpanzerIV.localdomain> User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 914 Lines: 35 On (06/26/17 11:39), Sergey Senozhatsky wrote: [..] > ok... I don't think I see what we can do in zram about the > issue in question. ... check init_done() in reset_store() and avoid the whole ->bd_openers branch if the device is already reset? // not compile tested. just a sketch. // --- diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index debee952dcc1..79b1a957a6bd 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1047,6 +1047,14 @@ static ssize_t reset_store(struct device *dev, return -EINVAL; zram = dev_to_zram(dev); + + down_write(&zram->init_lock); + if (!init_done(zram)) { + up_write(&zram->init_lock); + return len; + } + up_write(&zram->init_lock); + bdev = bdget_disk(zram->disk, 0); if (!bdev) return -ENOMEM; --- -ss