[LU-6589] llapi_layout_pattern_set() rejects valid pattern values Created: 11/May/15 Updated: 23/Sep/15 Resolved: 23/Sep/15 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.8.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Robert Read (Inactive) | Assignee: | Yang Sheng |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | patch | ||
| Severity: | 3 |
| Rank (Obsolete): | 9223372036854775807 |
| Description |
|
The input validation for this function appears to have a typo. Presumably "&&" was intended instead of "||": if (pattern != LLAPI_LAYOUT_DEFAULT || pattern != LLAPI_LAYOUT_RAID0) { errno = EOPNOTSUPP; return -1; } |
| Comments |
| Comment by Andreas Dilger [ 12/May/15 ] |
|
It isn't clear that this is actually a bug? LLAPI_LAYOUT_DEFAULT means "use the default values", so I can't see it makes sense to specify "use the default" at the same time as specifying something that may not be the default? Also, since LLAPI_LAYOUT_DEFAULT is not a simple bitfield it will also conflict with RAID0? Ned, any comment on this API usage? Robert, were you doing something in particular that failed this check, or merely code review? |
| Comment by Ned Bass [ 12/May/15 ] |
|
I think Robert is right--it will reject any value other than LLAPI_LAYOUT_DEFAULT. I'll whip up a patch. |
| Comment by Gerrit Updater [ 12/May/15 ] |
|
Ned Bass (bass6@llnl.gov) uploaded a new patch: http://review.whamcloud.com/14784 |
| Comment by Peter Jones [ 12/May/15 ] |
|
Yang Sheng Could you please take care of this patch? Thanks Peter |
| Comment by Robert Read (Inactive) [ 12/May/15 ] |
|
This also rejects LLAPI_LAYOUT_DEFAULT, too. I noticed this problem while writing unit tests for my own tool. |
| Comment by Andreas Dilger [ 13/May/15 ] |
|
My bad, didn't read the code correctly... |
| Comment by Robert Read (Inactive) [ 13/May/15 ] |
|
No worries - I had to stare at it for a few minutes to convince myself it actually was as broken as I thought it was. |
| Comment by Gerrit Updater [ 22/Sep/15 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/14784/ |
| Comment by Peter Jones [ 23/Sep/15 ] |
|
Landed for 2.8 |