From bb8514e85949d0c637a7ba60f018c819745ca903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 3 Nov 2016 14:21:18 +0000 Subject: [PATCH] Fix handling of encrypted LVM physical volumes. --- src/fs/luks.cpp | 9 +++++++++ src/fs/lvm2_pv.cpp | 3 +++ src/fs/lvm2_pv.h | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index 303ea78..fe74af9 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -18,6 +18,7 @@ *************************************************************************/ #include "fs/luks.h" +#include "fs/lvm2_pv.h" #include "fs/filesystemfactory.h" @@ -274,6 +275,10 @@ bool luks::cryptOpen(QWidget* parent, const QString& deviceNode) if (!m_isCryptOpen) return false; + for (auto &p : LVM::pvList) // FIXME: qAsConst + if (p.isLuks() && p.partition()->deviceNode() == deviceNode && p.partition()->fileSystem().type() == FileSystem::Lvm2_PV) + p.setLuks(false); + m_passphrase = passphrase; return true; } @@ -309,6 +314,10 @@ bool luks::cryptClose(const QString& deviceNode) m_isCryptOpen = (m_innerFs != nullptr); + for (auto &p : LVM::pvList) // FIXME: qAsConst + if (!p.isLuks() && p.partition()->deviceNode() == deviceNode) + p.setLuks(true); + return true; } diff --git a/src/fs/lvm2_pv.cpp b/src/fs/lvm2_pv.cpp index 9e67ec7..41f81dd 100644 --- a/src/fs/lvm2_pv.cpp +++ b/src/fs/lvm2_pv.cpp @@ -268,6 +268,9 @@ QList lvm2_pv::getPVinNode(const PartitionNode* parent) // FIXME: reenable newly created PVs (before applying) once everything works if(p->fileSystem().type() == FileSystem::Lvm2_PV && p->deviceNode() == p->partitionPath()) partitions.append(LvmPV(p->mountPoint(), p)); + + if(p->fileSystem().type() == FileSystem::Luks && p->deviceNode() == p->partitionPath()) + partitions.append(LvmPV(p->mountPoint(), p, true)); } return partitions; diff --git a/src/fs/lvm2_pv.h b/src/fs/lvm2_pv.h index 07e1a60..29a71a6 100644 --- a/src/fs/lvm2_pv.h +++ b/src/fs/lvm2_pv.h @@ -51,6 +51,10 @@ public: return m_isLuks; } + void setLuks(bool luks) { + m_isLuks = luks; + } + private: QString m_vgName; QPointer m_p;