Skip to content

zfs snapshot: tool path is non-verridable , one call bypasses ZFS_COMMAND, #4777

Description

@ThalesBarretto

Summary

xlators/mgmt/glusterd/src/snapshot/glusterd-zfs-snapshot.c reaches the zfs
utility through a file-local macro:

#define ZFS_COMMAND "/sbin/zfs"

Two related problems:

  1. One call bypasses the macro. Six of the seven zfs invocations in the file
    go through ZFS_COMMAND, but glusterd_zfs_dataset() spells the zfs list
    command as a bare "zfs" string (line 54).
  2. Not overridable. ZFS_COMMAND bakes in /sbin/zfs with no way for a packager
    to point it elsewhere without patching the source — unlike the sibling path macros
    _PATH_UMOUNT and _PATH_SETFATTR, which are #ifndef-guarded for exactly this.

The outlier:

/* glusterd_zfs_dataset(), line 54 */
runner_add_args(&runner, "zfs", "list", "-Ho", "name", brick_path, NULL);

Note the two spellings resolve differently: glusterd's runner spawns via
posix_spawnp, so the bare "zfs" is $PATH-resolved, whereas ZFS_COMMAND pins
/sbin/zfs. So line 54 is not just cosmetically different — it is the one site whose
zfs path is not the file's declared /sbin/zfs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions