linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the fsnotify tree with Linus' tree
@ 2010-10-28  1:38 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2010-10-28  1:38 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-next, linux-kernel, Christoph Hellwig, Al Viro

Hi Eric,

Today's linux-next merge of the fsnotify tree got a conflict in
fs/notify/fsnotify.c between commit
4d4eb36679adbdd75495e1bbfe7ac40e4ae41dea ("fsnotify: use dget_parent")
from Linus' tree and commit b14be22c572d5d98e2ffebf63e2d1aa1f088875b
("fsnotify: call fsnotify_parent in perm events") from the fsnotify tree.

Just context changes.  I fixed it up (see below) and can carry the fix as
necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/notify/fsnotify.c
index 4498a20,f3f6aa7..0000000
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@@ -88,32 -88,58 +88,35 @@@ int __fsnotify_parent(struct path *path
  {
  	struct dentry *parent;
  	struct inode *p_inode;
 -	bool send = false;
 -	bool should_update_children = false;
+ 	int ret = 0;
  
  	if (!dentry)
  		dentry = path->dentry;
  
  	if (!(dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED))
- 		return;
+ 		return 0;
  
 -	spin_lock(&dentry->d_lock);
 -	parent = dentry->d_parent;
 +	parent = dget_parent(dentry);
  	p_inode = parent->d_inode;
  
 -	if (fsnotify_inode_watches_children(p_inode)) {
 -		if (p_inode->i_fsnotify_mask & mask) {
 -			dget(parent);
 -			send = true;
 -		}
 -	} else {
 -		/*
 -		 * The parent doesn't care about events on it's children but
 -		 * at least one child thought it did.  We need to run all the
 -		 * children and update their d_flags to let them know p_inode
 -		 * doesn't care about them any more.
 -		 */
 -		dget(parent);
 -		should_update_children = true;
 -	}
 -
 -	spin_unlock(&dentry->d_lock);
 -
 -	if (send) {
 +	if (unlikely(!fsnotify_inode_watches_children(p_inode)))
 +		__fsnotify_update_child_dentry_flags(p_inode);
 +	else if (p_inode->i_fsnotify_mask & mask) {
  		/* we are notifying a parent so come up with the new mask which
  		 * specifies these are events which came from a child. */
  		mask |= FS_EVENT_ON_CHILD;
  
  		if (path)
- 			fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH,
- 				 dentry->d_name.name, 0);
+ 			ret = fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH,
+ 				       dentry->d_name.name, 0);
  		else
- 			fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE,
- 				 dentry->d_name.name, 0);
+ 			ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE,
+ 				       dentry->d_name.name, 0);
 -		dput(parent);
  	}
  
 -	if (unlikely(should_update_children)) {
 -		__fsnotify_update_child_dentry_flags(p_inode);
 -		dput(parent);
 -	}
 +	dput(parent);
+ 
+ 	return ret;
  }
  EXPORT_SYMBOL_GPL(__fsnotify_parent);
  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the fsnotify tree with Linus' tree
@ 2012-08-22  4:02 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2012-08-22  4:02 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-next, linux-kernel, Lino Sanfilippo, Miklos Szeredi

[-- Attachment #1: Type: text/plain, Size: 1741 bytes --]

Hi Eric,

Today's linux-next merge of the fsnotify tree got a conflict in
kernel/audit_tree.c between commits a2140fc0cb03 ("audit: fix refcounting
in audit-tree") and b3e8692b4dde ("audit: clean up refcounting in
audit-tree") from Linus' tree and commit 3c183c233284 ("fsnotify: pass
group to fsnotify_destroy_mark()") from the fsnotify tree.

Just context changes. I fixed it up (see below) and can carry the fix as
necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc kernel/audit_tree.c
index ed206fd,9cedf31..0000000
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@@ -249,7 -249,8 +249,7 @@@ static void untag_chunk(struct node *p
  		list_del_rcu(&chunk->hash);
  		spin_unlock(&hash_lock);
  		spin_unlock(&entry->lock);
- 		fsnotify_destroy_mark(entry);
+ 		fsnotify_destroy_mark(entry, audit_tree_group);
 -		fsnotify_put_mark(entry);
  		goto out;
  	}
  
@@@ -291,8 -292,8 +291,8 @@@
  		owner->root = new;
  	spin_unlock(&hash_lock);
  	spin_unlock(&entry->lock);
- 	fsnotify_destroy_mark(entry);
+ 	fsnotify_destroy_mark(entry, audit_tree_group);
 -	fsnotify_put_mark(entry);
 +	fsnotify_put_mark(&new->mark);	/* drop initial reference */
  	goto out;
  
  Fallback:
@@@ -443,9 -443,9 +443,9 @@@ static int tag_chunk(struct inode *inod
  	spin_unlock(&hash_lock);
  	spin_unlock(&chunk_entry->lock);
  	spin_unlock(&old_entry->lock);
- 	fsnotify_destroy_mark(old_entry);
+ 	fsnotify_destroy_mark(old_entry, audit_tree_group);
 +	fsnotify_put_mark(chunk_entry);	/* drop initial reference */
  	fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */
 -	fsnotify_put_mark(old_entry); /* and kill it */
  	return 0;
  }
  

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the fsnotify tree with Linus' tree
@ 2010-03-15  2:41 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2010-03-15  2:41 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-next, linux-kernel, Dave Young

Hi Eric,

Today's linux-next merge of the fsnotify tree got a conflict in
kernel/sysctl.c between commits 5ed109103d73b0bafc92e860cead56725231384d
("sysctl extern cleanup: module") and
15485a4682d1d3bfee2aa78b4b1a5d36f5746b64 ("sysctl extern cleanup: sg")
from Linus' tree and commit 00e4382acdbe8337cd00d3ed74a6150f0a647d1f
("sysctl extern cleanup: inotify") from the fsnotify tree.

Just context changes.  I fixed it up (see below) and can carry the fix
for a while.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc kernel/sysctl.c
index 8686b0f,a7a3634..0000000
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@@ -128,6 -120,17 +129,10 @@@ static int min_percpu_pagelist_fract = 
  
  static int ngroups_max = NGROUPS_MAX;
  
 -#ifdef CONFIG_MODULES
 -extern char modprobe_path[];
 -extern int modules_disabled;
 -#endif
+ #ifdef CONFIG_INOTIFY_USER
+ #include <linux/inotify.h>
+ #endif
 -#ifdef CONFIG_CHR_DEV_SG
 -extern int sg_big_buff;
 -#endif
+ 
  #ifdef CONFIG_SPARC
  #include <asm/system.h>
  #endif

^ permalink raw reply	[flat|nested] 4+ messages in thread

* linux-next: manual merge of the fsnotify tree with Linus' tree
@ 2009-08-18  5:17 Stephen Rothwell
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2009-08-18  5:17 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-next, linux-kernel

Hi Eric,

Today's linux-next merge of the fsnotify tree got conflicts in
fs/notify/inotify/inotify_fsnotify.c, fs/notify/inotify/inotify_user.c
and fs/notify/notification.c between commits
eef3a116be11d35396efb2a8cc7345fd3221e294 ("notify: unused event private
race") and cd94c8bbef8d4b796a7ed4c551355a334604fd36 ("inotify: tail drop
inotify q_overflow events") from Linus' tree and commits
7bf357aac07084acfac5f0e746aca85c42cc046e ("fsnotify: use
fsnotify_create_event to allocate the q_overflow event"),
cddf930f6410692ba1db0c53753492d119b1bd55 ("fsnotify: allow notification
requests to not include private data") and
7f51531a261beb6be2071f4345482ac488eea734 ("fsnotify: per group
notification queue merge types") from the fsnotify tree.

I fixed it up as best I can (see below) and can carry the fixes as
necessary.
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/notify/inotify/inotify_fsnotify.c
index 5dcbafe,133f080..0000000
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@@ -31,6 -31,56 +31,60 @@@
  
  #include "inotify.h"
  
+ /*
+  * Check if 2 events contain the same information.  We do not compare private data
+  * but at this moment that isn't a problem for any know fsnotify listeners.
+  */
+ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new)
+ {
+ 	if ((old->mask == new->mask) &&
+ 	    (old->to_tell == new->to_tell) &&
+ 	    (old->data_type == new->data_type) &&
+ 	    (old->name_len == new->name_len)) {
+ 		switch (old->data_type) {
+ 		case (FSNOTIFY_EVENT_INODE):
+ 			/* remember, after old was put on the wait_q we aren't
+ 			 * allowed to look at the inode any more, only thing
+ 			 * left to check was if the file_name is the same */
+ 			if (old->name_len &&
+ 			    !strcmp(old->file_name, new->file_name))
+ 				return true;
+ 			break;
+ 		case (FSNOTIFY_EVENT_PATH):
+ 			if ((old->path.mnt == new->path.mnt) &&
+ 			    (old->path.dentry == new->path.dentry))
+ 				return true;
+ 			break;
+ 		case (FSNOTIFY_EVENT_NONE):
++			if (old->mask & FS_Q_OVERFLOW)
++				return true;
++			else if (old->mask & FS_IN_IGNORED)
++				return false;
+ 			return true;
+ 		};
+ 	}
+ 	return false;
+ }
+ 
+ static int inotify_merge(struct list_head *list, struct fsnotify_event *event)
+ {
+ 	struct fsnotify_event_holder *last_holder;
+ 	struct fsnotify_event *last_event;
+ 	int ret = 0;
+ 
+ 	/* and the list better be locked by something too */
+ 	spin_lock(&event->lock);
+ 
+ 	last_holder = list_entry(list->prev, struct fsnotify_event_holder, event_list);
+ 	last_event = last_holder->event;
+ 	if (event_compare(last_event, event))
+ 		ret = -EEXIST;
+ 
+ 	spin_unlock(&event->lock);
+ 
+ 	return ret;
+ }
+ 
  static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_event *event)
  {
  	struct fsnotify_mark_entry *entry;
@@@ -61,15 -111,14 +115,15 @@@
  	fsn_event_priv->group = group;
  	event_priv->wd = wd;
  
- 	ret = fsnotify_add_notify_event(group, event, fsn_event_priv);
+ 	ret = fsnotify_add_notify_event(group, event, fsn_event_priv, inotify_merge);
 -	/* EEXIST is not an error */
 -	if (ret == -EEXIST)
 -		ret = 0;
 -
 -	/* did event_priv get attached? */
 -	if (list_empty(&fsn_event_priv->event_list))
 +	if (ret) {
  		inotify_free_event_priv(fsn_event_priv);
 +		/* EEXIST says we tail matched, EOVERFLOW isn't something
 +		 * to report up the stack. */
 +		if ((ret == -EEXIST) ||
 +		    (ret == -EOVERFLOW))
 +			ret = 0;
 +	}
  
  	/*
  	 * If we hold the entry until after the event is on the queue
diff --cc fs/notify/inotify/inotify_user.c
index dc32ed8,d5e78f6..0000000
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@@ -405,8 -401,10 +402,8 @@@ void inotify_ignored_and_remove_idr(str
  	fsn_event_priv->group = group;
  	event_priv->wd = ientry->wd;
  
- 	ret = fsnotify_add_notify_event(group, ignored_event, fsn_event_priv);
 -	fsnotify_add_notify_event(group, ignored_event, fsn_event_priv, NULL);
 -
 -	/* did the private data get added? */
 -	if (list_empty(&fsn_event_priv->event_list))
++	ret = fsnotify_add_notify_event(group, ignored_event, fsn_event_priv, NULL);
 +	if (ret)
  		inotify_free_event_priv(fsn_event_priv);
  
  skip_send_ignore:
diff --cc fs/notify/notification.c
index 3816d57,4f69b6f..0000000
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@@ -173,9 -140,10 +140,7 @@@ int fsnotify_add_notify_event(struct fs
  {
  	struct fsnotify_event_holder *holder = NULL;
  	struct list_head *list = &group->notification_list;
- 	struct fsnotify_event_holder *last_holder;
- 	struct fsnotify_event *last_event;
 -
 -	/* easy to tell if priv was attached to the event */
 -	if (priv)
 -		INIT_LIST_HEAD(&priv->event_list);
 +	int ret = 0;
  
  	/*
  	 * There is one fsnotify_event_holder embedded inside each fsnotify_event.
@@@ -195,8 -163,7 +160,8 @@@ alloc_holder
  	mutex_lock(&group->notification_mutex);
  
  	if (group->q_len >= group->max_events) {
- 		event = &q_overflow_event;
+ 		event = q_overflow_event;
 +		ret = -EOVERFLOW;
  		/* sorry, no private data on the overflow event */
  		priv = NULL;
  	}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-22  4:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28  1:38 linux-next: manual merge of the fsnotify tree with Linus' tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2012-08-22  4:02 Stephen Rothwell
2010-03-15  2:41 Stephen Rothwell
2009-08-18  5:17 Stephen Rothwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).