mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 02:53:36 +02:00
mm/damon/sysfs-scheme: cleanup quotas subdirs on scheme dir setup failure
When a DAMOS-scheme DAMON sysfs directory setup fails after setup of
quotas/ directory, subdirectories of quotas/ directory are not cleaned up.
As a result, DAMON sysfs interface is nearly broken until the system
reboots, and the memory for the unremoved directory is leaked.
Cleanup the directories under such failures.
Link: https://lkml.kernel.org/r/20251225023043.18579-4-sj@kernel.org
Fixes: 1b32234ab0 ("mm/damon/sysfs: support DAMOS watermarks")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: chongjiapeng <jiapeng.chong@linux.alibaba.com>
Cc: <stable@vger.kernel.org> # 5.18.x
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
9814cc832b
commit
dc7e1d75fd
|
|
@ -2158,7 +2158,7 @@ static int damon_sysfs_scheme_add_dirs(struct damon_sysfs_scheme *scheme)
|
|||
goto put_dests_out;
|
||||
err = damon_sysfs_scheme_set_watermarks(scheme);
|
||||
if (err)
|
||||
goto put_quotas_access_pattern_out;
|
||||
goto rmdir_put_quotas_access_pattern_out;
|
||||
err = damos_sysfs_set_filter_dirs(scheme);
|
||||
if (err)
|
||||
goto put_watermarks_quotas_access_pattern_out;
|
||||
|
|
@ -2183,7 +2183,8 @@ static int damon_sysfs_scheme_add_dirs(struct damon_sysfs_scheme *scheme)
|
|||
put_watermarks_quotas_access_pattern_out:
|
||||
kobject_put(&scheme->watermarks->kobj);
|
||||
scheme->watermarks = NULL;
|
||||
put_quotas_access_pattern_out:
|
||||
rmdir_put_quotas_access_pattern_out:
|
||||
damon_sysfs_quotas_rm_dirs(scheme->quotas);
|
||||
kobject_put(&scheme->quotas->kobj);
|
||||
scheme->quotas = NULL;
|
||||
put_dests_out:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user