On Wed 19-04-17 10:21:39, Goldwyn Rodrigues wrote:
> 
> 
> On 04/19/2017 01:45 AM, Christoph Hellwig wrote:
> > 
> >> +  if (bio->bi_opf & REQ_NOWAIT) {
> >> +          if (!blk_queue_nowait(q)) {
> >> +                  err = -EOPNOTSUPP;
> >> +                  goto end_io;
> >> +          }
> >> +          if (!(bio->bi_opf & REQ_SYNC)) {
> > 
> > I don't understand this check at all..
> 
> It is to ensure at the block layer that NOWAIT comes only for DIRECT
> calls only. I should probably change it to REQ_SYNC | REQ_IDLE.

Ouch. Checking 'REQ_SYNC' for this is

a) unreliable hack
b) layering violation

You just don't care why someone marked bio with REQ_NOWAIT at this place.
Just obey the request if you can, return error if you cannot, but advisory
REQ_SYNC or REQ_IDLE flags have nothing to do with the ability of the block
layer to submit the bio without blocking...

                                                                Honza
-- 
Jan Kara <[email protected]>
SUSE Labs, CR

Reply via email to