From e9bbfbd2934d918b528f2bc08cdac1ee2230a437 Mon Sep 17 00:00:00 2001 From: Milind Changire Date: Tue, 29 Nov 2022 13:24:27 +0530 Subject: [PATCH] mgr/snap_schedule: add debug log for missing or wrong path Bad paths cause a Traceback to be dumped in the logs and unloads the module causing denial of service. Fixes: https://tracker.ceph.com/issues/58095 Signed-off-by: Milind Changire (cherry picked from commit c689548694a138cfc87c4ad8aa5ea67789da11bb) --- src/pybind/mgr/snap_schedule/fs/schedule_client.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/snap_schedule/fs/schedule_client.py b/src/pybind/mgr/snap_schedule/fs/schedule_client.py index 1fc3217ec7d2..fae4491bdd9e 100644 --- a/src/pybind/mgr/snap_schedule/fs/schedule_client.py +++ b/src/pybind/mgr/snap_schedule/fs/schedule_client.py @@ -276,6 +276,7 @@ class SnapSchedClient(CephfsClient): start: str, repeat: str) -> None: log.debug(f'Scheduled snapshot of {path} triggered') + set_schedule_to_inactive = False try: with self.get_schedule_db(fs_name) as conn_mgr: db = conn_mgr.dbinfo.db @@ -294,13 +295,22 @@ class SnapSchedClient(CephfsClient): log.info(f'created scheduled snapshot of {path}') log.debug(f'created scheduled snapshot {snap_name}') sched.update_last(time, db) + except cephfs.ObjectNotFound: + # maybe path is missing or wrong + self._log_exception('create_scheduled_snapshot') + log.debug(f'path {path} is probably missing or wrong; ' + 'remember to strip off the mount point path ' + 'prefix to provide the correct path') + set_schedule_to_inactive = True except cephfs.Error: self._log_exception('create_scheduled_snapshot') - sched.set_inactive(db) except Exception: # catch all exceptions cause otherwise we'll never know since this # is running in a thread self._log_exception('create_scheduled_snapshot') + finally: + if set_schedule_to_inactive: + sched.set_inactive(db) finally: with self.get_schedule_db(fs_name) as conn_mgr: db = conn_mgr.dbinfo.db -- 2.47.3