Details
-
Bug
-
Resolution: Fixed
-
Blocker
-
Lustre 2.4.0, Lustre 2.5.0
-
None
-
clang 3.4
-
3
-
10815
Description
While porting lustre to macos i found a some strange behavior - likely wrong type used for variable.
osc_request.c:2503:41: error: implicit conversion from 'unsigned long long' to 'int' changes value from 2199023255552 to 0 [-Werror,-Wconstant-conversion] int match_lvb = (agl != 0 ? 0 : LDLM_FL_LVB_READY); ~~~~~~~~~ ^~~~~~~~~~~~~~~~~ /Users/shadow/work/lustre/work/WC-review/mac-os/lustre/include/lustre_dlm_flags.h:244:41: note: expanded from macro 'LDLM_FL_LVB_READY' #define LDLM_FL_LVB_READY 0x0000020000000000ULL // bit 41
so if we assign 64bit data to 32bit variable - we will be have zero always and that logic newer work.
stop talking about blockers. we need proper patch at first place and don't need rewrite a single fix for different branches it's add many problems with supporting that code.
current patch don't fix all similar issues in future and fix just one instance. if we have lost one point in code review where 32bit -> 64bit conversion is lost - you really think we don't have similar bugs in different places? because you review a code? but as you see review isn't guaranteed to kill all bugs.
changes define to enum and use correct type for a ldlm flags avoid bugs at all, because introduce are compile time checking and allocating a property type for all variables and that is provide better code and more optimization for compiler if need.