* [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY
@ 2020-02-10 12:40 Petr Vorel
2020-02-10 12:40 ` [LTP] [PATCH v2 2/3] safe_macros: Use tst_umount() in safe_umount() Petr Vorel
2020-02-16 5:51 ` [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY Li Wang
0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2020-02-10 12:40 UTC (permalink / raw)
To: ltp
Only on EBUSY makes sense to keep trying in a loop.
This helps to use tst_umount() in safe_umount() (next commit).
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Reported-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
lib/tst_device.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/tst_device.c b/lib/tst_device.c
index 89b9c96de..6cad9bd4d 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -363,6 +363,13 @@ int tst_umount(const char *path)
if (!ret)
return 0;
+ if (err != EBUSY) {
+ tst_resm(TWARN, "umount('%s') failed with %s",
+ path, tst_strerrno(err));
+ errno = err;
+ return ret;
+ }
+
tst_resm(TINFO, "umount('%s') failed with %s, try %2i...",
path, tst_strerrno(err), i+1);
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2 2/3] safe_macros: Use tst_umount() in safe_umount()
2020-02-10 12:40 [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY Petr Vorel
@ 2020-02-10 12:40 ` Petr Vorel
2020-02-16 5:51 ` [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY Li Wang
1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2020-02-10 12:40 UTC (permalink / raw)
To: ltp
To get retry workaround for gvfsd-trash background daemon.
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
lib/safe_macros.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index 41fa4ca83..deb19d2df 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -772,7 +772,7 @@ int safe_umount(const char *file, const int lineno, void (*cleanup_fn)(void),
{
int rval;
- rval = umount(target);
+ rval = tst_umount(target);
if (rval == -1) {
tst_brkm(TBROK | TERRNO, cleanup_fn,
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY
2020-02-10 12:40 [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY Petr Vorel
2020-02-10 12:40 ` [LTP] [PATCH v2 2/3] safe_macros: Use tst_umount() in safe_umount() Petr Vorel
@ 2020-02-16 5:51 ` Li Wang
2020-02-16 13:23 ` Petr Vorel
1 sibling, 1 reply; 4+ messages in thread
From: Li Wang @ 2020-02-16 5:51 UTC (permalink / raw)
To: ltp
On Mon, Feb 10, 2020 at 8:41 PM Petr Vorel <pvorel@suse.cz> wrote:
> Only on EBUSY makes sense to keep trying in a loop.
> This helps to use tst_umount() in safe_umount() (next commit).
>
> Suggested-by: Cyril Hrubis <chrubis@suse.cz>
> Reported-by: Jan Stancek <jstancek@redhat.com>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
>
Acked-by: Li Wang <liwang@redhat.com>
> ---
> lib/tst_device.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/lib/tst_device.c b/lib/tst_device.c
> index 89b9c96de..6cad9bd4d 100644
> --- a/lib/tst_device.c
> +++ b/lib/tst_device.c
> @@ -363,6 +363,13 @@ int tst_umount(const char *path)
> if (!ret)
> return 0;
>
> + if (err != EBUSY) {
> + tst_resm(TWARN, "umount('%s') failed with %s",
> + path, tst_strerrno(err));
> + errno = err;
> + return ret;
> + }
>
Since we have guaranteed there is no other error besides EBUSY, maybe we
could cancel the 'err == EBUSY' in the next if() sentences.
Otherweise patch 1/3, 2/3 looks good.
if (i == 0 && err == EBUSY) {
...
}
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20200216/e6d3f41b/attachment.htm>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY
2020-02-16 5:51 ` [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY Li Wang
@ 2020-02-16 13:23 ` Petr Vorel
0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2020-02-16 13:23 UTC (permalink / raw)
To: ltp
Hi Li,
> Acked-by: Li Wang <liwang@redhat.com>
> Since we have guaranteed there is no other error besides EBUSY, maybe we
> could cancel the 'err == EBUSY' in the next if() sentences.
> Otherweise patch 1/3, 2/3 looks good.
> if (i == 0 && err == EBUSY) {
> ...
> }
+1 (fixed in prepared code to be merged).
Thanks for your review.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-02-16 13:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-10 12:40 [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY Petr Vorel
2020-02-10 12:40 ` [LTP] [PATCH v2 2/3] safe_macros: Use tst_umount() in safe_umount() Petr Vorel
2020-02-16 5:51 ` [LTP] [PATCH v2 1/3] tst_umount: Fail immediately when errno != EBUSY Li Wang
2020-02-16 13:23 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox