From 77f11cda573ff7001317c1ca87bffad992d66e25 Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Thu, 8 Aug 2019 18:46:06 +0300 Subject: [PATCH] LU-12462 osc: layout and chunkbits alignment mismatch In the discard case, the OSC fsync/writeback code asserts that each OSC extent is fully covered by the fsync request. It may happen that a start(or an end) of a component does not match the first (the last) osc object extent start (end), which is aligned by the cl_chunkbits which depends on the OST block size. The requirement for the component alignment is LOV_MIN_STRIPE_SIZE which is 64K, the ZFS block size could be in MBs. Use an aligned by chunk size the fsync reqion in the assertion. Fixes: 092ecd6612 ("LU-12462 osc: Do not assert for first extent") Lustre-change: https://review.whamcloud.com/35733 Lustre-commit: 7a9f7dec700c5c553396475daad272475f1b20be Signed-off-by: Vitaly Fertman Change-Id: I2ff47fc87c838239142ffc63bebafce3e9403f4e Cray-bug-id: LUS-7498 Reviewed-by: Mike Pershin Reviewed-by: Patrick Farrell Signed-off-by: Minh Diep Reviewed-on: https://review.whamcloud.com/36877 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osc/osc_cache.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 7cf8934..607c2ee 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -3056,17 +3056,25 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, list_move_tail(&ext->oe_link, list); unplug = true; } else { + struct client_obd *cli = osc_cli(obj); + int pcc_bits = cli->cl_chunkbits - PAGE_SHIFT; + pgoff_t align_by = (1 << pcc_bits); + pgoff_t a_start = round_down(start, align_by); + pgoff_t a_end = round_up(end, align_by); + + /* overflow case */ + if (end && !a_end) + a_end = CL_PAGE_EOF; /* the only discarder is lock cancelling, so - * [start, end] must contain this extent. - * However, with DOM, osc extent alignment may - * cause the first extent to start before the - * OST portion of the layout. This is never - * accessed for i/o, but the unused portion - * will not be covered by the sync request, - * so we cannot assert in that case. */ - EASSERT(ergo(!(ext == first_extent(obj)), - ext->oe_start >= start && - ext->oe_end <= end), ext); + * [start, end], aligned by chunk size, must + * contain this extent */ + LASSERTF(ext->oe_start >= a_start && + ext->oe_end <= a_end, + "ext [%lu, %lu] reg [%lu, %lu] " + "orig [%lu %lu] align %lu bits " + "%d\n", ext->oe_start, ext->oe_end, + a_start, a_end, start, end, + align_by, pcc_bits); osc_extent_state_set(ext, OES_LOCKING); ext->oe_owner = current; list_move_tail(&ext->oe_link, -- 1.8.3.1