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 (-2 / +17 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 370-376 Link Here
370
	if (error)
372
	if (error)
371
		return error;
373
		return error;
372
	/* you can only watch an inode if you have read permissions on it */
374
	/* you can only watch an inode if you have read permissions on it */
373
	error = permission(nd->dentry->d_inode, MAY_READ, NULL);
375
	error = vfs_permission(nd, MAY_READ);
374
	if (error) 
376
	if (error) 
375
		path_release(nd);
377
		path_release(nd);
376
	return error;
378
	return error;
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

Return to bug 131322