RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2139728 - [Azure][RHEL8] Live resize of disk does not trigger a rescan of the device capacity
Summary: [Azure][RHEL8] Live resize of disk does not trigger a rescan of the device ca...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: kernel
Version: 8.6
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Red Hat Kernel Manager
QA Contact: xuli
URL:
Whiteboard:
Depends On:
Blocks: 2192344 2192345
TreeView+ depends on / blocked
 
Reported: 2022-11-03 10:13 UTC by Klaas Demter
Modified: 2023-09-07 00:48 UTC (History)
19 users (show)

Fixed In Version: kernel-4.18.0-445.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2192344 2192345 (view as bug list)
Environment:
Last Closed: 2023-05-16 08:55:50 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gitlab redhat/rhel/src/kernel rhel-8 merge_requests 3889 0 None None None 2022-12-01 17:07:41 UTC
Red Hat Issue Tracker RHELPLAN-138219 0 None None None 2022-11-03 11:28:17 UTC
Red Hat Product Errata RHSA-2023:2951 0 None None None 2023-05-16 08:56:32 UTC

Description Klaas Demter 2022-11-03 10:13:54 UTC
Description of problem:
When live resizing a disk in Azure RHEL8 does not pick up the new size automatically.


Version-Release number of selected component (if applicable):
kernel-core-4.18.0-372.26.1.el8_6.x86_64


How reproducible:
Create a VM with a data disk, live resize the disk while VM is running.


Steps to Reproduce:
1. Install an Azure Machine with a data disk of size 4GiB
2. start VM
3. live resize it to 8GiB

Actual results:
[620251.940728] hv_storvsc f8b3781b-1e82-4818-a1c3-63d806ec15bb: tag#202 cmd 0x2a status: scsi 0x2 srb 0x84 hv 0xc0000001
[620251.940766] sd 1:0:0:0: Capacity data has changed

After hv_storvsc has noticed the capacity has changed you need to manually tell the disk to rescan its capacity:
$ echo 1 > /sys/block/XX/device/rescan
where XX is the device you resized, sda/sdb/sdc/...

Expected results:
Automatically notice the new size like with RHV/oVirt/qemu-kvm

Comment 1 Klaas Demter 2022-11-04 09:53:20 UTC
Can someone please remove the private again, nothing in this bug is private information

Comment 2 Klaas Demter 2022-11-08 10:34:19 UTC
@xuli it seems the private flag gets readded by @bugzilla automatically. Shall I open a bug against bugzilla for that -- or is it some setting I don't know about :)

Comment 3 Klaas Demter 2022-11-08 10:53:19 UTC
Also I am guessing we should add the Microsoft people to this, right? This should be missing in the HyperV linux kernel parts?
@haiyangz @kys

Comment 4 xuli 2022-11-09 08:54:40 UTC
Hi Klaas,

Thank you so much for raising this bug.

Based on my test, the same behavior exists when testing RHEL 7/8/9 VM on Hyper-V, Ubuntu VM (5.15.0-52-generic) on Hyper-V, also RHEL VM on ESXi platform. After expanding the disk, it needs to execute `echo 1 > /sys/block/XX/device/rescan` to get the expanded disk size.

Could please Long Li and Cathy help to check and explain more whether this is working as design or not? Thank you so much.

Add more detailed steps:
1. Start VM, add new hard disk 1 G (SCSI Controller -> Hard Drive -> New -> Dynamically expanding)

# fdisk -l
Disk /dev/sdb: 1 GiB, 1073741824 bytes, 2097152 sectors
Disk model: Virtual Disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

# dmesg | grep -i capacity
[  157.693295] sd 0:0:0:1: Capacity data has changed

2. Go to Hyper-V Manager, select disk, edit disk and expand to 2G

3. Check disk size in VM

# fdisk -l
Disk /dev/sdb: 1 GiB, 1073741824 bytes, 2097152 sectors
Disk model: Virtual Disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

# echo 1 > /sys/block/sdb/device/rescan

# fdisk -l
Disk /dev/sdb: 2 GiB, 2147483648 bytes, 4194304 sectors
Disk model: Virtual Disk    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Comment 5 xuli 2022-11-09 09:22:14 UTC
(In reply to Klaas Demter from comment #2)
> @xuli it seems the private flag gets readded by
> @bugzilla automatically. Shall I open a bug against bugzilla for
> that -- or is it some setting I don't know about :)

From bugzilla team's information, defaulting bugs to private is a per component setting. The setting is controlled by the team that own a component, e.g. Kernel component for this bug. If we disagree with the setting for a specific component we need to contact the owners of that component and discuss it with them.  Thank you.

Comment 6 Ming Lei 2022-11-09 11:04:28 UTC
Hi Xuli,

What is the behavior/result when doing similar test on virtio-scsi/kvm guest?


Thanks,
Ming

Comment 7 Klaas Demter 2022-11-09 12:03:13 UTC
@minlei I can answer that one.

Outside of using Azure I only use qemu-kvm via ovirt/red hat virtualization. There the disk resize is immediately recognized by the OS. This is the output from a current c8s kernel VM:


[186622.645817] sd 0:0:0:0: Capacity data has changed
[186622.651773] sd 0:0:0:0: [sda] 106954752 512-byte logical blocks: (54.8 GB/51.0 GiB)
[186622.655150] sda: detected capacity change from 53687091200 to 54760833024

The example here is with virtio-scsi.


So the first part happens with hyperV as well, sd notices that the capacity data has changed (see initial description "[620251.940766] sd 1:0:0:0: Capacity data has changed"). But it does not continue.

I had a brief talk with the qemu people a couple of weeks ago, they said the host is kicking the VM to initiate a rescan, I believe they pointed to https://github.com/torvalds/linux/blob/f141df371335645ce29a87d9683a3f79fba7fd67/drivers/block/virtio_blk.c#L586 , but I did not save the conversation :)



Greetings
Klaas

Comment 9 Ming Lei 2022-11-09 13:32:53 UTC
(In reply to Klaas Demter from comment #7)
> @minlei I can answer that one.
> 
> Outside of using Azure I only use qemu-kvm via ovirt/red hat virtualization.
> There the disk resize is immediately recognized by the OS. This is the
> output from a current c8s kernel VM:
> 
> 
> [186622.645817] sd 0:0:0:0: Capacity data has changed
> [186622.651773] sd 0:0:0:0: [sda] 106954752 512-byte logical blocks: (54.8
> GB/51.0 GiB)
> [186622.655150] sda: detected capacity change from 53687091200 to 54760833024
> 
> The example here is with virtio-scsi.
> 
> 
> So the first part happens with hyperV as well, sd notices that the capacity
> data has changed (see initial description "[620251.940766] sd 1:0:0:0:
> Capacity data has changed"). But it does not continue.
> 
> I had a brief talk with the qemu people a couple of weeks ago, they said the
> host is kicking the VM to initiate a rescan, I believe they pointed to
> https://github.com/torvalds/linux/blob/
> f141df371335645ce29a87d9683a3f79fba7fd67/drivers/block/virtio_blk.c#L586 ,
> but I did not save the conversation :)

Probably the difference may be caused in the following code:

sd_open():
    ...
    if (sd_need_revalidate(bdev, sdkp))
        sd_revalidate_disk(bdev->bd_disk);
    ...

For virtio-scsi, the above sd_revalidate_disk() is called and size change message
is dumpped, but looks sd_need_revalidate() returns false for storvsc.


Thanks,

Comment 10 Michael Kelley 2022-11-09 18:54:33 UTC
I just posted a fix to LKML:  https://lore.kernel.org/linux-hyperv/1668019722-1983-1-git-send-email-mikelley@microsoft.com/T/#u.

Comment 11 Eduardo Otubo 2022-11-22 10:50:32 UTC
(In reply to Michael Kelley from comment #10)
> I just posted a fix to LKML: 
> https://lore.kernel.org/linux-hyperv/1668019722-1983-1-git-send-email-
> mikelley/T/#u.

@mikelley thank you for the update. Can you ping this BZ once your patch is merged so we can get it backported? Thanks!

Comment 26 errata-xmlrpc 2023-05-16 08:55:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: kernel security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2023:2951

Comment 27 Klaas Demter 2023-06-07 12:08:29 UTC
I have verified this on a rhel 8.8 VM. works as expected. Thanks to everyone involved in solving this!


Note You need to log in before you can comment on or make changes to this bug.