Hi,

>> mounting sysfs in a separate (net + mnt) namespace will cause that
>> inside that namespace in /sys/class/net/ we will see only network
>> devices local to the separated namespace including dummy device
>> created by the test (without mounting sysfs we would see all the devices
>> from main namespace). Now back in the main namespace we check that this
>> mount had no influence on the main namespace (ls /sys/class/net 
>> >sysfs_after).
>> I thought that test description says it clear.
>
> So we are testing that mounting the /sys in new mount namespace does no
> propagate to the main namespace?

Yes.

> In this case it makes sense.
>
> Also do we want to assert that the dummy0 device is listed in the /sys
> inside the namespace?

Don't you think that this is sufficient ?

ns_exec $NS_HANDLE ip link add dummy0 type dummy || \                           
    tst_brkm TBROK "failed to add a new dummy device"

>> To the namespace destroying: as NS_HANDLE is a pid of a process, which keeps
>> namespace alive (see ns_create.c for details), we can destroy namespace
>> by killing this process.
>
> I pretty much know that allready (I've spend quite some time reading the
> code you wrote).
>
> And if I understand it correctly removing the namespace will also remove
> the dummy device that has been created in that namespace, right?

Yes, removing the namespace will also remove the dummy device.

> So that the sysfs_after will be same regardless if the dummy device was
> propagated or not. Which is the reason I wanted to sample the directory
> before we remove it.

You are right, this is something I overlooked. But when we remove
the "kill -9 $NS_HANDLE" command before sampling into the sysfs_after,
it should be okay.

>> Anyway, one thing you can do before pushing the patch is to remove
>> kill -9 $NS_HANDLE
>> command from the test code, as this is done inside cleanup function.
>
> Killing it twice once in the test and once in the cleanup is mistake as
> well. Since the NS_HANDLE is pid and it may have been reused if there
> was a lot of forking done on the system meanwhile. Which is unlikely but
> still possible.

True. Will you remove that kill command on pushing or should I resend the patch 
v4 ?

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to