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" <chru...@suse.cz>
To: "Jan Stancek" <jstan...@redhat.com>
Cc: "Matus Marhefka" <mmarh...@redhat.com>, ltp-list@lists.sourceforge.net
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
chru...@suse.cz

------------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to