ext4_datasem_ensure_credits() returns 1 when it successfully restarts the transaction. finish_range() leaves that value in retval when the subsequent ext4_ext_insert_extent() succeeds. Its callers interpret any nonzero return as a migration failure, so they stop building the extent tree and take the cleanup path instead of completing the migration. Before ext4_ext_insert_extent() was changed to return a path, its integer return value overwrote the restart indication. Restore that behavior with PTR_ERR_OR_ZERO(), preserving insertion errors and returning zero on success. Fixes: f7d1331f16a8 ("ext4: get rid of ppath in ext4_ext_insert_extent()") Signed-off-by: Yichong Chen --- fs/ext4/migrate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 5d60ef10fe11..d467b5a13c62 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -53,8 +53,7 @@ static int finish_range(handle_t *handle, struct inode *inode, if (retval < 0) goto err_out; path = ext4_ext_insert_extent(handle, inode, path, &newext, 0); - if (IS_ERR(path)) - retval = PTR_ERR(path); + retval = PTR_ERR_OR_ZERO(path); err_out: up_write((&EXT4_I(inode)->i_data_sem)); ext4_free_ext_path(path); -- 2.51.0