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:
Родитель
141af6ba52
Коммит
3fa6a8c5b5
|
@ -1029,9 +1029,9 @@ static void f2fs_submit_discard_endio(struct bio *bio)
|
|||
struct discard_cmd *dc = (struct discard_cmd *)bio->bi_private;
|
||||
unsigned long flags;
|
||||
|
||||
dc->error = blk_status_to_errno(bio->bi_status);
|
||||
|
||||
spin_lock_irqsave(&dc->lock, flags);
|
||||
if (!dc->error)
|
||||
dc->error = blk_status_to_errno(bio->bi_status);
|
||||
dc->bio_ref--;
|
||||
if (!dc->bio_ref && dc->state == D_SUBMIT) {
|
||||
dc->state = D_DONE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче