Skip to content

Commit 32ae4a2

Browse files
oberparVasily Gorbik
authored andcommitted
s390/cio: Fix CHPID "configure" attribute caching
In some environments, the SCLP firmware interface used to query a CHPID's configured state is not supported. On these environments, rapidly reading the corresponding sysfs attribute produces inconsistent results: $ cat /sys/devices/css0/chp0.00/configure cat: /sys/devices/css0/chp0.00/configure: Operation not supported $ cat /sys/devices/css0/chp0.00/configure 3 This occurs for example when Linux is run as a KVM guest. The inconsistency is a result of CIO using cached results for generating the value of the "configure" attribute while failing to handle the situation where no data was returned by SCLP. Fix this by not updating the cache-expiration timestamp when SCLP returns no data. With the fix applied, the system response is consistent: $ cat /sys/devices/css0/chp0.00/configure cat: /sys/devices/css0/chp0.00/configure: Operation not supported $ cat /sys/devices/css0/chp0.00/configure cat: /sys/devices/css0/chp0.00/configure: Operation not supported Reviewed-by: Vineeth Vijayan <[email protected]> Reviewed-by: Eric Farman <[email protected]> Tested-by: Eric Farman <[email protected]> Signed-off-by: Peter Oberparleiter <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 8d1d1e8 commit 32ae4a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/s390/cio/chp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,8 @@ static int info_update(void)
695695
if (time_after(jiffies, chp_info_expires)) {
696696
/* Data is too old, update. */
697697
rc = sclp_chp_read_info(&chp_info);
698-
chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL ;
698+
if (!rc)
699+
chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL;
699700
}
700701
mutex_unlock(&info_lock);
701702

0 commit comments

Comments
 (0)