public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 1/2] libltp: add support to mount tmpfs for EROFS	testing
Date: Fri, 8 Sep 2017 05:22:01 -0400 (EDT)	[thread overview]
Message-ID: <1249191462.10698048.1504862521083.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20170907221625.13616-2-sspatil@google.com>




----- Original Message -----
> Some tests go through losetup, create, format and mount filesystems only
> to test for 'EROFS' return value from system calls. The tests end up
> being flaky depending on the tools available on the platform. e.g.
> mkfs.<filesystem> tool is required for mounting a device with
> filesystem.
> 
> If the test is only to check for EROFS, this can be achieved by simply by the
> read-only mounting 'tmpfs' at 'mntpoint' and fallback to the original way if
> that fails.
> 
> Example of tests that can benefit from this are:
>   access04, mkdirat02, mknodat02, acct01, fchown04, mknod07 etc.
> 
> This also allows for these tests to successfully run on Android.
> Signed-off-by: Sandeep Patil <sspatil@google.com>
> ---
> 
> v1->v2
> ------
> - Changed the interface to be at a higher level, i.e. instead of
>   making tests specify that they need a read-only tmpfs mount, we
>   do that automatically in the library as a preference and fallback
>   to the old way if that doesn't succeed.
> 
> - The read-only bind mount of "/" option was tried and it worked just
>   fine with an Android system, but broke my ubuntu instance badly (I lost
>   root).
>   I could never find out why, since hte patch worked fine on Android
>   and it correctly did the bind mount. However, I figured if there is any
>   chance of possible breakage, we should simply avoid that path for now.

I tried this too, with bind mounting only one directory inside TMPDIR:
  SAFE_MOUNT(source, target, NULL, MS_BIND, NULL);
  SAFE_MOUNT(NULL, target, NULL, MS_REMOUNT | MS_RDONLY | MS_BIND, NULL);
and it worked fine, but it turns out it's supported since 2.6.26.

This patch (which uses tmpfs for EROFS only) looks OK to me, and it allows
us to add RO bind mount later as fallback if there's need for it (e.g.
tmpfs not available on some distros).

I tested it as far back as RHEL5.6 (2.6.18 kernel).

Regards,
Jan

  reply	other threads:[~2017-09-08  9:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-07 22:16 [LTP] [PATCH v2 0/2] libltp: add support for .needs_rofs for EROFS check Sandeep Patil
2017-09-07 22:16 ` [LTP] [PATCH v2 1/2] libltp: add support to mount tmpfs for EROFS testing Sandeep Patil
2017-09-08  9:22   ` Jan Stancek [this message]
2017-09-18 16:51     ` Sandeep Patil
2017-09-07 22:16 ` [LTP] [PATCH v2 2/2] syscalls/access04: use .needs_rofs flag " Sandeep Patil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1249191462.10698048.1504862521083.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox