All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Mike Snitzer <snitzer@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	Brian King <brking@us.ibm.com>,
	linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	mark.bergman@uphs.upenn.edu
Subject: Re: block: don't check request size in blk_cloned_rq_check_limits()
Date: Sat, 11 Jun 2016 15:10:06 +0200	[thread overview]
Message-ID: <575C0DAE.7070502@suse.de> (raw)
In-Reply-To: <yq11t44f0hi.fsf@sermon.lab.mkp.net>

On 06/11/2016 01:06 PM, Martin K. Petersen wrote:
>>>>>> "Hannes" == Hannes Reinecke <hare@suse.de> writes:
>
> Hannes> Because we're checking the wrong limit.
>
> The original code checked that the request was smaller than both
> max_sectors and max_hw_sectors so it would have failed here as well.
>
> Hannes> blk_queue_get_max_sectors() is checking limits.max_sectors(),
> Hannes> but the requests are already fully formed and can extend up to
> Hannes> limits.max_hw_sectors().
>
> We should not be issuing REQ_TYPE_FS requests larger than max_sectors.
> How did we get here?
>
Well, the primary issue is that 'blk_cloned_rq_check_limits()' doesn't 
check for BLOCK_PC, so this particular check would be applied for every 
request.

But as it turns out, even adding a check for BLOCK_PC doesn't help, so 
we're indeed seeing REQ_TYPE_FS requests with larger max_sector counts.

As to _why_ this happens I frankly have no idea. I have been staring at 
this particular code for over a year now (I've got another bug pending 
where we hit the _other_ if clause), but to no avail.
So I've resolved to drop the check altogether, seeing that max_sector 
size is _not_ something which gets changed during failover.
Therefore if the max_sector count is wrong for the cloned request it was 
already wrong for the original request, and we should've errored it out 
far earlier.
The max_segments count, OTOH, _might_ change during failover (different 
hardware has different max_segments setting, and this is being changed 
during sg mapping), so there is some value to be had from testing it here.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: J. Hawn, J. Guild, F. Imend�rffer, HRB 16746 (AG N�rnberg)

WARNING: multiple messages have this Message-ID (diff)
From: Hannes Reinecke <hare@suse.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Mike Snitzer <snitzer@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	Brian King <brking@us.ibm.com>,
	linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
	mark.bergman@uphs.upenn.edu
Subject: Re: block: don't check request size in blk_cloned_rq_check_limits()
Date: Sat, 11 Jun 2016 15:10:06 +0200	[thread overview]
Message-ID: <575C0DAE.7070502@suse.de> (raw)
In-Reply-To: <yq11t44f0hi.fsf@sermon.lab.mkp.net>

On 06/11/2016 01:06 PM, Martin K. Petersen wrote:
>>>>>> "Hannes" == Hannes Reinecke <hare@suse.de> writes:
>
> Hannes> Because we're checking the wrong limit.
>
> The original code checked that the request was smaller than both
> max_sectors and max_hw_sectors so it would have failed here as well.
>
> Hannes> blk_queue_get_max_sectors() is checking limits.max_sectors(),
> Hannes> but the requests are already fully formed and can extend up to
> Hannes> limits.max_hw_sectors().
>
> We should not be issuing REQ_TYPE_FS requests larger than max_sectors.
> How did we get here?
>
Well, the primary issue is that 'blk_cloned_rq_check_limits()' doesn't 
check for BLOCK_PC, so this particular check would be applied for every 
request.

But as it turns out, even adding a check for BLOCK_PC doesn't help, so 
we're indeed seeing REQ_TYPE_FS requests with larger max_sector counts.

As to _why_ this happens I frankly have no idea. I have been staring at 
this particular code for over a year now (I've got another bug pending 
where we hit the _other_ if clause), but to no avail.
So I've resolved to drop the check altogether, seeing that max_sector 
size is _not_ something which gets changed during failover.
Therefore if the max_sector count is wrong for the cloned request it was 
already wrong for the original request, and we should've errored it out 
far earlier.
The max_segments count, OTOH, _might_ change during failover (different 
hardware has different max_segments setting, and this is being changed 
during sg mapping), so there is some value to be had from testing it here.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-06-11 13:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  7:24 [PATCH] block: don't check request size in blk_cloned_rq_check_limits() Hannes Reinecke
2016-06-10 13:19 ` Mike Snitzer
2016-06-10 13:30   ` Hannes Reinecke
2016-06-10 13:30     ` Hannes Reinecke
2016-06-10 14:18     ` Mike Snitzer
2016-06-11 10:05       ` Hannes Reinecke
2016-06-11 10:05         ` Hannes Reinecke
2016-06-11  2:22   ` Martin K. Petersen
2016-06-11 10:01     ` Hannes Reinecke
2016-06-11 10:01       ` Hannes Reinecke
2016-06-11 11:06       ` Martin K. Petersen
2016-06-11 13:10         ` Hannes Reinecke [this message]
2016-06-11 13:10           ` Hannes Reinecke
2016-06-13  8:07           ` Christoph Hellwig
2016-06-15  1:39           ` Martin K. Petersen
2016-06-15  2:29             ` Mike Snitzer
2016-06-15  2:32               ` Martin K. Petersen
2016-06-15  6:33             ` Hannes Reinecke
2016-06-15  6:33               ` Hannes Reinecke
2016-06-15 10:03               ` Jens Axboe
2016-06-15 10:33                 ` Hannes Reinecke
2016-06-15 10:33                   ` Hannes Reinecke
2016-06-15 16:34                   ` Brian King
2016-06-16 12:35                     ` Mauricio Faria de Oliveira
2016-06-16 21:59                       ` Mauricio Faria de Oliveira
2016-06-17  6:59                         ` Hannes Reinecke
2016-06-17  6:59                           ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=575C0DAE.7070502@suse.de \
    --to=hare@suse.de \
    --cc=axboe@kernel.dk \
    --cc=brking@us.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mark.bergman@uphs.upenn.edu \
    --cc=martin.petersen@oracle.com \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.