# This patch fixes a memory corruption bug in the s390 dcssblk driver. # The bug occurs when an attempt to change the type of a segment # returns an error. At this point the driver tries to remove the segment in # question while some of the device's attributes are in use. This causes the # driver to hang. # # questions/comments @ emistz@gmail.com diff -urN linux-2.6.23.1/drivers/s390/block/dcssblk.c linuxx/drivers/s390/block/dcssblk.c --- linux-2.6.23.1/drivers/s390/block/dcssblk.c 2007-10-20 01:19:29.000000000 -0400 +++ linuxx/drivers/s390/block/dcssblk.c 2007-10-20 01:16:13.000000000 -0400 @@ -230,8 +230,15 @@ SEGMENT_SHARED); if (rc < 0) { BUG_ON(rc == -EINVAL); - if (rc != -EAGAIN) - goto removeseg; + if (rc != -EAGAIN){ + PRINT_DEBUG + ("Could not reload segment %s in the specified format, reloading\n", + dev_info->segment_name); + rc = segment_modify_shared(dev_info-> + segment_name, + SEGMENT_EXCLUSIVE); + goto out; + } } else { dev_info->is_shared = 1; switch (dev_info->segment_type) { @@ -253,8 +260,12 @@ SEGMENT_EXCLUSIVE); if (rc < 0) { BUG_ON(rc == -EINVAL); - if (rc != -EAGAIN) - goto removeseg; + if (rc != -EAGAIN){ + PRINT_DEBUG("Could not reload segment %s in the specified format, reloading\n", + dev_info->segment_name); + rc = segment_modify_shared(dev_info->segment_name, SEGMENT_SHARED); + goto out; + } } else { dev_info->is_shared = 0; set_disk_ro(dev_info->gd, 0);