From 44215c2f7dfc8387e7dae742f20cfc5e156579ea Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 11 May 2023 12:19:27 -0400 Subject: [PATCH] tools/cephfs/first-damage: always use bytes representation of omap key We cannot assume the encoding of a file name and we don't need it. Fixes: https://tracker.ceph.com/issues/59716 Signed-off-by: Patrick Donnelly (cherry picked from commit 56219bea697519ec96d7eed230c88648bf005cff) --- src/tools/cephfs/first-damage.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/cephfs/first-damage.py b/src/tools/cephfs/first-damage.py index b7660f590f0..0479dc8cb2a 100644 --- a/src/tools/cephfs/first-damage.py +++ b/src/tools/cephfs/first-damage.py @@ -78,15 +78,15 @@ def traverse(MEMO, ioctx): with rados.ReadOpCtx() as rctx: nkey = None while True: - it = ioctx.get_omap_vals(rctx, nkey, None, 100)[0] + it = ioctx.get_omap_vals(rctx, nkey, None, 100, omap_key_type=bytes)[0] ioctx.operate_read_op(rctx, o.key) nkey = None for (dnk, val) in it: - log.debug('\t%s: val size %d', dnk, len(val)) + log.debug(f'\t{dnk}: val size {len(val)}') (first,) = struct.unpack(' NEXT_SNAP: log.warning(f"found {o.key}:{dnk} first (0x{first:x}) > NEXT_SNAP (0x{NEXT_SNAP:x})") - if REPAIR_NOSNAP and dnk.endswith("_head") and first == CEPH_NOSNAP: + if REPAIR_NOSNAP and dnk.endswith(b"_head") and first == CEPH_NOSNAP: log.warning(f"repairing first==CEPH_NOSNAP damage, setting to NEXT_SNAP (0x{NEXT_SNAP:x})") first = NEXT_SNAP nval = bytearray(val) -- 2.39.5