Details
-
Technical task
-
Resolution: Fixed
-
Critical
-
None
-
12114
Description
It looks like the implementation of ostid_id() will return an incorrect OID value if passed an IDIF FID. The problem is that ostid_seq() will return FID_SEQ_OST_MDT0 for IDIF FIDs, which helps in the osd layer to map the IDIF SEQ to the O/0/ directory. However, this confuses ostid_id() into thinking that "oi.oi_id" is holding the OID value for the IDIF FID due to fid_seq_is_mdt0(ostid_seq()) returning true, when in fact it should continue down to the fid_seq_is_idif() case.
/* extract OST sequence (group) from a wire ost_id (id/seq) pair */ static inline obd_seq ostid_seq(const struct ost_id *ostid) { if (fid_seq_is_mdt0(ostid->oi.oi_seq)) return FID_SEQ_OST_MDT0; if (fid_seq_is_default(ostid->oi.oi_seq)) return FID_SEQ_LOV_DEFAULT; if (fid_is_idif(&ostid->oi_fid)) return FID_SEQ_OST_MDT0; return fid_seq(&ostid->oi_fid); } /* extract OST objid from a wire ost_id (id/seq) pair */ static inline obd_id ostid_id(const struct ost_id *ostid) { if (fid_seq_is_mdt0(ostid->oi.oi_seq)) <<< always true for IDIF return ostid->oi.oi_id & IDIF_OID_MASK; if (fid_is_idif(&ostid->oi_fid)) <<< IDIF never gets to here return fid_idif_id(fid_seq(&ostid->oi_fid), fid_oid(&ostid->oi_fid), 0); return fid_oid(&ostid->oi_fid); }
diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 8b835a5..72b8380 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -646,7 +646,7 @@ static inline obd_seq ostid_seq(const struct ost_id *ostid) /* extract OST objid from a wire ost_id (id/seq) pair */ static inline obd_id ostid_id(const struct ost_id *ostid) { - if (fid_seq_is_mdt0(ostid_seq(ostid))) + if (fid_seq_is_mdt0(ostid->oi.oi_seq)) return ostid->oi.oi_id & IDIF_OID_MASK; if (fid_is_idif(&ostid->oi_fid))
I'm not sure if this will cause problems for DNE, but it will definitely cause problems if clients ever send IDIF FIDs, or if ostid is converted to IDIF at the OST level.
Attachments
Issue Links
- is related to
-
LU-3569 Use real OST index as ostid_to_fid() parameter instead of always "0"
- Resolved