Re: [PATCH v2 1/4] blk-flush: flush_rq should inherit first_rq's cmd_flags

From: Hannes Reinecke
Date: Mon Jul 31 2023 - 12:29:22 EST


On 7/31/23 08:09, Christoph Hellwig wrote:
On Tue, Jul 25, 2023 at 09:00:59PM +0800, chengming.zhou@xxxxxxxxx wrote:
From: Chengming Zhou <zhouchengming@xxxxxxxxxxxxx>

The cmd_flags in blk_kick_flush() should inherit the original request's
cmd_flags, but the current code looks buggy to me:

Should it? I know the code is kinda trying to do it, but does it really
make sense? Adding Hannes who originally added this inheritance and
discussing the details below:

Yeah, it does.
The flush machinery is sending flushes before and/or after the original request (preflush/postflush). For blocked transports (ie during FC RSCN handling) the transport will error out commands depending on the FAILFAST setting. If FAILFAST is set the SCSI layer gets an STS_TRANSPORT error (causing the I/O to be retried), but STS_ERROR if not set (causing I/O to failed).

So if the FAILFAST setting is _not_ aligned between flush_rq and the original we'll get an error on the flush rq and a retry on the original rq, causing the entire command to fail.

I guess we need to align them.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@xxxxxxx +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman