From: Karol Lewandowski Date: Tue, 4 Mar 2025 17:16:14 +0000 (+0100) Subject: fixed size backend: Do not unmount subsession image when switching away from session X-Git-Tag: accepted/tizen/unified/20250403.081015~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c20b0ff5efc8f43f891f03d565a9f910efadfff;p=platform%2Fcore%2Fsystem%2Fsessiond.git fixed size backend: Do not unmount subsession image when switching away from session There is no tangible benefit for unmounting the image. Change-Id: Ic425cfee68b99fe3eef8f532676f77844229c833 --- diff --git a/src/service/src/dir_backend_fixed_size.cpp b/src/service/src/dir_backend_fixed_size.cpp index f20aeb4..40fe4c9 100644 --- a/src/service/src/dir_backend_fixed_size.cpp +++ b/src/service/src/dir_backend_fixed_size.cpp @@ -190,6 +190,9 @@ void DirBackendAddFixedSize::AddSubsessionFinalize (const fs::path& tmpdir_path, void DirBackendFixedSize::RemoveSubsession (const fs::path& subsession_path) const { + if (OS::is_mountpoint(subsession_path)) + do_umount(subsession_path); + fs::remove(subsession_path); const auto image_path = GetImagePathFromSubsessionPath(subsession_path); @@ -198,9 +201,13 @@ void DirBackendFixedSize::RemoveSubsession (const fs::path& subsession_path) con void DirBackendFixedSize::SwitchSubsessionAway (const fs::path& subsession_path) const { - /* Note, we cannot keep the subsession mounted permanently, - * from Add until Remove, because reboots happen. */ - do_umount(subsession_path); + /* Keep session mounted during switch to reuse it if another switch happen. + * Addionally, it leaves subsession in same state as if sessiond would be restarted */ + if (getenv("SESSIOND_NO_KEEP_SESSION_MOUNTS")) { + LOGI("Unmouting session image at %s", subsession_path.c_str()); + do_umount(subsession_path); + } else + LOGI("Switching away from subsession but keeping image mounted at %s", subsession_path.c_str()); } void DirBackendFixedSize::SwitchSubsessionInto (const fs::path& subsession_path) const @@ -208,7 +215,7 @@ void DirBackendFixedSize::SwitchSubsessionInto (const fs::path& subsession_path) const auto image_path = GetImagePathFromSubsessionPath(subsession_path); if (OS::is_mountpoint(subsession_path)) { - LOGW("Session image already mounted (maybe earlier sessiond instance died?), reusing"); + LOGI("Session image already mounted at %s, reusing", subsession_path.c_str()); return; }