diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index b53a2b312..cb428fe52 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -1407,6 +1407,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) struct inode *inode; struct file *fd; struct blk_integrity *bi; + const char *bi_profile_name; TRACE_ENTRY(); @@ -1430,9 +1431,14 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) goto out_no_bi; } - TRACE_DBG("BI name %s", bi->name); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) + bi_profile_name = bi->name; +#else + bi_profile_name = bi->profile->name; +#endif + TRACE_DBG("BI name %s", bi_profile_name); - if (!strcmp(bi->name, "T10-DIF-TYPE1-CRC")) { + if (!strcmp(bi_profile_name, "T10-DIF-TYPE1-CRC")) { dev->dev_dif_ip_not_supported = 1; if (virt_dev->dif_type != 1) { PRINT_ERROR("Integrity type mismatch, %d expected, " @@ -1441,7 +1447,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) res = -EINVAL; goto out_close; } - } else if (!strcmp(bi->name, "T10-DIF-TYPE1-IP")) { + } else if (!strcmp(bi_profile_name, "T10-DIF-TYPE1-IP")) { if (virt_dev->dif_type != 1) { PRINT_ERROR("Integrity type mismatch, %d expected, " "but block device has 1 (dev %s)", @@ -1449,7 +1455,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) res = -EINVAL; goto out_close; } - } else if (!strcmp(bi->name, "T10-DIF-TYPE3-CRC")) { + } else if (!strcmp(bi_profile_name, "T10-DIF-TYPE3-CRC")) { dev->dev_dif_ip_not_supported = 1; if (virt_dev->dif_type != 3) { PRINT_ERROR("Integrity type mismatch, %d expected, " @@ -1458,7 +1464,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) res = -EINVAL; goto out_close; } - } else if (!strcmp(bi->name, "T10-DIF-TYPE3-IP")) { + } else if (!strcmp(bi_profile_name, "T10-DIF-TYPE3-IP")) { if (virt_dev->dif_type != 3) { PRINT_ERROR("Integrity type mismatch, %d expected, " "but block device has 3 (dev %s)", @@ -1468,7 +1474,7 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) } } else { PRINT_ERROR("Unable to understand integrity name %s" - "(dev %s)", bi->name, dev->virt_name); + "(dev %s)", bi_profile_name, dev->virt_name); res = -EINVAL; goto out_close; }