Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148946424
D54336.1789245438.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D54336.1789245438.diff
View Options
diff --git a/sys/kern/vfs_inotify.c b/sys/kern/vfs_inotify.c
--- a/sys/kern/vfs_inotify.c
+++ b/sys/kern/vfs_inotify.c
@@ -723,7 +723,6 @@
}
break;
case IN_MOVED_FROM:
- cookie = 0;
selfevent = IN_MOVE_SELF;
break;
case _IN_ATTRIB_LINKCOUNT:
@@ -734,10 +733,8 @@
break;
}
- if ((selfevent & ~_IN_DIR_EVENTS) != 0) {
- inotify_log(vp, NULL, 0, selfevent | isdir,
- cookie);
- }
+ if ((selfevent & ~_IN_DIR_EVENTS) != 0)
+ inotify_log(vp, NULL, 0, selfevent | isdir, 0);
}
/*
diff --git a/tests/sys/kern/inotify_test.c b/tests/sys/kern/inotify_test.c
--- a/tests/sys/kern/inotify_test.c
+++ b/tests/sys/kern/inotify_test.c
@@ -761,6 +761,36 @@
close_inotify(ifd);
}
+ATF_TC_WITHOUT_HEAD(inotify_event_move_dir);
+ATF_TC_BODY(inotify_event_move_dir, tc)
+{
+ char dir[PATH_MAX], subdir1[PATH_MAX], subdir2[PATH_MAX];
+ uint32_t cookie1, cookie2;
+ int error, ifd, wd1, wd2;
+
+ ifd = inotify(IN_NONBLOCK);
+
+ wd1 = watch_dir(ifd, IN_MOVE, dir);
+ snprintf(subdir1, sizeof(subdir1), "%s/subdir", dir);
+ error = mkdir(subdir1, 0755);
+ ATF_REQUIRE(error == 0);
+ wd2 = inotify_add_watch(ifd, subdir1, IN_MOVE);
+ ATF_REQUIRE(wd2 != -1);
+
+ snprintf(subdir2, sizeof(subdir2), "%s/newsubdir", dir);
+ error = rename(subdir1, subdir2);
+ ATF_REQUIRE(error == 0);
+
+ cookie1 = consume_event_cookie(ifd, wd1, IN_MOVED_FROM, IN_ISDIR,
+ "subdir");
+ cookie2 = consume_event_cookie(ifd, wd1, IN_MOVED_TO, IN_ISDIR,
+ "newsubdir");
+ ATF_REQUIRE_MSG(cookie1 == cookie2,
+ "expected cookie %u, got %u", cookie1, cookie2);
+
+ close_inotify(ifd);
+}
+
ATF_TC_WITHOUT_HEAD(inotify_event_open);
ATF_TC_BODY(inotify_event_open, tc)
{
@@ -858,6 +888,7 @@
ATF_TP_ADD_TC(tp, inotify_event_create);
ATF_TP_ADD_TC(tp, inotify_event_delete);
ATF_TP_ADD_TC(tp, inotify_event_move);
+ ATF_TP_ADD_TC(tp, inotify_event_move_dir);
ATF_TP_ADD_TC(tp, inotify_event_open);
ATF_TP_ADD_TC(tp, inotify_event_unmount);
return (atf_no_error());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Sep 12, 8:37 PM (8 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29577046
Default Alt Text
D54336.1789245438.diff (1 KB)
Attached To
Mode
D54336: inotify: Avoid resetting the cookie
Attached
Detach File
Event Timeline
Log In to Comment