Re: [PATCH v2] mm/damon/dbgfs: avoid duplicate context directory creation

From: Bagas Sanjaya
Date: Fri Aug 19 2022 - 22:29:38 EST


On 8/20/22 00:19, SeongJae Park wrote:
> From: Badari Pulavarty <badari.pulavarty@xxxxxxxxx>
>
> When user tries to create a DAMON context via the DAMON debugfs
> interface with a name of an already existing context, the context
> directory creation silently fails but the context is added in the
> internal data structure. As a result, memory could leak and DAMON
> cannot be turned on. An example test case is as below:
>
> # cd /sys/kernel/debug/damon/
> # echo "off" > monitor_on
> # echo paddr > target_ids
> # echo "abc" > mk_context
> # echo "abc" > mk_context
> # echo $$ > abc/target_ids
> # echo "on" > monitor_on <<< fails
>
> This commit fixes the issue by checking if the name already exist and
> immediately returning '-EEXIST' in the case.
>

Meh...

SJ, I have seen most (if not all of) your patches uses descriptive mood
instead of imperative. Better say "Fix the issue by checking ...".

--
An old man doll... just what I always wanted! - Clara