* [PATCH] blkmapd: Skip the SCSI ID if the data length is zero
@ 2015-07-12 23:57 Kinglong Mee
2015-07-13 6:42 ` Christoph Hellwig
0 siblings, 1 reply; 11+ messages in thread
From: Kinglong Mee @ 2015-07-12 23:57 UTC (permalink / raw)
To: Steve Dickson, linux-nfs@vger.kernel.org; +Cc: Christoph Hellwig, kinglongmee
In vmware linux, the iscsi device contains more than one SCSI ID,
and, the second one's data length is zero.
blkmapd must skip it, otherwise, some device will be treat as the above one.
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
utils/blkmapd/device-inq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
index 6b56b67..57fe7a3 100644
--- a/utils/blkmapd/device-inq.c
+++ b/utils/blkmapd/device-inq.c
@@ -198,7 +198,7 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
pos += (dev_id->len + devid_len);
- if ((dev_id->ids & 0xf) < current_id)
+ if ((dev_id->ids & 0xf) < current_id || !dev_id->len)
continue;
switch (dev_id->ids & 0xf) {
/* We process SCSI ID with four ID cases: 0, 1, 2 and 3.
--
2.4.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] blkmapd: Skip the SCSI ID if the data length is zero
2015-07-12 23:57 [PATCH] blkmapd: Skip the SCSI ID if the data length is zero Kinglong Mee
@ 2015-07-13 6:42 ` Christoph Hellwig
2015-07-13 8:24 ` [PATCH v2] blkmapd: Skip the SCSI ID if " Kinglong Mee
0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2015-07-13 6:42 UTC (permalink / raw)
To: Kinglong Mee; +Cc: Steve Dickson, linux-nfs@vger.kernel.org
On Mon, Jul 13, 2015 at 07:57:24AM +0800, Kinglong Mee wrote:
> In vmware linux, the iscsi device contains more than one SCSI ID,
> and, the second one's data length is zero.
>
> blkmapd must skip it, otherwise, some device will be treat as the above one.
>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Looks good, but can you please add a comment explaining why you're
skipping the zero-length EVPD page?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2] blkmapd: Skip the SCSI ID if data length is zero
2015-07-13 6:42 ` Christoph Hellwig
@ 2015-07-13 8:24 ` Kinglong Mee
2015-07-13 9:01 ` Christoph Hellwig
0 siblings, 1 reply; 11+ messages in thread
From: Kinglong Mee @ 2015-07-13 8:24 UTC (permalink / raw)
To: Steve Dickson, linux-nfs@vger.kernel.org; +Cc: Christoph Hellwig, kinglongmee
In vmware linux, the iscsi device contains more than one SCSI ID,
and, the second one's data length is zero.
If there are two iSCSI devices with the second SCSI ID's data length
is zero, the first iSCSI device will record with an invalid SCSI ID
as zero length, the second one will be treat as the first one for
the SCSI ID is zero length too.
It means the only the first iSCSI device is exist in blkmapd's cache,
the request for the second iSCSI device will failed as,
"blkmapd: Could not find disk for device" and,
"bl_resolve_deviceid failed to decode device: 2".
v2, update comments
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
utils/blkmapd/device-inq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
index 6b56b67..57fe7a3 100644
--- a/utils/blkmapd/device-inq.c
+++ b/utils/blkmapd/device-inq.c
@@ -198,7 +198,7 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
pos += (dev_id->len + devid_len);
- if ((dev_id->ids & 0xf) < current_id)
+ if ((dev_id->ids & 0xf) < current_id || !dev_id->len)
continue;
switch (dev_id->ids & 0xf) {
/* We process SCSI ID with four ID cases: 0, 1, 2 and 3.
--
2.4.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2] blkmapd: Skip the SCSI ID if data length is zero
2015-07-13 8:24 ` [PATCH v2] blkmapd: Skip the SCSI ID if " Kinglong Mee
@ 2015-07-13 9:01 ` Christoph Hellwig
2015-07-13 9:11 ` Kinglong Mee
0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2015-07-13 9:01 UTC (permalink / raw)
To: Kinglong Mee; +Cc: Steve Dickson, linux-nfs@vger.kernel.org, Christoph Hellwig
Hi Kinglong,
I meant to describe the rational as a comment in the code, not as
a more verbose commit log.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2] blkmapd: Skip the SCSI ID if data length is zero
2015-07-13 9:01 ` Christoph Hellwig
@ 2015-07-13 9:11 ` Kinglong Mee
2015-07-13 9:59 ` [PATCH v3] " Kinglong Mee
0 siblings, 1 reply; 11+ messages in thread
From: Kinglong Mee @ 2015-07-13 9:11 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Steve Dickson, linux-nfs@vger.kernel.org, kinglongmee
On 7/13/2015 17:01, Christoph Hellwig wrote:
> Hi Kinglong,
>
> I meant to describe the rational as a comment in the code, not as
> a more verbose commit log.
Sorry for my mistake, I will update it later.
Thanks again.
thanks,
Kinglong Mee
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v3] blkmapd: Skip the SCSI ID if data length is zero
2015-07-13 9:11 ` Kinglong Mee
@ 2015-07-13 9:59 ` Kinglong Mee
2015-07-14 7:15 ` Christoph Hellwig
0 siblings, 1 reply; 11+ messages in thread
From: Kinglong Mee @ 2015-07-13 9:59 UTC (permalink / raw)
To: Steve Dickson; +Cc: Christoph Hellwig, linux-nfs@vger.kernel.org, kinglongmee
In vmware linux, the iscsi device contains more than one SCSI ID,
and the second one's data length is zero.
If there are two iSCSI devices with the second SCSI ID's data length
is zero, the first iSCSI device will record with an invalid SCSI ID
as zero length, the second one will be treat as the first one for
the SCSI ID is zero length too.
It means the only the first iSCSI device is exist in blkmapd's cache,
the request for the second iSCSI device will failed as,
"blkmapd: Could not find disk for device" and,
"bl_resolve_deviceid failed to decode device: 2".
v2, update commit log
v3, add a comment in the code
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
utils/blkmapd/device-inq.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
index 6b56b67..60fe2d3 100644
--- a/utils/blkmapd/device-inq.c
+++ b/utils/blkmapd/device-inq.c
@@ -198,6 +198,10 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
pos += (dev_id->len + devid_len);
+ /* Needs an SCSI ID with unique date not zero length */
+ if (!dev_id->len)
+ continue;
+
if ((dev_id->ids & 0xf) < current_id)
continue;
switch (dev_id->ids & 0xf) {
--
2.4.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3] blkmapd: Skip the SCSI ID if data length is zero
2015-07-13 9:59 ` [PATCH v3] " Kinglong Mee
@ 2015-07-14 7:15 ` Christoph Hellwig
2015-07-14 14:11 ` [PATCH v4] " Kinglong Mee
2015-07-14 14:35 ` [PATCH v3] " Steve Dickson
0 siblings, 2 replies; 11+ messages in thread
From: Christoph Hellwig @ 2015-07-14 7:15 UTC (permalink / raw)
To: Kinglong Mee; +Cc: Steve Dickson, Christoph Hellwig, linux-nfs@vger.kernel.org
> + /* Needs an SCSI ID with unique date not zero length */
> + if (!dev_id->len)
> + continue;
That explains what the code does, not why it does so.
How about:
/*
* Some buggy targets (e.g. VMWare) export zero length
* EVPD pages, skip them to not confuse the device id
* cache.
*/
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v4] blkmapd: Skip the SCSI ID if data length is zero
2015-07-14 7:15 ` Christoph Hellwig
@ 2015-07-14 14:11 ` Kinglong Mee
2015-07-14 14:54 ` Steve Dickson
2015-07-14 18:06 ` Steve Dickson
2015-07-14 14:35 ` [PATCH v3] " Steve Dickson
1 sibling, 2 replies; 11+ messages in thread
From: Kinglong Mee @ 2015-07-14 14:11 UTC (permalink / raw)
To: Steve Dickson; +Cc: Christoph Hellwig, linux-nfs@vger.kernel.org, kinglongmee
In vmware linux, the iscsi device contains more than one SCSI ID,
and the second one's data length is zero.
If there are two iSCSI devices with the second SCSI ID's data length
is zero, the first iSCSI device will record with an invalid SCSI ID
as zero length, the second one will be treat as the first one for
the SCSI ID is zero length too.
It means the only the first iSCSI device is exist in blkmapd's cache,
the request for the second iSCSI device will failed as,
"blkmapd: Could not find disk for device" and,
"bl_resolve_deviceid failed to decode device: 2".
v2, update comments
v3, add a comment in the code
v4, update comment as Christoph's suggestion
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
utils/blkmapd/device-inq.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
index 6b56b67..5c258bd 100644
--- a/utils/blkmapd/device-inq.c
+++ b/utils/blkmapd/device-inq.c
@@ -198,6 +198,13 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
pos += (dev_id->len + devid_len);
+ /* Some buggy targets (e.g. VMWare) export zero length
+ * EVPD pages, skip them to not confuse the device id
+ * cache.
+ */
+ if (!dev_id->len)
+ continue;
+
if ((dev_id->ids & 0xf) < current_id)
continue;
switch (dev_id->ids & 0xf) {
--
2.4.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v3] blkmapd: Skip the SCSI ID if data length is zero
2015-07-14 7:15 ` Christoph Hellwig
2015-07-14 14:11 ` [PATCH v4] " Kinglong Mee
@ 2015-07-14 14:35 ` Steve Dickson
1 sibling, 0 replies; 11+ messages in thread
From: Steve Dickson @ 2015-07-14 14:35 UTC (permalink / raw)
To: Christoph Hellwig, Kinglong Mee; +Cc: linux-nfs@vger.kernel.org
On 07/14/2015 03:15 AM, Christoph Hellwig wrote:
>> + /* Needs an SCSI ID with unique date not zero length */
>> + if (!dev_id->len)
>> + continue;
>
> That explains what the code does, not why it does so.
>
> How about:
>
> /*
> * Some buggy targets (e.g. VMWare) export zero length
> * EVPD pages, skip them to not confuse the device id
> * cache.
> */
>
I'm not a big fan of calling out vendors in comments. I'm thinking
dropping the "buggy" and "(e.g. VMWare)" would be appropriated.
steved.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4] blkmapd: Skip the SCSI ID if data length is zero
2015-07-14 14:11 ` [PATCH v4] " Kinglong Mee
@ 2015-07-14 14:54 ` Steve Dickson
2015-07-14 18:06 ` Steve Dickson
1 sibling, 0 replies; 11+ messages in thread
From: Steve Dickson @ 2015-07-14 14:54 UTC (permalink / raw)
To: Kinglong Mee; +Cc: Christoph Hellwig, linux-nfs@vger.kernel.org
Hello,
On 07/14/2015 10:11 AM, Kinglong Mee wrote:
> In vmware linux, the iscsi device contains more than one SCSI ID,
> and the second one's data length is zero.
>
> If there are two iSCSI devices with the second SCSI ID's data length
> is zero, the first iSCSI device will record with an invalid SCSI ID
> as zero length, the second one will be treat as the first one for
> the SCSI ID is zero length too.
>
> It means the only the first iSCSI device is exist in blkmapd's cache,
> the request for the second iSCSI device will failed as,
>
> "blkmapd: Could not find disk for device" and,
> "bl_resolve_deviceid failed to decode device: 2".
>
> v2, update comments
> v3, add a comment in the code
> v4, update comment as Christoph's suggestion
>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
> utils/blkmapd/device-inq.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
> index 6b56b67..5c258bd 100644
> --- a/utils/blkmapd/device-inq.c
> +++ b/utils/blkmapd/device-inq.c
> @@ -198,6 +198,13 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
> dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
> pos += (dev_id->len + devid_len);
>
> + /* Some buggy targets (e.g. VMWare) export zero length
> + * EVPD pages, skip them to not confuse the device id
> + * cache.
> + */
I'll take care of this comment... No need to re-post.
steved.
> + if (!dev_id->len)
> + continue;
> +
> if ((dev_id->ids & 0xf) < current_id)
> continue;
> switch (dev_id->ids & 0xf) {
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v4] blkmapd: Skip the SCSI ID if data length is zero
2015-07-14 14:11 ` [PATCH v4] " Kinglong Mee
2015-07-14 14:54 ` Steve Dickson
@ 2015-07-14 18:06 ` Steve Dickson
1 sibling, 0 replies; 11+ messages in thread
From: Steve Dickson @ 2015-07-14 18:06 UTC (permalink / raw)
To: Kinglong Mee; +Cc: Christoph Hellwig, linux-nfs@vger.kernel.org
On 07/14/2015 10:11 AM, Kinglong Mee wrote:
> In vmware linux, the iscsi device contains more than one SCSI ID,
> and the second one's data length is zero.
>
> If there are two iSCSI devices with the second SCSI ID's data length
> is zero, the first iSCSI device will record with an invalid SCSI ID
> as zero length, the second one will be treat as the first one for
> the SCSI ID is zero length too.
>
> It means the only the first iSCSI device is exist in blkmapd's cache,
> the request for the second iSCSI device will failed as,
>
> "blkmapd: Could not find disk for device" and,
> "bl_resolve_deviceid failed to decode device: 2".
>
> v2, update comments
> v3, add a comment in the code
> v4, update comment as Christoph's suggestion
>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Committed...
steved.
> ---
> utils/blkmapd/device-inq.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/utils/blkmapd/device-inq.c b/utils/blkmapd/device-inq.c
> index 6b56b67..5c258bd 100644
> --- a/utils/blkmapd/device-inq.c
> +++ b/utils/blkmapd/device-inq.c
> @@ -198,6 +198,13 @@ struct bl_serial *bldev_read_serial(int fd, const char *filename)
> dev_id = (struct bl_dev_id *)&(dev_root->data[pos]);
> pos += (dev_id->len + devid_len);
>
> + /* Some buggy targets (e.g. VMWare) export zero length
> + * EVPD pages, skip them to not confuse the device id
> + * cache.
> + */
> + if (!dev_id->len)
> + continue;
> +
> if ((dev_id->ids & 0xf) < current_id)
> continue;
> switch (dev_id->ids & 0xf) {
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2015-07-14 18:06 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-12 23:57 [PATCH] blkmapd: Skip the SCSI ID if the data length is zero Kinglong Mee
2015-07-13 6:42 ` Christoph Hellwig
2015-07-13 8:24 ` [PATCH v2] blkmapd: Skip the SCSI ID if " Kinglong Mee
2015-07-13 9:01 ` Christoph Hellwig
2015-07-13 9:11 ` Kinglong Mee
2015-07-13 9:59 ` [PATCH v3] " Kinglong Mee
2015-07-14 7:15 ` Christoph Hellwig
2015-07-14 14:11 ` [PATCH v4] " Kinglong Mee
2015-07-14 14:54 ` Steve Dickson
2015-07-14 18:06 ` Steve Dickson
2015-07-14 14:35 ` [PATCH v3] " Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox