* [PATCH] libxl: avoid infinite loop in libxl__remove_directory()
@ 2025-03-06 11:25 Jan Beulich
2025-03-06 15:01 ` Jürgen Groß
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2025-03-06 11:25 UTC (permalink / raw)
To: xen-devel@lists.xenproject.org; +Cc: Anthony PERARD, Juergen Gross
Infinitely retrying the rmdir() invocation makes little sense. While the
original observation was the log filling the disk (due to repeated
"Directory not empty" errors, in turn occurring for unclear reasons),
the loop wants breaking even if there was no error message being logged
(much like is done in the similar loops in libxl__remove_file() and
libxl__remove_file_or_directory()).
Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
This is the simplest possible adjustment. Depending on why there were
retries, retrying a few times may make sense. But then, especially for
the specific error observed, presumably only after having tried to empty
the directory another time.
It's further questionable whether trying the rmdir() makes sense at all
when emptying the directory failed. After all failure of opendir() also
results in bailing from the function without trying to rmdir(). If this
makes sense, then I further think that "rc" would want resetting ahead
of this final loop in the function: If the rmdir() succeeds despite
earlier errors, all is (kind of) fine.
--- a/tools/libs/light/libxl_utils.c
+++ b/tools/libs/light/libxl_utils.c
@@ -577,6 +577,7 @@ int libxl__remove_directory(libxl__gc *g
if (errno == EINTR) continue;
LOGE(ERROR, "failed to remove emptied directory %s", dirpath);
rc = ERROR_FAIL;
+ break;
}
out:
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] libxl: avoid infinite loop in libxl__remove_directory()
2025-03-06 11:25 [PATCH] libxl: avoid infinite loop in libxl__remove_directory() Jan Beulich
@ 2025-03-06 15:01 ` Jürgen Groß
2025-03-12 17:02 ` Anthony PERARD
0 siblings, 1 reply; 3+ messages in thread
From: Jürgen Groß @ 2025-03-06 15:01 UTC (permalink / raw)
To: Jan Beulich, xen-devel@lists.xenproject.org; +Cc: Anthony PERARD
[-- Attachment #1.1.1: Type: text/plain, Size: 767 bytes --]
On 06.03.25 12:25, Jan Beulich wrote:
> Infinitely retrying the rmdir() invocation makes little sense. While the
> original observation was the log filling the disk (due to repeated
> "Directory not empty" errors, in turn occurring for unclear reasons),
> the loop wants breaking even if there was no error message being logged
> (much like is done in the similar loops in libxl__remove_file() and
> libxl__remove_file_or_directory()).
>
> Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
While probably a more sane solution by reworking this whole mess
is possible, this patch should solve the issue Jan has described.
So:
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] libxl: avoid infinite loop in libxl__remove_directory()
2025-03-06 15:01 ` Jürgen Groß
@ 2025-03-12 17:02 ` Anthony PERARD
0 siblings, 0 replies; 3+ messages in thread
From: Anthony PERARD @ 2025-03-12 17:02 UTC (permalink / raw)
To: Jürgen Groß; +Cc: Jan Beulich, xen-devel
On Thu, Mar 06, 2025 at 04:01:53PM +0100, Jürgen Groß wrote:
> On 06.03.25 12:25, Jan Beulich wrote:
> > Infinitely retrying the rmdir() invocation makes little sense. While the
> > original observation was the log filling the disk (due to repeated
> > "Directory not empty" errors, in turn occurring for unclear reasons),
> > the loop wants breaking even if there was no error message being logged
> > (much like is done in the similar loops in libxl__remove_file() and
> > libxl__remove_file_or_directory()).
> >
> > Fixes: c4dcbee67e6d ("libxl: provide libxl__remove_file et al")
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> While probably a more sane solution by reworking this whole mess
libxl?
> is possible, this patch should solve the issue Jan has described.
>
> So:
>
> Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
Thanks,
--
Anthony Perard | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-12 17:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 11:25 [PATCH] libxl: avoid infinite loop in libxl__remove_directory() Jan Beulich
2025-03-06 15:01 ` Jürgen Groß
2025-03-12 17:02 ` Anthony PERARD
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.