fs_uvol: take down volume before removal

Make sure volume is in 'down' state before attempting to remove it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
cute-signatures
Daniel Golle 2021-12-17 19:10:38 +00:00 committed by Timo Teräs
parent 4c568416e3
commit aa4880bc04
1 changed files with 4 additions and 0 deletions

View File

@ -128,6 +128,7 @@ static int uvol_file_control(struct apk_fsdir *d, apk_blob_t filename, int ctrl)
struct apk_ctx *ac = d->ac;
struct apk_pathbuilder pb;
const char *uvol_name;
int r;
if (IS_ERR(ac->uvol)) return PTR_ERR(ac->uvol);
@ -140,6 +141,9 @@ static int uvol_file_control(struct apk_fsdir *d, apk_blob_t filename, int ctrl)
case APK_FS_CTRL_APKNEW:
case APK_FS_CTRL_CANCEL:
case APK_FS_CTRL_DELETE:
r = uvol_run(ac, "down", uvol_name, 0, 0);
if (r)
return r;
return uvol_run(ac, "remove", uvol_name, 0, 0);
default:
return -APKE_UVOL_ERROR;