Re: [PATCHSET] sysfs: implement sysfs_remove()

From: Eric W. Biederman
Date: Thu Sep 19 2013 - 13:05:40 EST



I am running from memory right now. But the short version is.

Al Viro has complained about the sysfs removal antics of sysfs, and
I have seen Al get confused and "fix" filesystems that depart too far
from normal filesystem semantics.

I have gone down this path both ways and "rm -rf" semantics are horrible
and cause real bugs in the kernel at the boundaries between devices.
"rm -rf" semantics are also horrible because no sanity checks can be
performed.

Normal "unlink/rmdir" semantics are absolutely achievable including
not allowing children to be removed before their parents with just
a few bug fixes to the kernel. I ran out of energy before I could
track down and make those bug fixes which is why things are left
in the current state. And now we don't need any more boiler plate
to get there, the current primary interfaces to sysfs remember all of
the filenames.

The fact we actually need to allow parents to be deleted before their
children today to support pci is absoltuely broken. It is a simple
matter of code bugs. The device tree semantics are tree semantics not
random order semantics.

I will aim to take a second look when I can spend a little more time
and give you more concrete reasons (other than the old NAK from Viro)
about why recursive sysfs directory removal can cause real bugs. It is
just subtle enough I can't remember the set of the problems in detail
and a quick look at the code is not enough to remind me. But I have run
into real issues with even the limited recursive remvoval that sysfs
does today.

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/