lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150126161328.GA21242@htj.dyndns.org>
Date:	Mon, 26 Jan 2015 11:13:28 -0500
From:	Tejun Heo <tj@...nel.org>
To:	David Herrmann <dh.herrmann@...il.com>
Cc:	linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH RFC] loop: make partition scanning reliable

Hello, David.

On Mon, Jan 26, 2015 at 11:15:19AM +0100, David Herrmann wrote:
> -static int blkdev_reread_part(struct block_device *bdev)
> +int blkdev_reread_part(struct block_device *bdev, int skipbusy)
>  {
>  	struct gendisk *disk = bdev->bd_disk;
>  	int res;
> @@ -159,12 +159,15 @@ static int blkdev_reread_part(struct block_device *bdev)
>  		return -EINVAL;
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EACCES;
> -	if (!mutex_trylock(&bdev->bd_mutex))
> +	if (!skipbusy)
> +		mutex_lock(&bdev->bd_mutex);
> +	else if (!mutex_trylock(&bdev->bd_mutex))
>  		return -EBUSY;

Do we actually need the mutex_trylock() path?  Why can't we just
always grab the mutex?

...
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 6cb1beb..4047985 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -637,7 +637,7 @@ out:
>   * new backing store is the same size and type as the old backing store.
>   */
>  static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
> -			  unsigned int arg)
> +			  unsigned int arg, int *rrpart)

bool *rrpart would be better but can't we communicate this through the
return value?  Wouldn't that be prettier?

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ