mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
s390/cio: Do not unregister the subchannel based on DNV
Starting with commit2297791c92
("s390/cio: dont unregister subchannel from child-drivers"), CIO does not unregister subchannels when the attached device is invalid or unavailable. Instead, it allows subchannels to exist without a connected device. However, if the DNV value is 0, such as, when all the CHPIDs of a subchannel are configured in standby state, the subchannel is unregistered, which contradicts the current subchannel specification. Update the logic so that subchannels are not unregistered based on the DNV value. Also update the SCHIB information even if the DNV bit is zero. Suggested-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com> Fixes:2297791c92
("s390/cio: dont unregister subchannel from child-drivers") Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
d6e48a01bb
commit
8c58a22968
@ -459,10 +459,14 @@ int cio_update_schib(struct subchannel *sch)
|
||||
{
|
||||
struct schib schib;
|
||||
|
||||
if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib))
|
||||
if (stsch(sch->schid, &schib))
|
||||
return -ENODEV;
|
||||
|
||||
memcpy(&sch->schib, &schib, sizeof(schib));
|
||||
|
||||
if (!css_sch_is_valid(&schib))
|
||||
return -EACCES;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cio_update_schib);
|
||||
|
@ -1387,14 +1387,18 @@ enum io_sch_action {
|
||||
IO_SCH_VERIFY,
|
||||
IO_SCH_DISC,
|
||||
IO_SCH_NOP,
|
||||
IO_SCH_ORPH_CDEV,
|
||||
};
|
||||
|
||||
static enum io_sch_action sch_get_action(struct subchannel *sch)
|
||||
{
|
||||
struct ccw_device *cdev;
|
||||
int rc;
|
||||
|
||||
cdev = sch_get_cdev(sch);
|
||||
if (cio_update_schib(sch)) {
|
||||
rc = cio_update_schib(sch);
|
||||
|
||||
if (rc == -ENODEV) {
|
||||
/* Not operational. */
|
||||
if (!cdev)
|
||||
return IO_SCH_UNREG;
|
||||
@ -1402,6 +1406,16 @@ static enum io_sch_action sch_get_action(struct subchannel *sch)
|
||||
return IO_SCH_UNREG;
|
||||
return IO_SCH_ORPH_UNREG;
|
||||
}
|
||||
|
||||
/* Avoid unregistering subchannels without working device. */
|
||||
if (rc == -EACCES) {
|
||||
if (!cdev)
|
||||
return IO_SCH_NOP;
|
||||
if (ccw_device_notify(cdev, CIO_GONE) != NOTIFY_OK)
|
||||
return IO_SCH_UNREG_CDEV;
|
||||
return IO_SCH_ORPH_CDEV;
|
||||
}
|
||||
|
||||
/* Operational. */
|
||||
if (!cdev)
|
||||
return IO_SCH_ATTACH;
|
||||
@ -1471,6 +1485,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
|
||||
rc = 0;
|
||||
goto out_unlock;
|
||||
case IO_SCH_ORPH_UNREG:
|
||||
case IO_SCH_ORPH_CDEV:
|
||||
case IO_SCH_ORPH_ATTACH:
|
||||
ccw_device_set_disconnected(cdev);
|
||||
break;
|
||||
@ -1502,6 +1517,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
|
||||
/* Handle attached ccw device. */
|
||||
switch (action) {
|
||||
case IO_SCH_ORPH_UNREG:
|
||||
case IO_SCH_ORPH_CDEV:
|
||||
case IO_SCH_ORPH_ATTACH:
|
||||
/* Move ccw device to orphanage. */
|
||||
rc = ccw_device_move_to_orph(cdev);
|
||||
|
Loading…
Reference in New Issue
Block a user