Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-21027

lctl dk: raw mode fails with EINVAL for relative file names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • None
    • 3
    • 9223372036854775807

      "lctl dk <file> 1" (raw mode) fails with an unhelpful error when <file>
      is a relative path.

      In raw mode, lctl passes the file name unchanged to the kernel
      dump_kernel control file. A relative name is rejected with EINVAL, and
      lctl prints only:

          write(dumpfile) failed: Invalid argument

      An absolute path works. Text mode is not affected, because lctl builds
      its own absolute temporary name (/tmp/lustre-log<time>.<usec>) and
      converts it afterwards.

      Steps to reproduce:

          # lctl dk dumpfile 1
          write(dumpfile) failed: Invalid argument

          # lctl dk /tmp/dumpfile 1
          (works; "file /tmp/dumpfile" reports "data")

      Debug prints in jt_dbg_debug_kernel() show that dbg_write_cmd() fails
      with errno 22 when the name is "dumpfile" (8 bytes), and succeeds with
      the absolute name used in text mode.

      Expected behavior:

      A relative file name works in raw mode, or lctl prints a clear error
      such as "raw mode requires an absolute path".

      Why it matters:

      Raw mode avoids the text conversion and timestamp sort, which are the
      memory-heavy part of "lctl dk". On a node with a small memory cgroup, a
      text dump can push the cgroup over its limit. Raw mode is a useful workaround, but it
      should not require reading the source to use.

      Proposed fix:

      In jt_dbg_debug_kernel(), build an absolute path with getcwd() when the
      raw-mode file name is relative, with length checks before concatenation

            manhongdai Manhong Dai
            manhongdai Manhong Dai
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: