Re: [PATCH v4 2/2] s390/dasd: remove ioctl_by_bdev calls

Christoph Hellwig
2020-10-07T12:00:10Z

On Wed, Oct 07, 2020 at 12:44:55PM +0200, Christian Borntraeger wrote:
>
>
> On 07.10.20 12:39, Christoph Hellwig wrote:
> > On Wed, Oct 07, 2020 at 11:34:17AM +0200, Christian Borntraeger wrote:
> >>
> >> On 19.05.20 16:22, Stefan Haberland wrote:
> >>> The IBM partition parser requires device type specific information only
> >>> available to the DASD driver to correctly register partitions. The
> >>> current approach of using ioctl_by_bdev with a fake user space pointer
> >>> is discouraged.
> >>>
> >>> Fix this by replacing IOCTL calls with direct in-kernel function calls.
> >>>
> >>> Suggested-by: Christoph Hellwig <hch@lst.de>
> >>> Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
> >>> Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
> >>> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
> >>
> >> FWIW, this broken the ibm-partition code for virtio-blk, when CONFIG_DASD=m.
> >
> > What are the symptoms?
>
> During boot I normally have

> [ 0.930231] virtio_blk virtio1: [vda] 5409180 4096-byte logical blocks (22.2 GB/20.6 GiB)
> [ 0.930233] vda: detected capacity change from 0 to 22156001280
> [ 0.932806] vda:VOL1/ 0X3333: vda1 vda2 vda3
>
> With this change, the last line is no longer there (if CONFIG_DASD=m) and this also
> reflects itself in /proc/partitions. The partitions are no longer detected.

Can you try this patch?

diff --git a/block/partitions/ibm.c b/block/partitions/ibm.c
index d6e18df9c53c6d..d91cee558ce67a 100644
--- a/block/partitions/ibm.c
+++ b/block/partitions/ibm.c
@@ -305,8 +305,6 @@ int ibm_partition(struct parsed_partitions *state)
if (!disk->fops->getgeo)
goto out_exit;
fn = symbol_get(dasd_biodasdinfo);
- if (!fn)
- goto out_exit;
blocksize = bdev_logical_block_size(bdev);
if (blocksize <= 0)
goto out_symbol;
@@ -326,7 +324,7 @@ int ibm_partition(struct parsed_partitions *state)
geo->start = get_start_sect(bdev);
if (disk->fops->getgeo(bdev, geo))
goto out_freeall;
- if (fn(disk, info)) {
+ if (!fn || fn(disk, info)) {
kfree(info);
info = NULL;
}