[LU-888] lctl get_param easily confused Created: 02/Dec/11 Updated: 04/Jan/12 Resolved: 04/Jan/12 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.1.0, Lustre 1.8.6 |
| Fix Version/s: | Lustre 2.2.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Richard Henwood (Inactive) | Assignee: | Richard Henwood (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Severity: | 3 |
| Rank (Obsolete): | 4782 |
| Description |
|
If lctl get_param <param> has a file named <param> in the current working directory, it returns that instead of the expected values. To reproduce: # /usr/lib64/lustre/tests/llmount.sh
# cd /tmp
# lctl get_param version
version=
lustre: 2.1.51
kernel: patchless_client
build: 2.1.51-ga83a510-CHANGED-2.6.32-131.6.1.el6_lustre.g65156ed.x86_64
# echo "All your Lustre are belong to us" > ./version
# lctl get_param version
=
All your Lustre are belong to us
#
|
| Comments |
| Comment by Richard Henwood (Inactive) [ 02/Dec/11 ] |
|
The code appears to first check if a file called <param> is present and can open 0_RDONLY. If a file is not present, the code falls back to look for /proc/{fs,sys}/{lnet,lustre}/<param>. I suggest to fix the issue of get_param being easily confused, the path /proc/{fs,sys}/{lnet,lustre}/<param> should be checked first. |
| Comment by Richard Henwood (Inactive) [ 02/Dec/11 ] |
|
John identified a more sinister potential issue with the behavior of get_param. One can unwittingly corrupt a local file if it has the same name as the <param>: # lctl set_param version="All your Nyancat'"
# lctl get_param version
=
All your Nyancat're belong to us
A better fix for this perilous behavior is to not have lctl {get|set}_param lookup the local path at all. |
| Comment by Andreas Dilger [ 02/Dec/11 ] |
|
Good catch. If anyone is going to do more than trivial changes to get_param, it would be good to move it into an llapi_get_param() helper that can be used in other parts of the code. In quite a number of places in lctl, lfs, mount.lustre, erx. |
| Comment by Richard Henwood (Inactive) [ 02/Dec/11 ] |
|
Trivial |
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|
| Comment by Richard Henwood (Inactive) [ 04/Jan/12 ] |
|
I believe this is still an open issue with 1.8.x |
| Comment by Build Master (Inactive) [ 04/Jan/12 ] |
|
Integrated in _param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9) Result = SUCCESS
|