Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52ebb438 authored by Borislav Petkov's avatar Borislav Petkov Committed by Bartlomiej Zolnierkiewicz
Browse files

ide-gd: re-get capacity on revalidate



We need to re-get a removable media's capacity when revalidating the
disk so that its partitions get rescanned by the block layer.

Signed-off-by: default avatarBorislav Petkov <petkovbb@gmail.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: axboe@kernel.dk
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 7afa0535
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -281,7 +281,12 @@ static int ide_gd_media_changed(struct gendisk *disk)
static int ide_gd_revalidate_disk(struct gendisk *disk)
{
	struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj);
	set_capacity(disk, ide_gd_capacity(idkp->drive));
	ide_drive_t *drive = idkp->drive;

	if (ide_gd_media_changed(disk))
		drive->disk_ops->get_capacity(drive);

	set_capacity(disk, ide_gd_capacity(drive));
	return 0;
}