[Devel] [PATCH v3 1/2] spfs: Handle non-zero exit status in cleanup_spfs_mount()
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Tue Jan 23 14:17:44 MSK 2018
Looks good to me
Acked-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
23.01.2018 11:43, Kirill Tkhai пишет:
> Consider non-zero exit status of spfs similar to killed
> status and do the same cleanups.
>
> v3: New
>
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
> manager/context.c | 8 ++++----
> manager/spfs.c | 8 ++++----
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/manager/context.c b/manager/context.c
> index 1eb37c9..73d5ada 100644
> --- a/manager/context.c
> +++ b/manager/context.c
> @@ -45,12 +45,12 @@ const char *mgr_ovz_id(void)
> static void cleanup_spfs_mount(struct spfs_manager_context_s *ctx,
> struct spfs_info_s *info, int status)
> {
> - bool killed = WIFSIGNALED(status);
> + bool failed = WIFSIGNALED(status) || !!WEXITSTATUS(status);
>
> pr_debug("removing info %s from the list\n", info->mnt.id);
>
> - if (killed)
> - /* SPFS master was killed. We need to release the reference */
> + if (failed)
> + /* SPFS master was failed. We need to release the reference */
> spfs_release_mnt(info);
>
> info->dead = true;
> @@ -59,7 +59,7 @@ static void cleanup_spfs_mount(struct spfs_manager_context_s *ctx,
> if (unlink(info->socket_path))
> pr_perror("failed to unlink %s", info->socket_path);
>
> - spfs_cleanup_env(info, killed);
> + spfs_cleanup_env(info, failed);
>
> close_namespaces(info->ns_fds);
> }
> diff --git a/manager/spfs.c b/manager/spfs.c
> index 3e0f667..99845b1 100644
> --- a/manager/spfs.c
> +++ b/manager/spfs.c
> @@ -409,9 +409,9 @@ int spfs_prepare_env(struct spfs_info_s *info, const char *proxy_dir)
> return err ? err : res;
> }
>
> -static int __spfs_cleanup_env(struct spfs_info_s *info, bool killed)
> +static int __spfs_cleanup_env(struct spfs_info_s *info, bool failed)
> {
> - if (killed && umount(info->work_dir)) {
> + if (failed && umount(info->work_dir)) {
> pr_perror("failed to umount %s", info->work_dir);
> return -errno;
> }
> @@ -423,7 +423,7 @@ static int __spfs_cleanup_env(struct spfs_info_s *info, bool killed)
> return 0;
> }
>
> -int spfs_cleanup_env(struct spfs_info_s *info, bool killed)
> +int spfs_cleanup_env(struct spfs_info_s *info, bool failed)
> {
> int err, res;
> unsigned orig_ns_mask;
> @@ -432,7 +432,7 @@ int spfs_cleanup_env(struct spfs_info_s *info, bool killed)
> if (res)
> return res;
>
> - err = __spfs_cleanup_env(info, killed);
> + err = __spfs_cleanup_env(info, failed);
>
> res = leave_spfs_context(info, orig_ns_mask);
>
>
More information about the Devel
mailing list