Re: [PATCHv3 9/9] zram: add dynamic device add/remove functionality

From: Sergey Senozhatsky
Date: Mon May 04 2015 - 02:32:00 EST


On (05/04/15 11:28), Minchan Kim wrote:
> [minchan]: use zram->claim to avoid lockdep splat
> Reported-by: Minchan Kim <minchan@xxxxxxxxxx>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
> ---

will take a look today, cleanup and re-submit. thanks!


> /*
> * Remove sysfs first, so no one will perform a disksize
> - * store while we destroy the devices
> + * store while we destroy the devices. This also helps during
> + * zram_remove() -- device_reset() is the last holder of
> + * ->init_lock.
> */
> sysfs_remove_group(&disk_to_dev(zram->disk)->kobj,
> &zram_disk_attr_group);
>
> + /* Make sure all pending I/O is finished */
> + fsync_bdev(bdev);
> zram_reset_device(zram);
> + mutex_unlock(&bdev->bd_mutex);
- mutex_unlock(&bdev->bd_mutex);

> + pr_info("Removed device: %s\n", zram->disk->disk_name);
> +
> idr_remove(&zram_index_idr, zram->disk->first_minor);
> blk_cleanup_queue(zram->disk->queue);
> del_gendisk(zram->disk);
> put_disk(zram->disk);
> kfree(zram);
> +
> + return 0;
> }
[..]

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