Re: [discuss] Re: [PATCH] fs/compat.c: rwsem instead of BKL around ioctl32_hash_table

Roland Dreier
2004-09-03T14:57:31Z

Andi> The BKL couldn't protect again removal of sleeping compat
Andi> handlers anyways because the BKL is dropped during a
Andi> schedule, and they all can sleep in user accesses. During
Andi> this scheduling window the module could be unloaded if its
Andi> count was zero. But with the assumption above this cannot
Andi> happen.

Andi> So basically the locking there is not to protect against
Andi> running handlers, just to ensure consistency during the list
Andi> walking. The list isn't touched anymore after the compat
Andi> handler runs, so the sleeping in there is no problem.

Andi> RCU could be used as well to protect the list because there
Andi> is no sleep involved.

OK, good point. My logic was wrong when I considered RCU. But now I
don't understand what you meant by "it cannot work" when you wrote
this in your previous email:

Andi> If you wanted to fix it properly better make it use RCU -
Andi> but it cannot work for the case of calling a compat handler.

Based on what you just wrote, it seems to me like RCU would actually
work fine. Is this wrong?

Thanks,
Roland