Yes, mounting B is unnecessary and it does not affect the test result.
The test() function can be simplified to:
static void test(void)
{
/* unshares the mount ns */
if (unshare(CLONE_NEWNS) == -1)
tst_brkm(TBROK | TERRNO, cleanup, "unshare failed");
/* makes sure mounts/umounts have no effect on a real system */
SAFE_MOUNT(cleanup, "none", "/", "none", MS_REC|MS_PRIVATE, NULL);
/* bind mounts DIRA to itself */
SAFE_MOUNT(cleanup, DIRA, DIRA, "none", MS_BIND, NULL);
/* makes mount DIRA unbindable */
SAFE_MOUNT(cleanup, "none", DIRA, "none", MS_UNBINDABLE, NULL);
/* tries to bind mount unbindable DIRA to DIRB which should fail */
if (mount(DIRA, DIRB, "none", MS_BIND, NULL) == -1) {
tst_resm(TPASS, "unbindable mount passed");
} else {
SAFE_UMOUNT(cleanup, DIRB);
tst_resm(TFAIL, "unbindable mount faled");
}
SAFE_UMOUNT(cleanup, DIRA);
}
Matus Marhefka
----- Original Message -----
From: "Cyril Hrubis" <[email protected]>
To: "Jan Stancek" <[email protected]>
Cc: "Matus Marhefka" <[email protected]>, [email protected]
Sent: Thursday, October 2, 2014 3:47:09 PM
Subject: Re: [LTP] [PATCH 2/2 v2] containers: added mountns/mountns04.c
Hi!
> Same question as for mountns03, is it necessary for B to be bind mounted
> to itself and shared?
I see that this part was removed from mountns03 but not from the latest
version of mountns04. Has this been resolved for mountns04?
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list