# Re: IPv4/IPv6 sysctl unregistration deadlock

- From: Eric W. Biederman \<hidden\>
- Date: 2009-02-26 06:10:01 
- List: netdev
- Page: https://ratatoskr.run/netdev/2009/02/10818867
- Thread: https://ratatoskr.run/netdev/2009/02/10818776/t.md

```text
Herbert Xu [ref] writes:

> On Wed, Feb 25, 2009 at 08:18:47AM +0100, Patrick McHardy wrote:
>>
>> Unfortunately its more complicated than I thought because of
>> device renames, where the sysctl pointer is reused after
>> unregistration and the rename/unregistration/re-registration
>> should be atomic. Deferring unregistration means we can't perform
>> the new registration immediately unless we allow multiple
>> registrations for a single device to be active simulaneously,
>> which introduces a whole new set of problems.
>
> Good point.
>
>> Simply ignoring the request during unregistration doesn't seem
>> so bad after all, the main problem is that it intoduces a different
>> race on renames where a write to the "forwarding" file returns
>> success, but the change doesn't take effect. We could return
>> -ENOENT, but that seems a bit strange after open() returned success.
>> Maybe -EBUSY, although I would prefer to make this transparent
>> to userspace.
>
> I'd like to avoid that for the rename case just because shell
> scripts know how to deal with echo foo > /nonexist/file but not
> necessarily a failed echo on write/close.
>
>> I think I'm stuck. Will rethink it after some coffee :)
>
> Yes we need more coffee :)

How does adding a rename operation to sysctl sound?

I am a little concerned that if we have this issue with sysctl
we also have it with proc and sysfs as well.

Although I admit I don't understand it yet.

Eric


```
