From c88938349424a9502c3fd33d6487bde9d4011cf2 Mon Sep 17 00:00:00 2001 From: huweihua Date: Sat, 21 Nov 2015 03:01:39 -0500 Subject: [PATCH 1/2] provide a walk around to defect #424 --- xCAT-server/lib/xcat/plugins/rmimage.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/rmimage.pm b/xCAT-server/lib/xcat/plugins/rmimage.pm index bbfae5994..55cb15e2b 100644 --- a/xCAT-server/lib/xcat/plugins/rmimage.pm +++ b/xCAT-server/lib/xcat/plugins/rmimage.pm @@ -186,6 +186,16 @@ sub process_request { `umount -l $imagedir/rootimg/proc 2>&1 1>/dev/null`; # also umount the rootimg/sys `umount -l $imagedir/rootimg/sys 2>&1 1>/dev/null`; + + # umount the rootimg/dev + my $devmount = `cat /proc/mounts |grep "$imagedir/rootimg/dev"`; + if($devmount){ + xCAT::Utils->runcmd("umount $imagedir/rootimg/dev"); + if($?){ + $callback->({error=>["$imagedir/rootimg/dev mount on /dev, and can't umount. remove $imagename will lead to unpredictable result, please umount manualy before try again"], errorcode=>[1]}); + return; + } + } #Start removing the rootimg directory and files if (-d "$imagedir/rootimg") { From bd2ee5c0702fb68553599c9a2bc797e3a5b796df Mon Sep 17 00:00:00 2001 From: huweihua Date: Sun, 22 Nov 2015 21:30:33 -0500 Subject: [PATCH 2/2] use lazy mode of umount to increase the success rate --- xCAT-server/lib/xcat/plugins/rmimage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/rmimage.pm b/xCAT-server/lib/xcat/plugins/rmimage.pm index 55cb15e2b..79b1df18d 100644 --- a/xCAT-server/lib/xcat/plugins/rmimage.pm +++ b/xCAT-server/lib/xcat/plugins/rmimage.pm @@ -190,7 +190,7 @@ sub process_request { # umount the rootimg/dev my $devmount = `cat /proc/mounts |grep "$imagedir/rootimg/dev"`; if($devmount){ - xCAT::Utils->runcmd("umount $imagedir/rootimg/dev"); + xCAT::Utils->runcmd("umount -l $imagedir/rootimg/dev"); if($?){ $callback->({error=>["$imagedir/rootimg/dev mount on /dev, and can't umount. remove $imagename will lead to unpredictable result, please umount manualy before try again"], errorcode=>[1]}); return;