]> git.proxmox.com Git - mirror_lxcfs.git/commit
re-initialize library after reload
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 5 Jul 2022 08:26:26 +0000 (10:26 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 5 Jul 2022 08:50:53 +0000 (10:50 +0200)
commitcb784d698bb8681f7f870961ce5aa7f1314a9291
tree1009c51e5119fc71b83ad1eafa043f7a1c3a2f30
parentfa274fb9f544cf2c697335c1b1e2df97e81fbe86
re-initialize library after reload

When introducing versioned options, we started using fuse's
"init" callback in order to tell the library to set
`can_use_sys_cpu` and `has_versioned_opts` accordingly.

However, we forgot to also do this on a reload. Fix this by
simply calling `lxcfs_fuse_init()` in `do_reload()` as well.

Additionaly: ignore lxcfs_fuse_init()'s return value.
We just "passed through" the private_data from fuse which is
set via the `fuse_main()` call.

It's better to not leave this up to the library anyway in
order to make it easier to be fuse version agnostic in the
future.

Without this, issuing a reload to lxcfs would cause
files in `/sys/devices/system/cpu/` to be visible via
`readdir`, but accessing them would fail:

    ~ # ls /sys/devices/system/cpu/
    ls: /sys/devices/system/cpu/cpuidle: No such file or directory
    ls: /sys/devices/system/cpu/uevent: No such file or directory
    (...)

    ~ # echo /sys/devices/system/cpu/*
    /sys/devices/system/cpu/cpu0 /sys/devices/system/cpu/cpu1 (...)

    ~ # strace stat /sys/devices/system/cpu/cpu0
    lstat("/sys/devices/system/cpu/cpu0", 0x7ffdb2c57a00) = -1 ENOENT (No such file or directory)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/lxcfs.c