open-iscsi / tcmu-runner

A daemon that handles the userspace side of the LIO TCM-User backstore.
Apache License 2.0
189 stars 148 forks source link

centos 7.9 client mkfs.xfs lun device can cause rocky8.9 tcmu-runner-1.5.4 service failed #702

Open zlxzfg opened 1 month ago

zlxzfg commented 1 month ago

1、 I install glusterfs-6.0-63 and tcmu-runner=1.5.4 on rocky 8.9 system 2、Config ”user:glfs“ lun , and map lun to a target

[root@r01 ~]# targetcli ls
o- / .................................................................................. [...]
  o- backstores ....................................................................... [...]
  | o- block ........................................................... [Storage Objects: 0]
  | o- fileio .......................................................... [Storage Objects: 0]
  | o- pscsi ........................................................... [Storage Objects: 0]
  | o- ramdisk ......................................................... [Storage Objects: 0]
  | o- user:fbo ........................................................ [Storage Objects: 0]
  | o- user:glfs ....................................................... [Storage Objects: 1]
  | | o- a89033144f625d06eb5128ac146a30c1  [vol-ec@localhost/.iscsi/lun01.raw (100.0MiB) acti
vated]  | |   o- alua ............................................................ [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ................................ [ALUA state: Active/optimized]
  | o- user:qcow ....................................................... [Storage Objects: 0]
  | o- user:rbd ........................................................ [Storage Objects: 0]
  | o- user:zbc ........................................................ [Storage Objects: 0]
  o- iscsi ..................................................................... [Targets: 1]
  | o- iqn.2021-08.cluster-01.target-01 ........................................... [TPGs: 1]
  |   o- tpg1 ........................................................... [gen-acls, no-auth]
  |     o- acls ................................................................... [ACLs: 0]
  |     o- luns ................................................................... [LUNs: 1]
  |     | o- lun0 ................ [user/a89033144f625d06eb5128ac146a30c1 (default_tg_pt_gp)]
  |     o- portals ............................................................. [Portals: 1]
  |       o- 0.0.0.0:3260 .............................................................. [OK]
  o- loopback .................................................................. [Targets: 0]
[root@r01 ~]# 

3、 Try access tcmu-runner service on centos 7.9 iscsi initiator ( iscsi-initiator-utils-6.2.0.874-19.el7.x86_64), i can login success and find the lun device (/dev/sdb) 4、 Try run "mkfs.xfs /dev/sdb" command to format the lun device when I run mkfs.xfs, it is hang , then tcmu service failed clipboard 5、 I check the log "tcmu-runner.log" when tcmu service failed , i can see the log :

2024-05-21 11:20:56.097 1377286:cmdproc-uio0 [DEBUG_SCSI_CMD] tcmu_cdb_print_info:356 glfs/b06e5481a9074ea7b3cae0b72594b27a: 93 8 0 0 0 0 0 0 0 0 0 3 20 0 0 0 
2024-05-21 11:20:56.097 1377286:cmdproc-uio0 [DEBUG] handle_writesame_check:671 glfs/b06e5481a9074ea7b3cae0b72594b27a: Start lba: 0, number of lba: 204800, last lba: 204799

6、 read the "tcmur_cmd_handler.c" source code when failed is happend , var align is 0 , cause devide 0 error ,

/* If not aligned then falls back to the writesame without unmap */
if (lba % align || nlbas % align) {
   tcmu_dev_dbg(dev,
           "Start lba: %"PRIu64" or nlbas: %"PRIu64" not aligned to %"PRIu32"\n",
           lba, nlbas, align);
   tcmu_dev_dbg(dev, "Falls back to writesame without unmap!\n");
   return TCMU_STS_NOT_HANDLED;

7、 when I test above on rocky8.9 initiator ( iscsi-initiator-utils-6.2.1.4-8.git095f59c.el8_8.x86_64) everything is ok

zlxzfg commented 1 month ago

This is a possible modification, and after applying it, the issue was resolved during testing. https://github.com/open-iscsi/tcmu-runner/pull/701