From 592b35662934ca4fc9227ed8cf31c5edc7407f8a Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Mon, 17 Jun 2024 10:24:29 -0700 Subject: [PATCH] LU-17941 ofd: do not copy over filter_fid structure When a bigger filter_fid has been writen on disk by newer server, downgraded Lustre would read more data but we need store less to fit smaller filter_fid structure. Lustre-change: https://review.whamcloud.com/55408 Lustre-commit: TBD (from 587b178e9330fcdf58bdd3c093e72594a08a611a) Fixes: 28c366cee6d ("LU-17218 ofd: improve filter_fid upgrade compatibility") Signed-off-by: Bobi Jam Change-Id: Idb5c8fffe4af22f35b64aa93e7efce7f9dd206d6 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/55458 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger --- lustre/ofd/ofd_objects.c | 2 +- lustre/osd-ldiskfs/osd_io.c | 3 ++- lustre/osd-zfs/osd_io.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/ofd/ofd_objects.c b/lustre/ofd/ofd_objects.c index 79d05e9..b80bef2 100644 --- a/lustre/ofd/ofd_objects.c +++ b/lustre/ofd/ofd_objects.c @@ -168,7 +168,7 @@ int ofd_object_ff_load(const struct lu_env *env, struct ofd_object *fo) return -EINVAL; } - filter_fid_le_to_cpu(ff, ff, rc); + filter_fid_le_to_cpu(ff, ff, sizeof(*ff)); return 0; } diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index d5c5fcf..7c1bc22 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -2830,7 +2830,8 @@ static loff_t osd_lseek(const struct lu_env *env, struct dt_object *dt, OBD_FREE(ff_new, sizeof(*ff_new) + FILTER_FID_EXTRA_SIZE); } if (rc > 0) { - filter_fid_le_to_cpu(&oti->oti_ff, &oti->oti_ff, rc); + filter_fid_le_to_cpu(&oti->oti_ff, &oti->oti_ff, + sizeof(oti->oti_ff)); if (oti->oti_ff.ff_layout_compr.ol_compr_type != LL_COMPR_TYPE_NONE) RETURN(-EOPNOTSUPP); diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index bdf6a60..450f6c4 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -1227,7 +1227,7 @@ static loff_t osd_lseek(const struct lu_env *env, struct dt_object *dt, OBD_FREE(ff_new, sizeof(*ff_new) + FILTER_FID_EXTRA_SIZE); } if (rc > 0) { - filter_fid_le_to_cpu(&ff, &ff, rc); + filter_fid_le_to_cpu(&ff, &ff, sizeof(ff)); if (ff.ff_layout_compr.ol_compr_type != LL_COMPR_TYPE_NONE) RETURN(-EOPNOTSUPP); } -- 1.8.3.1