View | Details | Raw Unified | Return to bug 131322
Collapse All | Expand All

(-)linux-2.6.13/fs/dcache.c (-1 / +2 lines)
Lines 102-108 Link Here
102
		list_del_init(&dentry->d_alias);
102
		list_del_init(&dentry->d_alias);
103
		spin_unlock(&dentry->d_lock);
103
		spin_unlock(&dentry->d_lock);
104
		spin_unlock(&dcache_lock);
104
		spin_unlock(&dcache_lock);
105
		fsnotify_inoderemove(inode);
105
		if (!inode->i_nlink)
106
			fsnotify_inoderemove(inode);
106
		if (dentry->d_op && dentry->d_op->d_iput)
107
		if (dentry->d_op && dentry->d_op->d_iput)
107
			dentry->d_op->d_iput(dentry, inode);
108
			dentry->d_op->d_iput(dentry, inode);
108
		else
109
		else
(-)linux-2.6.13/fs/inotify.c (-1 / +16 lines)
Lines 37-42 Link Here
37
#include <asm/ioctls.h>
37
#include <asm/ioctls.h>
38
38
39
static atomic_t inotify_cookie;
39
static atomic_t inotify_cookie;
40
static atomic_t inotify_watches;
40
41
41
static kmem_cache_t *watch_cachep;
42
static kmem_cache_t *watch_cachep;
42
static kmem_cache_t *event_cachep;
43
static kmem_cache_t *event_cachep;
Lines 175-180 Link Here
175
	if (atomic_dec_and_test(&dev->count)) {
176
	if (atomic_dec_and_test(&dev->count)) {
176
		atomic_dec(&dev->user->inotify_devs);
177
		atomic_dec(&dev->user->inotify_devs);
177
		free_uid(dev->user);
178
		free_uid(dev->user);
179
		idr_destroy(&dev->idr);
178
		kfree(dev);
180
		kfree(dev);
179
	}
181
	}
180
}
182
}
Lines 422-427 Link Here
422
	get_inotify_watch(watch);
424
	get_inotify_watch(watch);
423
425
424
	atomic_inc(&dev->user->inotify_watches);
426
	atomic_inc(&dev->user->inotify_watches);
427
	atomic_inc(&inotify_watches);
425
428
426
	return watch;
429
	return watch;
427
}
430
}
Lines 454-459 Link Here
454
	list_del(&watch->d_list);
457
	list_del(&watch->d_list);
455
458
456
	atomic_dec(&dev->user->inotify_watches);
459
	atomic_dec(&dev->user->inotify_watches);
460
	atomic_dec(&inotify_watches);
457
	idr_remove(&dev->idr, watch->wd);
461
	idr_remove(&dev->idr, watch->wd);
458
	put_inotify_watch(watch);
462
	put_inotify_watch(watch);
459
}
463
}
Lines 532-537 Link Here
532
	struct dentry *parent;
536
	struct dentry *parent;
533
	struct inode *inode;
537
	struct inode *inode;
534
538
539
	if (!atomic_read (&inotify_watches))
540
		return;
541
535
	spin_lock(&dentry->d_lock);
542
	spin_lock(&dentry->d_lock);
536
	parent = dentry->d_parent;
543
	parent = dentry->d_parent;
537
	inode = parent->d_inode;
544
	inode = parent->d_inode;
Lines 925-930 Link Here
925
	struct nameidata nd;
932
	struct nameidata nd;
926
	struct file *filp;
933
	struct file *filp;
927
	int ret, fput_needed;
934
	int ret, fput_needed;
935
	int mask_add = 0;
928
936
929
	filp = fget_light(fd, &fput_needed);
937
	filp = fget_light(fd, &fput_needed);
930
	if (unlikely(!filp))
938
	if (unlikely(!filp))
Lines 947-952 Link Here
947
	down(&inode->inotify_sem);
955
	down(&inode->inotify_sem);
948
	down(&dev->sem);
956
	down(&dev->sem);
949
957
958
	if (mask & IN_MASK_ADD)
959
		mask_add = 1;
960
950
	/* don't let user-space set invalid bits: we don't want flags set */
961
	/* don't let user-space set invalid bits: we don't want flags set */
951
	mask &= IN_ALL_EVENTS;
962
	mask &= IN_ALL_EVENTS;
952
	if (unlikely(!mask)) {
963
	if (unlikely(!mask)) {
Lines 960-966 Link Here
960
	 */
971
	 */
961
	old = inode_find_dev(inode, dev);
972
	old = inode_find_dev(inode, dev);
962
	if (unlikely(old)) {
973
	if (unlikely(old)) {
963
		old->mask = mask;
974
		if (mask_add)
975
			old->mask |= mask;
976
		else
977
			old->mask = mask;
964
		ret = old->wd;
978
		ret = old->wd;
965
		goto out;
979
		goto out;
966
	}
980
	}
Lines 1043-1048 Link Here
1043
	inotify_max_user_watches = 8192;
1057
	inotify_max_user_watches = 8192;
1044
1058
1045
	atomic_set(&inotify_cookie, 0);
1059
	atomic_set(&inotify_cookie, 0);
1060
	atomic_set(&inotify_watches, 0);
1046
1061
1047
	watch_cachep = kmem_cache_create("inotify_watch_cache",
1062
	watch_cachep = kmem_cache_create("inotify_watch_cache",
1048
					 sizeof(struct inotify_watch),
1063
					 sizeof(struct inotify_watch),
(-)linux-2.6.13/fs/xattr.c (+2 lines)
Lines 307-312 Link Here
307
		down(&d->d_inode->i_sem);
326
		down(&d->d_inode->i_sem);
308
		error = d->d_inode->i_op->removexattr(d, kname);
327
		error = d->d_inode->i_op->removexattr(d, kname);
309
		up(&d->d_inode->i_sem);
328
		up(&d->d_inode->i_sem);
329
		if (!error)
330
			fsnotify_xattr(d);
310
	}
331
	}
311
out:
332
out:
312
	return error;
333
	return error;
(-)linux-2.6.13/include/linux/inotify.h (+1 lines)
Lines 47-52 Link Here
47
#define IN_MOVE			(IN_MOVED_FROM | IN_MOVED_TO) /* moves */
47
#define IN_MOVE			(IN_MOVED_FROM | IN_MOVED_TO) /* moves */
48
48
49
/* special flags */
49
/* special flags */
50
#define IN_MASK_ADD		0x20000000	/* add to the mask of an already existing watch */
50
#define IN_ISDIR		0x40000000	/* event occurred against dir */
51
#define IN_ISDIR		0x40000000	/* event occurred against dir */
51
#define IN_ONESHOT		0x80000000	/* only send event once */
52
#define IN_ONESHOT		0x80000000	/* only send event once */
52
53
(-)linux-2.6.13/lib/idr.c (+13 lines)
Lines 346-351 Link Here
346
EXPORT_SYMBOL(idr_remove);
345
EXPORT_SYMBOL(idr_remove);
347
346
348
/**
347
/**
348
 * idr_destroy - release all cached layers within an idr tree
349
 * idp: idr handle
350
 */
351
void idr_destroy(struct idr *idp)
352
{
353
	while (idp->id_free_cnt) {
354
		struct idr_layer *p = alloc_layer(idp);
355
		kmem_cache_free(idr_layer_cache, p);
356
	}
357
}
358
EXPORT_SYMBOL(idr_destroy);
359
360
/**
349
 * idr_find - return pointer for given id
361
 * idr_find - return pointer for given id
350
 * @idp: idr handle
362
 * @idp: idr handle
351
 * @id: lookup key
363
 * @id: lookup key
(-)linux-2.6.13/include/linux/idr.h (-1 / +8 lines)
Lines 8-13 Link Here
8
 * Small id to pointer translation service avoiding fixed sized
8
 * Small id to pointer translation service avoiding fixed sized
9
 * tables.
9
 * tables.
10
 */
10
 */
11
12
#ifndef __IDR_H__
13
#define __IDR_H__
14
11
#include <linux/types.h>
15
#include <linux/types.h>
12
#include <linux/bitops.h>
16
#include <linux/bitops.h>
13
17
Lines 71-78 Link Here
71
 */
75
 */
72
76
73
void *idr_find(struct idr *idp, int id);
77
void *idr_find(struct idr *idp, int id);
74
int idr_pre_get(struct idr *idp, unsigned gfp_mask);
78
int idr_pre_get(struct idr *idp, unsigned gfp_mask);
75
int idr_get_new(struct idr *idp, void *ptr, int *id);
79
int idr_get_new(struct idr *idp, void *ptr, int *id);
76
int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
80
int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
77
void idr_remove(struct idr *idp, int id);
81
void idr_remove(struct idr *idp, int id);
82
void idr_destroy(struct idr *idp);
78
void idr_init(struct idr *idp);
83
void idr_init(struct idr *idp);
84
85
#endif /* __IDR_H__ */

Return to bug 131322