Bugzilla – Attachment 61968 Details for
Bug 131322
inotify support broken
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
updated version of the inotify-updates patch
inotify-updates.patch (text/plain), 4.60 KB, created by
Robert Love
on 2006-01-04 20:59:54 UTC
(
hide
)
Description:
updated version of the inotify-updates patch
Filename:
MIME Type:
Creator:
Robert Love
Created:
2006-01-04 20:59:54 UTC
Size:
4.60 KB
patch
obsolete
> >Inotify updates. > > fs/dcache.c | 3 ++- > fs/inotify.c | 17 ++++++++++++++++- > fs/xattr.c | 2 ++ > include/linux/idr.h | 9 ++++++++- > include/linux/inotify.h | 1 + > lib/idr.c | 13 +++++++++++++ > 6 files changed, 42 insertions(+), 3 deletions(-) > >--- linux-2.6.13/fs/dcache.c 2005-08-28 19:41:01.000000000 -0400 >+++ linux/fs/dcache.c 2005-12-14 14:58:07.000000000 -0500 >@@ -102,7 +102,8 @@ > list_del_init(&dentry->d_alias); > spin_unlock(&dentry->d_lock); > spin_unlock(&dcache_lock); >- fsnotify_inoderemove(inode); >+ if (!inode->i_nlink) >+ fsnotify_inoderemove(inode); > if (dentry->d_op && dentry->d_op->d_iput) > dentry->d_op->d_iput(dentry, inode); > else >--- linux-2.6.13/fs/inotify.c 2005-08-28 19:41:01.000000000 -0400 >+++ linux/fs/inotify.c 2005-12-14 14:58:08.000000000 -0500 >@@ -37,6 +37,7 @@ > #include <asm/ioctls.h> > > static atomic_t inotify_cookie; >+static atomic_t inotify_watches; > > static kmem_cache_t *watch_cachep; > static kmem_cache_t *event_cachep; >@@ -175,6 +176,7 @@ > if (atomic_dec_and_test(&dev->count)) { > atomic_dec(&dev->user->inotify_devs); > free_uid(dev->user); >+ idr_destroy(&dev->idr); > kfree(dev); > } > } >@@ -422,6 +424,7 @@ > get_inotify_watch(watch); > > atomic_inc(&dev->user->inotify_watches); >+ atomic_inc(&inotify_watches); > > return watch; > } >@@ -454,6 +457,7 @@ > list_del(&watch->d_list); > > atomic_dec(&dev->user->inotify_watches); >+ atomic_dec(&inotify_watches); > idr_remove(&dev->idr, watch->wd); > put_inotify_watch(watch); > } >@@ -532,6 +536,9 @@ > struct dentry *parent; > struct inode *inode; > >+ if (!atomic_read (&inotify_watches)) >+ return; >+ > spin_lock(&dentry->d_lock); > parent = dentry->d_parent; > inode = parent->d_inode; >@@ -925,6 +932,7 @@ > struct nameidata nd; > struct file *filp; > int ret, fput_needed; >+ int mask_add = 0; > > filp = fget_light(fd, &fput_needed); > if (unlikely(!filp)) >@@ -947,6 +955,9 @@ > down(&inode->inotify_sem); > down(&dev->sem); > >+ if (mask & IN_MASK_ADD) >+ mask_add = 1; >+ > /* don't let user-space set invalid bits: we don't want flags set */ > mask &= IN_ALL_EVENTS; > if (unlikely(!mask)) { >@@ -960,7 +971,10 @@ > */ > old = inode_find_dev(inode, dev); > if (unlikely(old)) { >- old->mask = mask; >+ if (mask_add) >+ old->mask |= mask; >+ else >+ old->mask = mask; > ret = old->wd; > goto out; > } >@@ -1043,6 +1057,7 @@ > inotify_max_user_watches = 8192; > > atomic_set(&inotify_cookie, 0); >+ atomic_set(&inotify_watches, 0); > > watch_cachep = kmem_cache_create("inotify_watch_cache", > sizeof(struct inotify_watch), >--- linux-2.6.13/fs/xattr.c 2005-08-28 19:41:01.000000000 -0400 >+++ linux/fs/xattr.c 2005-12-14 14:58:09.000000000 -0500 >@@ -307,6 +326,8 @@ > down(&d->d_inode->i_sem); > error = d->d_inode->i_op->removexattr(d, kname); > up(&d->d_inode->i_sem); >+ if (!error) >+ fsnotify_xattr(d); > } > out: > return error; >--- linux-2.6.13/include/linux/inotify.h 2005-08-28 19:41:01.000000000 -0400 >+++ linux/include/linux/inotify.h 2005-10-27 20:02:08.000000000 -0400 >@@ -47,6 +47,7 @@ > #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ > > /* special flags */ >+#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */ > #define IN_ISDIR 0x40000000 /* event occurred against dir */ > #define IN_ONESHOT 0x80000000 /* only send event once */ > >--- linux-2.6.13/lib/idr.c 2005-08-28 19:41:01.000000000 -0400 >+++ linux/lib/idr.c 2006-01-03 15:44:31.000000000 -0500 >@@ -346,6 +345,19 @@ > EXPORT_SYMBOL(idr_remove); > > /** >+ * idr_destroy - release all cached layers within an idr tree >+ * idp: idr handle >+ */ >+void idr_destroy(struct idr *idp) >+{ >+ while (idp->id_free_cnt) { >+ struct idr_layer *p = alloc_layer(idp); >+ kmem_cache_free(idr_layer_cache, p); >+ } >+} >+EXPORT_SYMBOL(idr_destroy); >+ >+/** > * idr_find - return pointer for given id > * @idp: idr handle > * @id: lookup key >--- linux-2.6.13/include/linux/idr.h 2005-08-28 19:41:01.000000000 -0400 >+++ linux/include/linux/idr.h 2006-01-03 15:44:31.000000000 -0500 >@@ -8,6 +8,10 @@ > * Small id to pointer translation service avoiding fixed sized > * tables. > */ >+ >+#ifndef __IDR_H__ >+#define __IDR_H__ >+ > #include <linux/types.h> > #include <linux/bitops.h> > >@@ -71,8 +75,11 @@ > */ > > void *idr_find(struct idr *idp, int id); >-int idr_pre_get(struct idr *idp, unsigned gfp_mask); >+int idr_pre_get(struct idr *idp, unsigned gfp_mask); > int idr_get_new(struct idr *idp, void *ptr, int *id); > int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id); > void idr_remove(struct idr *idp, int id); >+void idr_destroy(struct idr *idp); > void idr_init(struct idr *idp); >+ >+#endif /* __IDR_H__ */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 131322
:
55935
|
56009
|
60580
| 61968