From: Alexey Lyashkov Date: Mon, 22 Nov 2021 13:32:23 +0000 (+0300) Subject: LU-15262 osd: bio_integrity_prep_fn return value processing X-Git-Tag: 2.14.57~111 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=41c813d14ec9b353f9cf5ac82638996dcb5273d7;p=fs%2Flustre-release.git LU-15262 osd: bio_integrity_prep_fn return value processing There is osd_bio_integrity_handle() fn in lustre/osd-ldiskfs/osd_io.c It checks the returned code of bio_integrity_prep_fn() but between mainstream Linux 4.12 and 4.13 kernel integrity API has changed and in 4.13+ (as well as for any RHEL8 including first beta) bio_integrity_prep() returns boolean true on success. HPe-bug-id: LUS-10443 Signed-off-by: Alexey Lyashkov Change-Id: I973aa8ccae024157ad863d26afc7b1264a5c7149 Reviewed-on: https://review.whamcloud.com/45646 Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko Reviewed-by: Li Dongyang Reviewed-by: Andrew Perepechko Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index daece66..a36ff43 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1353,6 +1353,28 @@ bio_integrity_prep_fn, [ ]) ]) # LC_BIO_INTEGRITY_PREP_FN +# LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL +# +# 13 kernel integrity API has changed and in 4.13+ +# (as well as in rhel 8.4) bio_integrity_prep() returns boolean true +# on success. +# +AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [ +LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' returns bool], +bio_integrity_prep, [ + #include + #include +],[ + #pragma GCC diagnostic warning "-Werror" + typedef bool (*bio_integrity_prep_type)(struct bio *bio) ; + + typecheck_fn(bio_integrity_prep_type, bio_integrity_prep); +],[ + AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL, 1, + [bio_integrity_prep_fn returns bool]) +]) +]) # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL + # # LC_HAVE_BI_OPF # @@ -2583,6 +2605,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.13 LC_BIO_INTEGRITY_ENABLED + LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL LC_HAVE_GET_INODE_USAGE # 4.14 diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 705d8b0..0c67dc4 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -1627,11 +1627,18 @@ static inline int osd_get_integrity_profile(struct osd_device *osd, return 0; } -static inline bool bio_integrity_prep_fn(struct bio *bio, +static inline int bio_integrity_prep_fn(struct bio *bio, integrity_gen_fn *generate_fn, integrity_vrfy_fn *verify_fn) { +#ifdef HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL + if (bio_integrity_prep(bio)) + return 0; + else + return -EIO; +#else return bio_integrity_prep(bio); +#endif } #endif