From: Jens Axboe <axboe@kernel.dk>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Resend: [PATCH] blkdev: fix blkdev_issue_zeroout return value
Date: Fri, 06 Aug 2010 13:24:05 +0200 [thread overview]
Message-ID: <4C5BF0D5.1080505@kernel.dk> (raw)
In-Reply-To: <87mxt02dr5.fsf@dmon-lap.sw.ru>
On 2010-08-06 13:15, Dmitry Monakhov wrote:
> Jens Axboe <axboe@kernel.dk> writes:
>
>> On 2010-08-06 12:42, Dmitry Monakhov wrote:
>>> Hi Jens,
>>> Seems that my first mail was missed somewhere.
>>> I've found couple of trivial issues in blkdev_issue_zeroout()
>>> implementation. Unfortunately I've miss during initial testing phase
>>> because always called it with BARRIER|WAIT flags.
>>
>> BTW, this:
>>
>> @@ -218,15 +222,18 @@ submit:
>> /* One of bios in the batch was completed with error.*/
>> ret = -EIO;
>>
>> - if (ret)
>> + if (ret && ret != -ENOMEM)
>> goto out;
>>
>> if (test_bit(BIO_EOPNOTSUPP, &bb.flags)) {
>> ret = -EOPNOTSUPP;
>> goto out;
>> }
>> - if (nr_sects != 0)
>> + if (nr_sects != 0) {
>> + if (ret == -ENOMEM)
>> + io_schedule();
>> goto submit;
>> + }
>> out:
>> return ret;
>> }
>>
>> is broken. Either the caller sets __GFP_WAIT and then bio_alloc() will
>> not fail, or GFP_ATOMIC is used knowing that the call can fail and
>> return ENOMEM. Don't code in retry logic like this.
> Ok, my fault and in fact i've done in explicitly. I just thought
> that blk-layer is some times an exception from general GFP_ATOMIC rule
> because in some places in blk-layer we stick to GFP_NOFAIL semantics
> regardless to actual gfp flags.
>
> New version attached.
Thanks that looks better, now really added.
--
Jens Axboe
prev parent reply other threads:[~2010-08-06 11:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 10:42 Resend: [PATCH] blkdev: fix blkdev_issue_zeroout return value Dmitry Monakhov
2010-08-06 10:51 ` Jens Axboe
2010-08-06 10:56 ` Jens Axboe
2010-08-06 11:15 ` Dmitry Monakhov
2010-08-06 11:24 ` Jens Axboe [this message]
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=4C5BF0D5.1080505@kernel.dk \
--to=axboe@kernel.dk \
--cc=dmonakhov@openvz.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox