Project

General

Profile

Actions

Bug #14595

closed

sd DLE events should cover the first two partitions

Added by Andy Fiddaman 6 months ago. Updated 6 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

When sd raises a dynamic LUN expansion (DLE) event, it does so for only the first partition on the disk, in contrast to the recently added blkddev DLEs which generate an additional event for the second partition.

This means that online disk resizing works for ZFS pools which do not have an EFI System Partition (ESP) but not for those which do.

root@omnios:~# zdb | egrep ':$|phys_path'
rpool:
    vdev_tree:
        children[0]:
            phys_path: '/hv_vmbus/hv_storvsc@d3d6b9c6-7d94-44bb-b5d5-726e10bb6f94/disk@0,1:b'
test:
    vdev_tree:
        children[0]:
            phys_path: '/hv_vmbus/hv_storvsc@d3d6b9c6-7d94-44bb-b5d5-726e10bb6f94/disk@0,2:a'
root@omnios:~# diskinfo
TYPE    DISK                    VID      PID              SIZE          RMV SSD
SCSI    c1t0d1                  Msft     Virtual Disk       20.00 GiB   no  no
SCSI    c1t0d2                  Msft     Virtual Disk        1.00 GiB   no  no

root@omnios:~# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
rpool  19.5G  2.79G  16.7G        -         -     0%    14%  1.00x  ONLINE  -
test    960M   552K   959M        -         -     0%     0%  1.00x  ONLINE  -

... resize the disk in Hyper-V

root@omnios:~# diskinfo
TYPE    DISK                    VID      PID              SIZE          RMV SSD
SCSI    c1t0d1                  Msft     Virtual Disk       20.00 GiB   no  no
SCSI    c1t0d2                  Msft     Virtual Disk        2.00 GiB   no  no

root@omnios:~# /usr/lib/sysevent/sysevent -r
nvlist version: 0
        date = 2022-03-28T09:38:01.202Z
        type = ready

nvlist version: 0
        date = 2022-03-28T09:38:46.237Z
        type = event
        vendor = SUNW
        publisher = sd
        class = EC_dev_status
        subclass = ESC_dev_dle
        pid = 0
        data = (embedded nvlist)
        nvlist version: 0
                phys_path = /devices/hv_vmbus/hv_storvsc@d3d6b9c6-7d94-44bb-b5d5-726e10bb6f94/disk@0,2:a
        (end data)

root@omnios:~# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
rpool  19.5G  2.79G  16.7G        -         -     0%    14%  1.00x  ONLINE  -
test    960M   552K   959M        -        1G     0%     0%  1.00x  ONLINE  -

root@omnios:~# zpool online -e test c1t0d2
root@omnios:~# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
rpool  19.5G  2.79G  16.7G        -         -     0%    14%  1.00x  ONLINE  -
test   1.94G   684K  1.94G        -         -     0%     0%  1.00x  ONLINE  -
root@omnios:~#
Actions #1

Updated by Electric Monk 6 months ago

  • Gerrit CR set to 2083
Actions #2

Updated by Andy Fiddaman 6 months ago

I tested this on OmniOS in a Gen.2 Hyper-V VM using a hv_storvsc disk, which uses an sd backend.
With this change in place, and resizing the disk outside the VM, two events were sent as expected (and resizing a UEFI rpool with an ESP worked).

root@omnios:~# /usr/lib/sysevent/sysevent -r
nvlist version: 0
        date = 2022-03-28T14:54:25.516Z
        type = ready

nvlist version: 0
        date = 2022-03-28T14:54:52.493Z
        type = event
        vendor = SUNW
        publisher = sd
        class = EC_dev_status
        subclass = ESC_dev_dle
        pid = 0
        data = (embedded nvlist)
        nvlist version: 0
                phys_path = /devices/hv_vmbus/hv_storvsc@d3d6b9c6-7d94-44bb-b5d5-726e10bb6f94/disk@0,1:a
        (end data)

nvlist version: 0
        date = 2022-03-28T14:54:52.494Z
        type = event
        vendor = SUNW
        publisher = sd
        class = EC_dev_status
        subclass = ESC_dev_dle
        pid = 0
        data = (embedded nvlist)
        nvlist version: 0
                phys_path = /devices/hv_vmbus/hv_storvsc@d3d6b9c6-7d94-44bb-b5d5-726e10bb6f94/disk@0,1:b
        (end data)
Actions #3

Updated by Andy Fiddaman 6 months ago

Further notes:

When the SCSI LUN changes size, a DLE event was generated, always for :a - there was
a comment in sd.c that said: * We are using minor node 'a' as the sysevent attribute.

With this change, two events are generated, one for :a and one for :b.

The in-gate consumer for this is the ZFS sysevent module. When it receives
a DLE event, it scans the pools looking for one which has a vdev where the
phys_path matches that in the event, and it's a whole disk vdev. If one
is found then it does a vdev re-open (and an expansion if the pool's
autoexpand attribute is set to on).

Remembering that the existing event handler only responds to whole-disk
pools, what this change fixes is the case when a zpool has an EFI system
partition. In that case, the pool's vdev has a phys_path ending in :b
since :a is the ESP. Resizes on UEFI boot rpools were not triggering any
action by the ZFS sysevent module.

I've tested with various pool configurations, whole disk and not, ESP and
not. The sysevent module ignores the events for the non-whole disks and
correctly re-opens/onlines a vdev with and without an ESP.

I've tested primarily with hv_storvsc (only in OmniOS) but also with physical hardware
with SATA disks. Since it's the sd module which is generating the sysevents, all
higher-level drivers benefit.

Actions #4

Updated by Electric Monk 6 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit f7457249d2a760edca827e174adb0db578a87784

commit  f7457249d2a760edca827e174adb0db578a87784
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2022-04-05T10:42:42.000Z

    14595 sd DLE events should cover the first two partitions
    Reviewed by: Jason King <jason.brian.king+illumos@gmail.com>
    Reviewed by: Yuri Pankov <ypankov@tintri.com>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF