From bbbc7fa29444e31201701f4f08c53cff265073ea Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Thu, 2 Aug 2018 14:49:57 -0500 Subject: obmc-flash-bios: Remove UBI vols by id instead of name If the name of the volume is passed to ubirmvol to be removed, ubirmvol searches and stores the information for the available UBI volumes, such as id, type, name, etc. If a volume is deleted by another process while this search is in process, ubirmvol would fail, which is the case when removing a PNOR version since 2 separate systemd service files remove the read-only and read-write volumes. Instead pass ubirmvol the volume id instead of the name, so that the ubirmvol doesn't need to do any searches and instead knows which volume to delete. Closes openbmc/openbmc#2863 Tested: Verified a Delete operation does not fail with a ubirmvol error leaving the rw volume behind. Ex: Aug 01 16:43:03 witherspoon systemd[1]: Starting Remove UBIFS volume pnor-rw-5ac20d5d... Aug 01 16:43:04 witherspoon systemd[1]: Starting Remove UBIFS volume pnor-ro-5ac20d5d... Aug 01 16:43:05 witherspoon obmc-flash-bios[1458]: libubi: error!: cannot read "/sys/class/ubi/ubi8_0/type" Aug 01 16:43:05 witherspoon obmc-flash-bios[1458]: error 19 (No such device) Aug 01 16:43:05 witherspoon obmc-flash-bios[1458]: ubirmvol: error!: cannot find UBI volume "pnor-rw-5ac20d5d" Aug 01 16:43:05 witherspoon obmc-flash-bios[1458]: error 19 (No such device) Change-Id: Ib9aaeef4bfc268f3dac29288a469256bc771e195 Signed-off-by: Adriana Kobylak --- .../flash/openpower-software-manager/obmc-flash-bios | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash') diff --git a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios index 298a9c41a..ff8818518 100644 --- a/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios +++ b/meta-openbmc-machines/meta-openpower/common/recipes-phosphor/flash/openpower-software-manager/obmc-flash-bios @@ -155,8 +155,9 @@ umount_ubi() { fi vol="$(findubi "${name}")" - if [ -n "${vol}" ]; then - ubirmvol "${ubidev}" -N "${name}" + id="${vol##*_}" + if [ -n "${id}" ]; then + ubirmvol "${ubidev}" -n "${id}" fi if [ -d "${mountdir}" ]; then -- cgit v1.2.1