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

rustreapi: lsp_stripe_pattern union breaks build against master lustreapi.h

XMLWordPrintable

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

      rustreapi does not compile against the current master lustreapi.h.

      LU-16518 ("utils: fix enum conversion errors in lfs", commit 0a68ef925f) turned
      llapi_stripe_param.lsp_stripe_pattern into a member of an anonymous union:

      struct llapi_stripe_param {
      unsigned long long lsp_stripe_size;
      char *lsp_pool;
      int lsp_stripe_offset;
      union

      { enum lov_pattern lsp_stripe_pattern; enum lmv_hash_type lsp_hash_type; }

      ;
      ...
      };

      bindgen therefore emits the field as __bindgen_anon_1.lsp_stripe_pattern, and
      rustreapi/rustreapi/src/lib.rs:240 no longer builds:

      error[E0609]: no field `lsp_stripe_pattern` on type `lustreapi_sys::llapi_stripe_param`
      --> rustreapi/src/lib.rs:240:35

      240 | addr_of_mut!((*param).lsp_stripe_pattern).write(self.stripe_pattern);

      ^^^^^^^^^^^^^^^^^^ unknown field

      This is masked today because rustreapi is not wired into the Lustre build at
      all – nothing outside rustreapi/ references it except MAINTAINERS – so
      lustreapi-sys' bindgen picks up the installed /usr/include/lustre/lustreapi.h
      from lustre-devel rather than the tree's. Build containers currently ship
      lustre-devel 2.17.53, which predates the union. It will break as soon as the
      devel RPMs catch up to master.

      Reproducer, from a master work tree:

      podman run --rm -v <tree>:/src:Z -w /src/rustreapi \
      -e BINDGEN_EXTRA_CLANG_ARGS="-I/src/include -I/src/include/uapi" \
      -e CFLAGS="-I/src/include -I/src/include/uapi" \
      <builder image> cargo check -p rustreapi

      Fix is to write through the anonymous union member, keeping lsp_hash_type
      reachable for the LMV case.

      Found while testing https://review.whamcloud.com/c/fs/lustre-release/+/58514
      (LU-18842), which is unrelated to this bug.

            wc-triage WC Triage
            rread Robert Read
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: