diff options
author | Saqib Khan <khansa@us.ibm.com> | 2017-09-26 22:44:10 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-10-02 16:31:00 +0000 |
commit | 2be9ba900086c319ab6553baef347211892976bc (patch) | |
tree | c50777ff79cf4b62ec4be6800315dec875a4a471 | |
parent | 61010b23c6852ee4409fc56a532b4b519e203839 (diff) | |
download | openpower-pnor-code-mgmt-2be9ba900086c319ab6553baef347211892976bc.tar.gz openpower-pnor-code-mgmt-2be9ba900086c319ab6553baef347211892976bc.zip |
Delete orphaned pnor read-write volumes.
We have seen many instances where the read-only volumes were
deleted but the read-write partitions were preserved. This
had causes subsequent PNOR updates to fail as the space on
PNOR chip was occupied by these orphaned rw volumes.
Resolves openbmc/openbmc#2376
Change-Id: Id0d750680e4e972ee991d95e8b00f4c6cc1fa72e
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
-rw-r--r-- | item_updater.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/item_updater.cpp b/item_updater.cpp index 101489050..e9a283d70 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -158,6 +158,7 @@ void ItemUpdater::processPNORImage() auto activationState = server::Activation::Activations::Active; static const auto PNOR_RO_PREFIX_LEN = strlen(PNOR_RO_PREFIX); + static const auto PNOR_RW_PREFIX_LEN = strlen(PNOR_RW_PREFIX); // Check if the PNOR_RO_PREFIX is the prefix of the iter.path if (0 == iter.path().native().compare(0, PNOR_RO_PREFIX_LEN, @@ -249,6 +250,18 @@ void ItemUpdater::processPNORImage() "", *this))); } + else if (0 == iter.path().native().compare(0, PNOR_RW_PREFIX_LEN, + PNOR_RW_PREFIX)) + { + auto id = iter.path().native().substr(PNOR_RW_PREFIX_LEN); + auto roDir = PNOR_RO_PREFIX + id; + if (!fs::is_directory(roDir)) + { + log<level::ERR>("No corresponding read-only volume found.", + entry("DIRNAME=%s", roDir)); + ItemUpdater::erase(id); + } + } } // Look at the RO symlink to determine if there is a functional image |