]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.110/scsi-zfcp-fix-rport-unblock-if-deleted-scsi-devices-on-scsi_host.patch
Linux 4.14.110
[thirdparty/kernel/stable-queue.git] / releases / 4.14.110 / scsi-zfcp-fix-rport-unblock-if-deleted-scsi-devices-on-scsi_host.patch
1 From fe67888fc007a76b81e37da23ce5bd8fb95890b0 Mon Sep 17 00:00:00 2001
2 From: Steffen Maier <maier@linux.ibm.com>
3 Date: Tue, 26 Mar 2019 14:36:58 +0100
4 Subject: scsi: zfcp: fix rport unblock if deleted SCSI devices on Scsi_Host
5
6 From: Steffen Maier <maier@linux.ibm.com>
7
8 commit fe67888fc007a76b81e37da23ce5bd8fb95890b0 upstream.
9
10 An already deleted SCSI device can exist on the Scsi_Host and remain there
11 because something still holds a reference. A new SCSI device with the same
12 H:C:T:L and FCP device, target port WWPN, and FCP LUN can be created. When
13 we try to unblock an rport, we still find the deleted SCSI device and
14 return early because the zfcp_scsi_dev of that SCSI device is not
15 ZFCP_STATUS_COMMON_UNBLOCKED. Hence we miss to unblock the rport, even if
16 the new proper SCSI device would be in good state.
17
18 Therefore, skip deleted SCSI devices when iterating the sdevs of the shost.
19 [cf. __scsi_device_lookup{_by_target}() or scsi_device_get()]
20
21 The following abbreviated trace sequence can indicate such problem:
22
23 Area : REC
24 Tag : ersfs_3
25 LUN : 0x4045400300000000
26 WWPN : 0x50050763031bd327
27 LUN status : 0x40000000 not ZFCP_STATUS_COMMON_UNBLOCKED
28 Ready count : n not incremented yet
29 Running count : 0x00000000
30 ERP want : 0x01
31 ERP need : 0xc1 ZFCP_ERP_ACTION_NONE
32
33 Area : REC
34 Tag : ersfs_3
35 LUN : 0x4045400300000000
36 WWPN : 0x50050763031bd327
37 LUN status : 0x41000000
38 Ready count : n+1
39 Running count : 0x00000000
40 ERP want : 0x01
41 ERP need : 0x01
42
43 ...
44
45 Area : REC
46 Level : 4 only with increased trace level
47 Tag : ertru_l
48 LUN : 0x4045400300000000
49 WWPN : 0x50050763031bd327
50 LUN status : 0x40000000
51 Request ID : 0x0000000000000000
52 ERP status : 0x01800000
53 ERP step : 0x1000
54 ERP action : 0x01
55 ERP count : 0x00
56
57 NOT followed by a trace record with tag "scpaddy"
58 for WWPN 0x50050763031bd327.
59
60 Signed-off-by: Steffen Maier <maier@linux.ibm.com>
61 Fixes: 6f2ce1c6af37 ("scsi: zfcp: fix rport unblock race with LUN recovery")
62 Cc: <stable@vger.kernel.org> #2.6.32+
63 Reviewed-by: Jens Remus <jremus@linux.ibm.com>
64 Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
65 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
66 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
67
68 ---
69 drivers/s390/scsi/zfcp_erp.c | 3 +++
70 1 file changed, 3 insertions(+)
71
72 --- a/drivers/s390/scsi/zfcp_erp.c
73 +++ b/drivers/s390/scsi/zfcp_erp.c
74 @@ -1306,6 +1306,9 @@ static void zfcp_erp_try_rport_unblock(s
75 struct zfcp_scsi_dev *zsdev = sdev_to_zfcp(sdev);
76 int lun_status;
77
78 + if (sdev->sdev_state == SDEV_DEL ||
79 + sdev->sdev_state == SDEV_CANCEL)
80 + continue;
81 if (zsdev->port != port)
82 continue;
83 /* LUN under port of interest */