From 9ecde2b838d2d35e9f36a69e976ca79e1562d209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Tue, 13 Oct 2026 23:10:22 -0300 Subject: [PATCH] fix(imgport): take the image lock for a statelite import imgimport took the image lock only when the bundle had a rootimg. A statelite bundle has a rootimgtree instead, so its import extracted the tree while genimage, packimage, liteimg or rmimage could change the same image. imgimport now locks the directory of the first of the rootimg, rootimgtree, kernel and ramdisk that the bundle has. --- xCAT-server/lib/xcat/plugins/imgport.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index fc7325e70..775224dc4 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -1888,9 +1888,11 @@ sub place_image { return 0 if !check_import($data, $imgdir, $nodes, $callback); # genimage, packimage, liteimg and rmimage hold this lock while they change the image. + # A statelite bundle has a rootimgtree instead of a rootimg. + my ($imagefile) = grep { $_ } map { (split(',', $data->{$_} // ''))[0] } qw(rootimg rootimgtree kernel ramdisk); my $lock; - if ($data->{rootimg}) { - my $rootimgdir = dirname((split(',', $data->{rootimg}))[0]); + if ($imagefile) { + my $rootimgdir = dirname($imagefile); mkpath($rootimgdir) unless -d $rootimgdir; (my $retcode, $lock) = xCAT::Utils->acquire_lock_imageop("$rootimgdir/rootimg"); if ($retcode) {