mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
mm/damon/sysfs: propagate damon_call() error in turn_damon_on
damon_sysfs_turn_damon_on() ignored the return value of damon_call() for the repeat call control registration and always returned the stale result of damon_start() (0 at that point). When damon_call() fails, e.g., the kdamond is already exiting, the user still gets success from the state file write while monitoring is not actually on. Save and return the damon_call() result instead. No rollback of damon_start() is needed since a failed damon_call() guarantees the context is stopped. Link: https://lore.kernel.org/20260921151547.78472-3-sj@kernel.org Signed-off-by: Xuewen Wang <wangxuewen@kylinos.cn> Signed-off-by: SJ Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: SJ Park <sj@kernel.org> Cc: Adrian Huang <adrianhuang0701@gmail.com> Cc: Karthikeyan KS <karthiproffesional@gmail.com> Cc: Liew Rui Yan <aethernet65535@gmail.com> Cc: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
This commit is contained in:
parent
a9799d2d24
commit
639b0cca7d
|
|
@ -2607,7 +2607,8 @@ static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond)
|
|||
repeat_call_control->data = kdamond;
|
||||
repeat_call_control->repeat = true;
|
||||
repeat_call_control->dealloc_on_cancel = true;
|
||||
if (damon_call(ctx, repeat_call_control))
|
||||
err = damon_call(ctx, repeat_call_control);
|
||||
if (err)
|
||||
kfree(repeat_call_control);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user