From 63148d426e32946e1e2fc415b200047690a45761 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 23 Apr 2021 10:39:34 -0700 Subject: [PATCH] Fix accidental EINVAL in move_blocks When move blocks is staging it requires an overlapping offline extent to cover the entire region to move. It performs the stage by modifying extents at a time. If there are fragmented source extents it will modify each of them at a time in the region. When looking for the extent to match the source extent it looked from the iblock of the start of the whole operation, not the start of the source extent it's matching. This meant that it would find a the first previous online extent it just modified, which wouldn't be online, and would return -EINVAL. The fix is to have it search from the logical start of the extent it's trying to match, not the start of the region. Signed-off-by: Zach Brown --- kmod/src/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmod/src/data.c b/kmod/src/data.c index 7a1d8585..caf26657 100644 --- a/kmod/src/data.c +++ b/kmod/src/data.c @@ -1285,7 +1285,7 @@ int scoutfs_data_move_blocks(struct inode *from, u64 from_off, if (is_stage) { ret = scoutfs_ext_next(sb, &data_ext_ops, &to_args, - to_iblock, 1, &off_ext); + to_start, 1, &off_ext); if (ret) break;