drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here
Subsystems (2)
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 15e71592dbae49a674429c618a10401d7f992ac3 commit: 394f811848827ad23d2b43e94e5d72a24cfbc39f [211/11867] scsi: target: Add block PR support to iblock config: sparc-randconfig-c003-20230620 (https://download.01.org/0day-ci/archive/20230622/[email protected]/config) compiler: sparc-linux-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230622/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
cocci warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here
vim +892 drivers/target/target_core_iblock.c
837
838 static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key,
839 u64 sa_key, u8 type, bool aptpl)
840 {
841 struct se_device *dev = cmd->se_dev;
842 struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
843 struct block_device *bdev = ib_dev->ibd_bd;
844 const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops;
845 int ret;
846
847 if (!ops) {
848 pr_err("Block device does not support pr_ops but iblock device has been configured for PR passthrough.\n");
849 return TCM_UNSUPPORTED_SCSI_OPCODE;
850 }
851
852 switch (sa) {
853 case PRO_REGISTER:
854 case PRO_REGISTER_AND_IGNORE_EXISTING_KEY:
855 if (!ops->pr_register) {
856 pr_err("block device does not support pr_register.\n");
857 return TCM_UNSUPPORTED_SCSI_OPCODE;
858 }
859
860 /* The block layer pr ops always enables aptpl */
861 if (!aptpl)
862 pr_info("APTPL not set by initiator, but will be used.\n");
863
864 ret = ops->pr_register(bdev, key, sa_key,
865 sa == PRO_REGISTER ? 0 : PR_FL_IGNORE_KEY);
866 break;
867 case PRO_RESERVE:
868 if (!ops->pr_reserve) {
869 pr_err("block_device does not support pr_reserve.\n");
870 return TCM_UNSUPPORTED_SCSI_OPCODE;
871 }
872
873 ret = ops->pr_reserve(bdev, key, scsi_pr_type_to_block(type), 0);
874 break;
875 case PRO_CLEAR:
876 if (!ops->pr_clear) {
877 pr_err("block_device does not support pr_clear.\n");
878 return TCM_UNSUPPORTED_SCSI_OPCODE;
879 }
880
881 ret = ops->pr_clear(bdev, key);
882 break;
883 case PRO_PREEMPT:
884 case PRO_PREEMPT_AND_ABORT:
885 if (!ops->pr_clear) {
886 pr_err("block_device does not support pr_preempt.\n");
887 return TCM_UNSUPPORTED_SCSI_OPCODE;
888 }
889
890 ret = ops->pr_preempt(bdev, key, sa_key,
891 scsi_pr_type_to_block(type),
> 892 sa == PRO_PREEMPT ? false : true);
893 break;
894 case PRO_RELEASE:
895 if (!ops->pr_clear) {
896 pr_err("block_device does not support pr_pclear.\n");
897 return TCM_UNSUPPORTED_SCSI_OPCODE;
898 }
899
900 ret = ops->pr_release(bdev, key, scsi_pr_type_to_block(type));
901 break;
902 default:
903 pr_err("Unknown PERSISTENT_RESERVE_OUT SA: 0x%02x\n", sa);
904 return TCM_UNSUPPORTED_SCSI_OPCODE;
905 }
906
907 if (!ret)
908 return TCM_NO_SENSE;
909 else if (ret == PR_STS_RESERVATION_CONFLICT)
910 return TCM_RESERVATION_CONFLICT;
911 else
912 return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
913 }
914
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 17 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 15e71592dbae49a674429c618a10401d7f992ac3 commit: 394f811848827ad23d2b43e94e5d72a24cfbc39f [211/11867] scsi: target: Add block PR support to iblock config: sparc-randconfig-c003-20230620 (https://download.01.org/0day-ci/archive/20230622/[email protected]/config) compiler: sparc-linux-gcc (GCC) 12.3.0 reproduce: (https://download.01.org/0day-ci/archive/20230622/[email protected]/reproduce)If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/cocci warnings: (new ones prefixed by >>)
Quoted 1 line
Quoted 1 line
drivers/target/target_core_iblock.c:892:30-35: WARNING: conversion to bool not needed here
Quoted 10 lines
883 case PRO_PREEMPT: 884 case PRO_PREEMPT_AND_ABORT: 885 if (!ops->pr_clear) { 886 pr_err("block_device does not support pr_preempt.\n"); 887 return TCM_UNSUPPORTED_SCSI_OPCODE; 888 } 889 890 ret = ops->pr_preempt(bdev, key, sa_key, 891 scsi_pr_type_to_block(type),Quoted 1 line
892 sa ==
PRO_PREEMPT? false : true);
The kernel test robot is correct. I can do the patch below.
Martin, do you want me to just submit the patch below to linux-scsi or fold it into:
commit 394f811848827ad23d2b43e94e5d72a24cfbc39f
Author: Mike Christie <[email protected]> Date: Fri Apr 7 15:05:51 2023 -0500
scsi: target: Add block PR support to iblock
and re-submit that whole patch?
From 96f7e2fa06cd39f2e661530ae14160286f189fbb Mon Sep 17 00:00:00 2001
From: Mike Christie <[email protected]>
Date: Thu, 22 Jun 2023 10:30:12 -0500
Subject: [PATCH] scsi: target: Quiet bool conversion warning with pr_preempt
use
We want to pass in true for pr_preempt's argument if we are doing a PRO_PREEMPT_AND_ABORT, so just test sa against PRO_PREEMPT_AND_ABORT, and pass the result to pr_preempt.
--- drivers/target/target_core_iblock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_iblock.c +1 -1
@@ -888,7 +888,7 @@ static sense_reason_t iblock_execute_pr_out(struct se_cmd *cmd, u8 sa, u64 key, ret = ops->pr_preempt (bdev, key, sa_key,scsi_pr_type_to_block (type), - sa ==PRO_PREEMPT ? false : true); + sa ==PRO_PREEMPT_AND_ABORT );break ;case PRO_RELEASE :if (!ops->pr_clear) {
Signature · 1 line
2.25.1
Mike,
Quoted 2 lines
Martin, do you want me to just submit the patch below to linux-scsi or fold it into:
Please submit the incremental patch. Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering