mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
f2fs: report the discard cmd errors properly
In case a discard_cmd is split into several bios, the dc->error must not be overwritten once an error is reported by a bio. Also, move it under dc->lock. Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
141af6ba52
commit
3fa6a8c5b5
1 changed files with 2 additions and 2 deletions
|
@ -1029,9 +1029,9 @@ static void f2fs_submit_discard_endio(struct bio *bio)
|
||||||
struct discard_cmd *dc = (struct discard_cmd *)bio->bi_private;
|
struct discard_cmd *dc = (struct discard_cmd *)bio->bi_private;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
dc->error = blk_status_to_errno(bio->bi_status);
|
|
||||||
|
|
||||||
spin_lock_irqsave(&dc->lock, flags);
|
spin_lock_irqsave(&dc->lock, flags);
|
||||||
|
if (!dc->error)
|
||||||
|
dc->error = blk_status_to_errno(bio->bi_status);
|
||||||
dc->bio_ref--;
|
dc->bio_ref--;
|
||||||
if (!dc->bio_ref && dc->state == D_SUBMIT) {
|
if (!dc->bio_ref && dc->state == D_SUBMIT) {
|
||||||
dc->state = D_DONE;
|
dc->state = D_DONE;
|
||||||
|
|
Loading…
Reference in a new issue