[CRIU] [PATCH] scripts: restart all systemd automount services
Stanislav Kinsburskiy
skinsbursky at virtuozzo.com
Thu Jun 9 04:33:20 PDT 2016
I like the idea in general.
But it's racy, because mount point is moved aside for some time on a
running container, while service is restarting
and nothing prevents a process try to access this mount which it's not
available.
08.06.2016 16:49, Andrew Vagin пишет:
> Cc: Stanislav
>
> On Mon, Jun 06, 2016 at 06:42:13PM +0300, Eugene Kolomeetz wrote:
>> No need to hardcode list of autofs services,
>> we can query it dynamically via systemctl.
>> https://jira.sw.ru/browse/PSBM-46672
>>
>> Signed-off-by: Eugene Kolomeetz <klm at virtuozzo.com>
>> ---
>> scripts/systemd-autofs-restart.sh | 11 +++--------
>> 1 files changed, 3 insertions(+), 8 deletions(-)
>>
>> diff --git a/scripts/systemd-autofs-restart.sh b/scripts/systemd-autofs-restart.sh
>> index ba32f1f..6ef2261 100755
>> --- a/scripts/systemd-autofs-restart.sh
>> +++ b/scripts/systemd-autofs-restart.sh
>> @@ -39,7 +39,8 @@ JOIN_CT="$NS_ENTER -t $CRTOOLS_INIT_PID -m -u -p"
>> # Skip container, if it's not systemd based
>> [ "$($JOIN_CT basename -- $($JOIN_CT readlink /proc/1/exe))" == "systemd" ] || exit 0
>>
>> -AUTOFS_SERVICES="proc-sys-fs-binfmt_misc.automount"
>> +AUTOFS_SERVICES="$($JOIN_CT systemctl --no-legend -t automount \
>> + --state=active list-units | awk '{ print $1 }')"
>>
>> bindmount=""
>>
>> @@ -144,13 +145,7 @@ function restart_service {
>> }
>>
>> for service in $AUTOFS_SERVICES; do
>> - status=$($JOIN_CT systemctl is-active $service)
>> -
>> - if [ $status == "active" ]; then
>> - restart_service $service
>> - else
>> - echo "$service skipped ($status)"
>> - fi
>> + restart_service $service
>> done
>>
>> exit 0
>> --
>> 1.7.6
>>
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list