From: Leo Liang <ycliang@andestech.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v6, 1/4] lib: tst_umount: umount a mount point instead of a device
Date: Tue, 24 Aug 2021 19:27:37 +0800 [thread overview]
Message-ID: <YSTXqWWebzq+mBIQ@ubuntu02> (raw)
In-Reply-To: <YSOuhTL87oYnwfk3@pevik>
Hi Petr,
Understood! Thanks for explaining everything!
I will send a v7 soon including all the modifications needed.
Best regards,
Leo
On Mon, Aug 23, 2021 at 04:19:49PM +0200, Petr Vorel wrote:
> Hi Leo,
>
> as I noted at forth patch, some tests use tst_umount with the default parameter.
> Thus we should set the default TST_MNTPOINT to use $PWD as well.
>
> I'd also add quotes around $mntpoint in TCONF/TINFO messages in tst_mount() as
> the original message was a bit confusing when the mountpoint was called
> 'mntpoint' (TWARN: The mntpoint is not an absolute path).
>
> Kind regards,
> Petr
>
> +++ testcases/lib/tst_test.sh
> @@ -279,31 +279,35 @@ tst_mount()
>
> tst_umount()
> {
> - local device="${1:-$TST_DEVICE}"
> + local mntpoint="${1:-$TST_MNTPOINT}"
> local i=0
>
> - [ -z "$device" ] && return
> + [ -z "$mntpoint" ] && return
>
> - if ! grep -q "$device" /proc/mounts; then
> - tst_res TINFO "The $device is not mounted, skipping umount"
> + if ! echo "$mntpoint" | grep -q ^/; then
> + tst_brk TCONF "The '$mntpoint' is not an absolute path"
> + fi
> +
> + if ! grep -q "${mntpoint%/}" /proc/mounts; then
> + tst_res TINFO "The '$mntpoint' is not mounted upon, skipping umount"
Will add this in v7!
> return
> fi
>
> while [ "$i" -lt 50 ]; do
> - if umount "$device" > /dev/null; then
> + if umount "$mntpoint" > /dev/null; then
> return
> fi
>
> i=$((i+1))
>
> - tst_res TINFO "umount($device) failed, try $i ..."
> + tst_res TINFO "umount($mntpoint) failed, try $i ..."
> tst_res TINFO "Likely gvfsd-trash is probing newly mounted "\
> "fs, kill it to speed up tests."
>
> tst_sleep 100ms
> done
>
> - tst_res TWARN "Failed to umount($device) after 50 retries"
> + tst_res TWARN "Failed to umount($mntpoint) after 50 retries"
> }
>
> tst_mkfs()
> @@ -628,7 +632,7 @@ tst_run()
> cd "$TST_TMPDIR"
> fi
>
> - TST_MNTPOINT="${TST_MNTPOINT:-mntpoint}"
> + TST_MNTPOINT="${TST_MNTPOINT:-$PWD/mntpoint}"
This is a good catch.
I think I did notice that df01.sh uses tst_umount as a clean up
function, but didn't realize that this should be changed!
Thanks for the heads up!
> if [ "$TST_NEEDS_DEVICE" = 1 ]; then
>
> TST_DEVICE=$(tst_device acquire)
prev parent reply other threads:[~2021-08-24 11:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-04 1:52 [LTP] [PATCH v6, 1/4] lib: tst_umount: umount a mount point instead of a device Leo Liang
2021-08-23 13:48 ` Petr Vorel
2021-08-23 14:19 ` Petr Vorel
2021-08-24 11:27 ` Leo Liang [this message]
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=YSTXqWWebzq+mBIQ@ubuntu02 \
--to=ycliang@andestech.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.