diff -urpN linux-source-2.6.18.orig/fs/dnotify.c linux-source-2.6.18/fs/dnotify.c --- linux-source-2.6.18.orig/fs/dnotify.c 2006-09-19 21:42:06.000000000 -0600 +++ linux-source-2.6.18/fs/dnotify.c 2008-04-09 13:50:42.000000000 -0600 @@ -20,6 +20,7 @@ #include #include #include +#include int dir_notify_enable __read_mostly = 1; @@ -92,6 +93,10 @@ int fcntl_dirnotify(int fd, struct file prev = &odn->dn_next; } + /* we'd lost the race with close(), sod off silently */ + if (fcheck(fd) != filp) + goto out_free; + error = f_setown(filp, current->pid, 0); if (error) goto out_free;