* [PATCH 1/4] fsnotify: move events should indicate the event was on a child
@ 2009-06-01 20:03 Eric Paris
2009-06-01 20:03 ` [PATCH 2/4] dnotify: do not use ?true:false when assigning to a bool Eric Paris
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Paris @ 2009-06-01 20:03 UTC (permalink / raw)
To: linux-kernel; +Cc: viro, hch, eparis
fsnotify tells its listeners explicitly when an event happened on the given
inode verses on the child of the given inode. (see __fsnotify_parent)
However, the semantics of fsnotify_move() are such that we deliver events
directly to the two parent directories in question (old_dir and new_dir)
directly without using the __fsnotify_parent() call. fsnotify should be
adding FS_EVENT_ON_CHILD for the notifications to these parents.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
include/linux/fsnotify.h | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index bdf626b..c2e8066 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -83,12 +83,11 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
struct inode *source = moved->d_inode;
u32 in_cookie = inotify_get_cookie();
u32 fs_cookie = fsnotify_get_cookie();
- __u32 old_dir_mask = 0;
- __u32 new_dir_mask = 0;
+ __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
+ __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);
- if (old_dir == new_dir) {
- old_dir_mask = FS_DN_RENAME;
- }
+ if (old_dir == new_dir)
+ old_dir_mask |= FS_DN_RENAME;
if (isdir) {
isdir = IN_ISDIR;
@@ -96,9 +95,6 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
new_dir_mask |= FS_IN_ISDIR;
}
- old_dir_mask |= FS_MOVED_FROM;
- new_dir_mask |= FS_MOVED_TO;
-
inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir, in_cookie, old_name,
source);
inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, in_cookie, new_name,
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/4] dnotify: do not use ?true:false when assigning to a bool
2009-06-01 20:03 [PATCH 1/4] fsnotify: move events should indicate the event was on a child Eric Paris
@ 2009-06-01 20:03 ` Eric Paris
2009-06-01 20:03 ` [PATCH 3/4] dnotify: do not bother to lock entry->lock when reading mask Eric Paris
2009-06-01 20:03 ` [PATCH 4/4] inotify/dnotify: should_send_event shouldn't match on FS_EVENT_ON_CHILD Eric Paris
2 siblings, 0 replies; 4+ messages in thread
From: Eric Paris @ 2009-06-01 20:03 UTC (permalink / raw)
To: linux-kernel; +Cc: viro, hch, eparis
dnotify_should send event assigned a bool using ?true:false when computing
a bit operation. This is poitless and the bool type does this for us.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/dnotify/dnotify.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index 12f9e6b..5134e89 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -154,7 +154,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,
return false;
spin_lock(&entry->lock);
- send = (mask & entry->mask) ? true : false;
+ send = (mask & entry->mask);
spin_unlock(&entry->lock);
fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/4] dnotify: do not bother to lock entry->lock when reading mask
2009-06-01 20:03 [PATCH 1/4] fsnotify: move events should indicate the event was on a child Eric Paris
2009-06-01 20:03 ` [PATCH 2/4] dnotify: do not use ?true:false when assigning to a bool Eric Paris
@ 2009-06-01 20:03 ` Eric Paris
2009-06-01 20:03 ` [PATCH 4/4] inotify/dnotify: should_send_event shouldn't match on FS_EVENT_ON_CHILD Eric Paris
2 siblings, 0 replies; 4+ messages in thread
From: Eric Paris @ 2009-06-01 20:03 UTC (permalink / raw)
To: linux-kernel; +Cc: viro, hch, eparis
entry->lock is needed to make sure entry->mask does not change while
manipulating it. In dnotify_should_send_event() we don't care if we get an
old or a new mask value out of this entry so there is no point it taking
the lock.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/dnotify/dnotify.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index 5134e89..ec459b6 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -153,9 +153,8 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,
if (!entry)
return false;
- spin_lock(&entry->lock);
send = (mask & entry->mask);
- spin_unlock(&entry->lock);
+
fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */
return send;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 4/4] inotify/dnotify: should_send_event shouldn't match on FS_EVENT_ON_CHILD
2009-06-01 20:03 [PATCH 1/4] fsnotify: move events should indicate the event was on a child Eric Paris
2009-06-01 20:03 ` [PATCH 2/4] dnotify: do not use ?true:false when assigning to a bool Eric Paris
2009-06-01 20:03 ` [PATCH 3/4] dnotify: do not bother to lock entry->lock when reading mask Eric Paris
@ 2009-06-01 20:03 ` Eric Paris
2 siblings, 0 replies; 4+ messages in thread
From: Eric Paris @ 2009-06-01 20:03 UTC (permalink / raw)
To: linux-kernel; +Cc: viro, hch, eparis
inotify and dnotify will both indicate that they want any event which came
from a child inode. The fix is to mask off FS_EVENT_ON_CHILD when deciding
if inotify or dnotify is interested in a given event.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/dnotify/dnotify.c | 1 +
fs/notify/inotify/inotify_fsnotify.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index ec459b6..98a7516 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -153,6 +153,7 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,
if (!entry)
return false;
+ mask = (mask & ~FS_EVENT_ON_CHILD);
send = (mask & entry->mask);
fsnotify_put_mark(entry); /* matches fsnotify_find_mark_entry */
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 160da54..7ef75b8 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -95,6 +95,7 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
if (!entry)
return false;
+ mask = (mask & ~FS_EVENT_ON_CHILD);
send = (entry->mask & mask);
/* find took a reference */
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-01 20:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-01 20:03 [PATCH 1/4] fsnotify: move events should indicate the event was on a child Eric Paris
2009-06-01 20:03 ` [PATCH 2/4] dnotify: do not use ?true:false when assigning to a bool Eric Paris
2009-06-01 20:03 ` [PATCH 3/4] dnotify: do not bother to lock entry->lock when reading mask Eric Paris
2009-06-01 20:03 ` [PATCH 4/4] inotify/dnotify: should_send_event shouldn't match on FS_EVENT_ON_CHILD Eric Paris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome