Skip to content

Commit

Permalink
mounts: Unmount the container rootfs
Browse files Browse the repository at this point in the history
In case of a standalone container, unmount the rootfs from
the shared hyperstart directory.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
  • Loading branch information
amshinde committed Jun 21, 2017
1 parent 61b8b8b commit 9d8a083
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,23 @@ cc_pod_handle_unmounts (const struct cc_oci_config *config)
return cc_handle_unmounts(config->pod->rootfs_mounts);
}

/*!
* Unmount container rootfs mount point.
*
* \param config \ref cc_oci_config.
*
* \return \c true on success, else \c false.
*/
gboolean
cc_oci_handle_rootfs_unmount (const struct cc_oci_config *config)
{
if ( !config || config->pod) {
return true;
}

return cc_handle_unmounts(config->rootfs_mount);
}

/*!
* Convert a list of mounts to a JSON array.
*
Expand Down
1 change: 1 addition & 0 deletions src/mount.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ gboolean cc_oci_handle_mounts (struct cc_oci_config *config);
gboolean cc_pod_handle_mounts (struct cc_oci_config *config);
gboolean cc_oci_handle_unmounts (const struct cc_oci_config *config);
gboolean cc_pod_handle_unmounts (const struct cc_oci_config *config);
gboolean cc_oci_handle_rootfs_unmount (const struct cc_oci_config *config);

struct cc_oci_mount* rootfs_bind_mount(struct cc_oci_config *config);
gboolean cc_oci_add_rootfs_mount(struct cc_oci_config *config);
Expand Down
5 changes: 5 additions & 0 deletions src/oci.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,11 @@ cc_oci_cleanup (struct cc_oci_config *config)
return false;
}

/* Container rootfs unmount should happen after volume unmounts */
if (! cc_oci_handle_rootfs_unmount(config)) {
return false;
}

/* Pod unmounts should happen after the volume unmounts */
if (! cc_pod_handle_unmounts(config)) {
return false;
Expand Down

0 comments on commit 9d8a083

Please sign in to comment.