Re: [PATCHSET] sysfs: implement sysfs_remove()

From: Eric W. Biederman
Date: Thu Sep 19 2013 - 06:56:38 EST


Tejun Heo <tj@xxxxxxxxxx> writes:

> Hello,
>
> Currently, there are multiple variants of internal sysfs removal
> functions and the directory removal behavior is a bit weird in that
> while it does remove the files contained immediately in the directory
> it wouldn't recurse into its subdirectories, even the group ones which
> belong to the same kobject.

There are two very big problems with this direction.
1) It violates the principle of least surprise. In particular it messes
up the mental model of people like Al Viro. Which can easily lead to
code breaking during routine maintenance because of unexpecte
semantics.

2) Recursive removal is not safe. There are very weird and somewhat
pathological cases where sysfs directories are removed out of order
aka parent before sibling, and (if my memory holds) recursive removal
takes this from a little bit ugly to actually breaking things.

For long term maintenance and simplicity I believe we will be in much
better shape if we take directory removal in the opposite direction, and
fix the small number of issues with the users and don't support any kind
of recursive removal.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/