From bfbd279875f6395e203f17d2f22686f6f9ad9125 Mon Sep 17 00:00:00 2001 From: Elena Chernikova Date: Mon, 27 Sep 2021 01:13:00 +0300 Subject: [PATCH] sysvinit: create /var/run/ceph before pid /var/run is mounted as tmpfs and will be cleared after reboot. On sysvinit ceph init service creates this directory for pid with root ownership. Fixes: https://tracker.ceph.com/issues/19242 Signed-off-by: Elena Chernikova --- src/init-ceph.in | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/init-ceph.in b/src/init-ceph.in index f60c5929318..9d93e6b85c1 100755 --- a/src/init-ceph.in +++ b/src/init-ceph.in @@ -295,9 +295,12 @@ for name in $what; do get_conf pid_file "$run_dir/$type.$id.pid" "pid file" + if [ ! -d $run_dir ]; then + install -d -m0770 -o ceph -g ceph /var/run/ceph + fi + if [ "$command" = "start" -o "$command" = "onestart" ]; then if [ -n "$pid_file" ]; then - do_cmd "mkdir -p "`dirname $pid_file` cmd="$cmd --pid-file $pid_file" fi @@ -423,10 +426,6 @@ for name in $what; do fi echo Starting Ceph $name on $host... - if [ ! -d $run_dir ]; then - # assume /var/run exists - install -d -m0770 -o ceph -g ceph /var/run/ceph - fi get_conf pre_start_eval "" "pre start eval" [ -n "$pre_start_eval" ] && $pre_start_eval get_conf pre_start "" "pre start command" -- 2.39.5