Re: 2.6.11-rc4-mm1

From: Mathieu Segaud
Date: Wed Feb 23 2005 - 06:04:59 EST


Andrew Morton <akpm@xxxxxxxx> disait derniÃrement que :

> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11-rc4/2.6.11-rc4-mm1/
>
>
> - Various fixes and updates all over the place. Things seem to have slowed
> down a bit.
>
> - Last, final, ultimate call: if anyone has patches in here which are 2.6.11
> material, please tell me.
>
>
>
> Changes since 2.6.11-rc3-mm1:

[snip]

> +inotify.patch
>
> Not sure if this is the latest version.

it is the latest Robert Love posted against -mm kernels, but in
inotify_ignore():

static int inotify_ignore(struct inotify_device *dev, s32 wd)
{
struct inotify_watch *watch;
int ret = 0;

spin_lock(&dev->lock);
watch = dev_find_wd(dev, wd);
spin_unlock(&dev->lock); <------------- lock is released, but
if (!watch) {
ret = -EINVAL;
goto out;
}
__remove_watch(watch, dev); <---------- must be called with lock held

out:
spin_unlock(&dev->lock); <------------- anyway, lock is
return ret; released and sub_preempt_count
} BUG's on SMP and PREEMPT


__remove_watch() must be called with ->lock held on dev.
Anyway, ->lock is released after label out.

Signed-off-by: Mathieu Segaud <matt@xxxxxxxxxxxxxxxx>

--- a/drivers/char/inotify.c 2005-02-23 11:55:21.321385752 +0100
+++ b/drivers/char/inotify.c 2005-02-23 11:55:29.772101048 +0100
@@ -952,7 +952,7 @@

spin_lock(&dev->lock);
watch = dev_find_wd(dev, wd);
- spin_unlock(&dev->lock);
+
if (!watch) {
ret = -EINVAL;
goto out;


--
> Can you explain this behaviour?

Yes
--
Alan

[Oh wait you want to know why...]

- Alan Cox on linux-kernel