From patchwork Tue Oct 25 14:37:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 9394591 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 C7FC960762 for ; Tue, 25 Oct 2016 14:37:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB2D9289AD for ; Tue, 25 Oct 2016 14:37:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AFEEC2961B; Tue, 25 Oct 2016 14:37:23 +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=ham 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 A34DC2960C for ; Tue, 25 Oct 2016 14:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752837AbcJYOhW (ORCPT ); Tue, 25 Oct 2016 10:37:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60590 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750813AbcJYOhV (ORCPT ); Tue, 25 Oct 2016 10:37:21 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 613C87AE81; Tue, 25 Oct 2016 14:37:21 +0000 (UTC) Received: from localhost (vpn-48-238.rdu2.redhat.com [10.10.48.238]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9PEbK6L027526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 25 Oct 2016 10:37:20 -0400 Date: Tue, 25 Oct 2016 10:37:19 -0400 From: Mike Snitzer To: Christoph Hellwig , axboe@kernel.dk Cc: Mikulas Patocka , dm-devel@redhat.com, "Alasdair G. Kergon" , linux-block@vger.kernel.org Subject: [PATCH] brd: remove support for BLKFLSBUF Message-ID: <20161025143719.GA51266@redhat.com> References: <20161021200022.GA12580@redhat.com> <20161024155756.GA48306@redhat.com> <20161025130712.GA12717@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161025130712.GA12717@infradead.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 25 Oct 2016 14:37:21 +0000 (UTC) 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 Tue, Oct 25 2016 at 9:07P -0400, Christoph Hellwig wrote: > I think the right fix is to kill off the BLKFLSBUF special case in > brd. Yes, it break compatibility - but in this case the compatibility > breaks more than it helps. Jens, please pick up this patch: From: Mike Snitzer Date: Tue, 25 Oct 2016 10:25:07 -0400 Subject: [PATCH] brd: remove support for BLKFLSBUF Discontinue having the brd driver destructively free all pages in the ramdisk in response to the BLKFLSBUF ioctl. Doing so allows a BLKFLSBUF ioctl issued to a logical partition to destroy pages of the parent brd device (and all other partitions of that brd device). This change breaks compatibility - but in this case the compatibility breaks more than it helps. Reported-by: Mikulas Patocka Suggested-by: Christoph Hellwig Signed-off-by: Mike Snitzer --- drivers/block/brd.c | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index 0c76d40..45c998a 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -395,44 +395,9 @@ static long brd_direct_access(struct block_device *bdev, sector_t sector, #define brd_direct_access NULL #endif -static int brd_ioctl(struct block_device *bdev, fmode_t mode, - unsigned int cmd, unsigned long arg) -{ - int error; - struct brd_device *brd = bdev->bd_disk->private_data; - - if (cmd != BLKFLSBUF) - return -ENOTTY; - - /* - * ram device BLKFLSBUF has special semantics, we want to actually - * release and destroy the ramdisk data. - */ - mutex_lock(&brd_mutex); - mutex_lock(&bdev->bd_mutex); - error = -EBUSY; - if (bdev->bd_openers <= 1) { - /* - * Kill the cache first, so it isn't written back to the - * device. - * - * Another thread might instantiate more buffercache here, - * but there is not much we can do to close that race. - */ - kill_bdev(bdev); - brd_free_pages(brd); - error = 0; - } - mutex_unlock(&bdev->bd_mutex); - mutex_unlock(&brd_mutex); - - return error; -} - static const struct block_device_operations brd_fops = { .owner = THIS_MODULE, .rw_page = brd_rw_page, - .ioctl = brd_ioctl, .direct_access = brd_direct_access, };