Skip to content

lsns: continue the executing even if opening a /proc/$pid fails #2952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 15, 2024

Conversation

masatake
Copy link
Member

In the original code, lsns printed nothing if it failed in opening the
last dntry in /proc/[0-9]* though lsns should work partially.

The original behavior caused the combination of the following two
test cases failed:

    $ tests/ts/lsns/filter & tests/ts/lsns/ioctl_ns &
    [1] 19178
    [2] 19179
    $          lsns: ownership and hierarchy        ...         \
    lsns: -Q, --filter option            ... FAILED
     FAILED

    [1]-  Done                    tests/ts/lsns/filter
    [2]+  Done                    tests/ts/lsns/ioctl_ns

In the original code, lsns printed nothing if it failed in opening the
last dntry in /proc/[0-9]* though lsns should work partially.

The original behavior caused the combination of the following two
test cases failed:

    $ tests/ts/lsns/filter & tests/ts/lsns/ioctl_ns &
    [1] 19178
    [2] 19179
    $          lsns: ownership and hierarchy        ...         \
    lsns: -Q, --filter option            ... FAILED
     FAILED

    [1]-  Done                    tests/ts/lsns/filter
    [2]+  Done                    tests/ts/lsns/ioctl_ns

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake marked this pull request as draft April 12, 2024 19:59
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake force-pushed the lsns--relax-the-abort-condition branch from cd382a3 to c5eccab Compare April 13, 2024 02:33
@masatake
Copy link
Member Author

masatake commented Apr 13, 2024

lsns/filedesc failed. The reason is that lsns_ioctl(fd, NS_GET_USERNS) failed with ENOSYS on s390 and riscv64.

Reporting ENOSYS is a bit strange for me. The environments must have ioctl.

@masatake masatake force-pushed the lsns--relax-the-abort-condition branch 5 times, most recently from d98cb9b to 84de673 Compare April 14, 2024 05:49
@masatake masatake closed this Apr 14, 2024
@masatake masatake deleted the lsns--relax-the-abort-condition branch April 14, 2024 10:31
@masatake masatake restored the lsns--relax-the-abort-condition branch April 14, 2024 10:31
@masatake masatake reopened this Apr 14, 2024
…OSYS

With the original code, "lsns/filedesc" test case failed on
"build (qemu-user, s390x)" and "build (qemu-user, riscv64)".

On the platforms, lsns_ioctl(fd, NS_GET_{PARENT,USERNS}) failed
with ENOSYS. The error stoped the iteration for gathering
information from /proc/[0-9]+. As a result, lsns printed
nothing. We don't expect this behavior.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Qemu userspace emulation reports ENOSYS if it doesn't support a given
ioctl command.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake force-pushed the lsns--relax-the-abort-condition branch from f775762 to 60363f4 Compare April 14, 2024 17:42
@masatake masatake force-pushed the lsns--relax-the-abort-condition branch from 60363f4 to fe97fd9 Compare April 14, 2024 17:44
Currently, Qemu userspace emulation doesn't support the ioctl cmd.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@masatake masatake force-pushed the lsns--relax-the-abort-condition branch from fe97fd9 to dbfd5ef Compare April 14, 2024 18:35
@masatake masatake marked this pull request as ready for review April 14, 2024 23:28
@masatake masatake marked this pull request as draft April 14, 2024 23:32
@masatake masatake marked this pull request as ready for review April 14, 2024 23:33
@karelzak karelzak merged commit 281da28 into util-linux:master Apr 15, 2024
32 checks passed
@masatake
Copy link
Member Author

The top half of these commits are applicable to the stable branch.
@karelzak, If I should make a pull request for the stable branch, please, let me know.

@karelzak
Copy link
Collaborator

The top half of these commits are applicable to the stable branch. @karelzak, If I should make a pull request for the stable branch, please, let me know.

It will be better if you select the patches (to a stable PR) rather than rely on my guess ;-)

@masatake
Copy link
Member Author

@karelzak I misunderstood what I did. I assumed the top half of these commits were applicable to the stable branch. However, they were not. They are for new code added to the master branch after you forked the stable branch.

f2a8b20 is one of the candidates for backporting. It may improve lsns running on Qemu userspace emulation. Do you think we should backport this to the stable branch? We cannot cherry-pick this commit easily because the code bases were changed between the master and stable branches.

0a7a8fb is another candidates.
It can warn if lsns doesn't work as expected on Qemu userspace emulation. You can cherry-pick this one easily.

@karelzak
Copy link
Collaborator

@masatake, both patches were cherry-picked successfully.
476e88e
532bd55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants