From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753278AbbDGCL6 (ORCPT ); Mon, 6 Apr 2015 22:11:58 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:49370 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114AbbDGCL4 (ORCPT ); Mon, 6 Apr 2015 22:11:56 -0400 MIME-Version: 1.0 In-Reply-To: <20150406145048.GC2703@infradead.org> References: <1428218688-4092-1-git-send-email-ming.lei@canonical.com> <1428218688-4092-2-git-send-email-ming.lei@canonical.com> <20150405161241.GB16886@infradead.org> <20150406145048.GC2703@infradead.org> Date: Tue, 7 Apr 2015 10:11:53 +0800 Message-ID: Subject: Re: [PATCH 1/6] block: export blkdev_reread_part() From: Ming Lei To: Christoph Hellwig Cc: Jens Axboe , Linux Kernel Mailing List , Tejun Heo , Andrew Morton , Alexander Viro , Jarod Wilson , David Herrmann , Markus Pargmann , "nbd-general@lists.sourceforge.net" , Stefan Haberland , Sebastian Ott , Fabian Frederick , linux-s390@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 6, 2015 at 10:50 PM, Christoph Hellwig wrote: > On Mon, Apr 06, 2015 at 12:40:12AM +0800, Ming Lei wrote: >> > int blkdev_reread_part(struct block_device *bdev) >> > { >> > if (!mutex_trylock(&bdev->bd_mutex)) >> > return -EBUSY; >> > blkdev_reread_part_nolock(bdev); >> > mutex_unlock(&bdev->bd_mutex); >> > } >> >> Yes, it is more clean, but with extra acquiring lock cost for the >> failure cases, especially when we replace trylock with mutex_lock(). > > It's just a few fairly trivial checks, so 'm not really worried about > it, especially given that blkdev_reread_part isn't called from a fast > path. OK, considered that common users don't have any privilege on block devices at default in most distributions, so they can't do DoS by running ioctl(RRPART) with this change. I will change to this style in v1. Thanks, Ming Lei