[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 change available for review at:

http://review.whamcloud.com/#change,1765

Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,server,el5,ofa #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/doc/lctl.8
  • lustre/utils/lustre_cfg.c
  • lustre/tests/sanity.sh
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,client,el6,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/tests/sanity.sh
  • lustre/utils/lustre_cfg.c
  • lustre/doc/lctl.8
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,client,el5,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/utils/lustre_cfg.c
  • lustre/tests/sanity.sh
  • lustre/doc/lctl.8
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,client,sles11,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/utils/lustre_cfg.c
  • lustre/tests/sanity.sh
  • lustre/doc/lctl.8
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » i686,server,el6,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/utils/lustre_cfg.c
  • lustre/doc/lctl.8
  • lustre/tests/sanity.sh
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,client,ubuntu1004,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/tests/sanity.sh
  • lustre/utils/lustre_cfg.c
  • lustre/doc/lctl.8
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,client,el5,ofa #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/utils/lustre_cfg.c
  • lustre/tests/sanity.sh
  • lustre/doc/lctl.8
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,server,el5,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/doc/lctl.8
  • lustre/tests/sanity.sh
  • lustre/utils/lustre_cfg.c
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » x86_64,server,el6,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/tests/sanity.sh
  • lustre/doc/lctl.8
  • lustre/utils/lustre_cfg.c
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » i686,client,el6,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/tests/sanity.sh
  • lustre/utils/lustre_cfg.c
  • lustre/doc/lctl.8
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » i686,server,el5,ofa #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/doc/lctl.8
  • lustre/utils/lustre_cfg.c
  • lustre/tests/sanity.sh
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » i686,server,el5,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/tests/sanity.sh
  • lustre/doc/lctl.8
  • lustre/utils/lustre_cfg.c
Comment by Build Master (Inactive) [ 04/Jan/12 ]

Integrated in lustre-master » i686,client,el5,inkernel #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/utils/lustre_cfg.c
  • lustre/tests/sanity.sh
  • lustre/doc/lctl.8
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 lustre-master » i686,client,el5,ofa #404
LU-888 lctl: remove perilous lctl

{get,set,list}

_param behavior. (Revision 51ed079112c9a9eeac37eaf680637a4d04dd3cc9)

Result = SUCCESS
Oleg Drokin : 51ed079112c9a9eeac37eaf680637a4d04dd3cc9
Files :

  • lustre/tests/sanity.sh
  • lustre/doc/lctl.8
  • lustre/utils/lustre_cfg.c
Generated at Sat Feb 10 01:11:23 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.