Re: [PATCH v2] blk-mq: fix a hung issue when set device state to blocked and restore running

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi zhengbin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.1-rc1 next-20190321]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/zhengbin/blk-mq-fix-a-hung-issue-when-set-device-state-to-blocked-and-restore-running/20190321-180603
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-x012-201911 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/scsi/scsi_sysfs.c: In function 'store_state_field':
>> drivers/scsi/scsi_sysfs.c:773:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     enum scsi_device_state oldstate = sdev->sdev_state;
     ^~~~

vim +773 drivers/scsi/scsi_sysfs.c

   752	
   753	static ssize_t
   754	store_state_field(struct device *dev, struct device_attribute *attr,
   755			  const char *buf, size_t count)
   756	{
   757		int i, ret;
   758		struct scsi_device *sdev = to_scsi_device(dev);
   759		enum scsi_device_state state = 0;
   760	
   761		for (i = 0; i < ARRAY_SIZE(sdev_states); i++) {
   762			const int len = strlen(sdev_states[i].name);
   763			if (strncmp(sdev_states[i].name, buf, len) == 0 &&
   764			   buf[len] == '\n') {
   765				state = sdev_states[i].value;
   766				break;
   767			}
   768		}
   769		if (!state)
   770			return -EINVAL;
   771	
   772		mutex_lock(&sdev->state_mutex);
 > 773		enum scsi_device_state oldstate = sdev->sdev_state;
   774		ret = scsi_device_set_state(sdev, state);
   775		if (ret == 0) {
   776			/* If device use blk-mq, the device state changes from
   777			 * SDEV_BLOCK to SDEV_RUNNING, we need to run hw queue
   778			 * to avoid io hung.
   779			 */
   780			if ((state == SDEV_RUNNING) && (oldstate == SDEV_BLOCK)) {
   781				struct request_queue *q = sdev->request_queue;
   782	
   783				if (q->mq_ops)
   784					blk_mq_run_hw_queues(q, true);
   785			}
   786		}
   787		mutex_unlock(&sdev->state_mutex);
   788	
   789		return ret == 0 ? count : -EINVAL;
   790	}
   791	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux