Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
Lustre 2.17.0
-
3
-
9223372036854775807
Description
smatch highlights that lustre/target/tgt_mount.c::server_ioctl() has this code:
err = obd_get_info(env, lsi->lsi_osd_exp, sizeof(KEY_FID2IDX), KEY_FID2IDX, &len, &u.fid); if (err == 0) { err = -EINVAL; if (u.range.lsr_flags & LU_SEQ_RANGE_MDT) err = u.range.lsr_index;
The problem is
#define LU_SEQ_RANGE_MDT 0x0
so it never hits (introduced in https://review.whamcloud.com/c/fs/lustre-release/+/56339)
Overall these values are definet as if they are the bits in a bitmask, but are never used as such which makes everything super confusing, so probably ripe for some rework?
#define LU_SEQ_RANGE_MDT 0x0 #define LU_SEQ_RANGE_OST 0x1 #define LU_SEQ_RANGE_ANY 0x3 #define LU_SEQ_RANGE_MASK 0x3
For example:
static inline unsigned fld_range_type(const struct lu_seq_range *range) { return range->lsr_flags & LU_SEQ_RANGE_MASK; }
With the saving grace here being that all values are actually then explicitly compared.
soundslike the only user of the _MASK is fld_range_type
And the only user of fld_range_type outside of fld_range_is_xxx is fld_local_lookup.
I wonder what stops us from dropping fld_range_type completely and replace it with just using hte range value directly in all cases?