Skip to content

Commit

Permalink
inotify: fix coalesce duplicate events into a single event in special…
Browse files Browse the repository at this point in the history
… case

If we do rename a dir entry, like this:

  rename("/tmp/ino7UrgoJ.rename1", "/tmp/ino7UrgoJ.rename2")
  rename("/tmp/ino7UrgoJ.rename2", "/tmp/ino7UrgoJ")

The duplicate events should be coalesced into a single event. But those two
events do not be coalesced into a single event, due to some bad check in
event_compare(). It can not match the two NULL inodes as the same event.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
  • Loading branch information
Wei Yongjun authored and Eric Paris committed Oct 18, 2009
1 parent cdc321f commit 3de0ef4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/notify/notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new
/* 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 &&
if (!old->name_len ||
!strcmp(old->file_name, new->file_name))
return true;
break;
Expand Down

0 comments on commit 3de0ef4

Please sign in to comment.