Commit 5c75e1b8 authored by Ming Lei's avatar Ming Lei Committed by Yongqiang Liu
Browse files

fs: move guard_bio_eod() after bio_set_op_attrs

mainline inclusion
from mainline-v5.5-rc6
commit 83c9c547
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6GTUI
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=83c9c547168e8b914ea6398430473a4de68c52cc



--------------------------------

Commit 85a8ce62 ("block: add bio_truncate to fix guard_bio_eod")
adds bio_truncate() for handling bio EOD. However, bio_truncate()
doesn't use the passed 'op' parameter from guard_bio_eod's callers.

So bio_trunacate() may retrieve wrong 'op', and zering pages may
not be done for READ bio.

Fixes this issue by moving guard_bio_eod() after bio_set_op_attrs()
in submit_bh_wbc() so that bio_truncate() can always retrieve correct
op info.

Meantime remove the 'op' parameter from guard_bio_eod() because it isn't
used any more.

Cc: Carlos Maiolino <cmaiolino@redhat.com>
Cc: linux-fsdevel@vger.kernel.org
Fixes: 85a8ce62 ("block: add bio_truncate to fix guard_bio_eod")
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>

Fold in kerneldoc and bio_op() change.

Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>

Conflicts:
 fs/buffer.c
 fs/internal.h
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
parent 578a75ce
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment