inotify: Add test for inotify mark destruction race
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
Kernels prior to 4.2 have a race when inode is being deleted while inotify group watching that inode is being torn down. When the race is hit, the kernel crashes or loops. Test for that race.
The problem has been fixed by commit 8f2f3eb59dff "fsnotify: fix oops in fsnotify_clear_marks_by_group_flags()".
--- runtest/syscalls | 1 + testcases/kernel/syscalls/inotify/inotify06.c | 121 ++++++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 testcases/kernel/syscalls/inotify/inotify06.c
runtest/syscalls +1 -0
@@ -449,6 +449,7 @@ inotify02 inotify02 inotify03 inotify03 inotify04 inotify04 inotify05 inotify05 +inotify06 inotify06 fanotify01 fanotify01 fanotify02 fanotify02
testcases/kernel/syscalls/inotify/inotify06.c new file +121 -0
121 lines not on this page · raw message
Signature · 8 lines
2.1.4 ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Hi!
Pushed with following changes:
* Added GPL header at the start of the file
* Removed cleanup parameter from SAFE calls in child because if one of the calls in child fails the temporary directory would be deleted, then parent would attempt to remove the directory and that will fail horribly.
* Moved to body of the test to separate function to spare some indentation.
* Used tst_fork() instead of fork() (flushes userspace stdio buffers before fork, otherwise messages from test may end up duplicated several times)
* Used ltp_syscall() instead of syscall() which handles ENOSYS etc.
* Added inotify06 binary to gitignore.
And checked that it still Opses kernel after these changes, thanks.
Signature · 8 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi!
I've just started pre-release LTP testing and found out that the test timeouts (after an half of hour) on an 3.0.101 kernel.
It looks like one iteration takes 0.2s there and the test would need > 5 hours to finish. Can we reduce the number of TEARDOWNs to 100 so that it finishes in 20 seconds?
Signature · 8 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
Signature · 8 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
hello,
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------
inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken
---------------------------------------------------------------------------
But look at the inotify06.c, inotify_fd is closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).
Then inotify_fd also has similar behavior? Even close(inotify_fd) returns,
that does not mean the number of current inotify instances have decreased one immediately, then later inotify_init() calls may exceeds the /proc/sys/fs/inotify/max_user_instances and return EMFILE error? I had added some debug code in kernel, it seems that close(inotify_fd) does not make sure current inotify instances decreases one immediately.
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 > /proc/sys/fs/inotify/max_user_instances to avoid EMFILE error. If not, this is a kernel bug?
Regards,
Xiaoguang Wang
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
Hello,
Quoted 26 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.
Quoted 3 lines
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?
Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
hello,
Quoted 29 lines · Jan Kara
Hello,
Quoted 26 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.
Quoted 8 lines
Quoted 3 lines
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
I just call ./inotify06 directly, and about 50% chance, it'll fail(return EMFILE).
Regards,
Xiaoguang Wang
Quoted 3 lines
Honza
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
Quoted 34 lines · Xiaoguang Wang
Quoted 33 lines · Jan Kara
Hello,
Quoted 29 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?
Quoted 5 lines
Quoted 4 lines
Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
I just call ./inotify06 directly, and about 50% chance, it'll fail(return EMFILE).
Hum, I've just tried 4.6-rc1 which I have running on one test machine and it survives hundreds of inotify06 calls in a loop without issues. I have max_user_instances set to 128 on that machine... So I suspect the problem is somewhere in your exact userspace setup. Aren't there other processes using inotify heavily for that user?
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
hello,
Quoted 39 lines · Jan Kara
Quoted 38 lines · Xiaoguang Wang
Quoted 37 lines · Jan Kara
Hello,
Quoted 26 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.Quoted 3 lines
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
Quoted 7 lines
Quoted 1 line
I just call ./inotify06 directly, and about 50% chance, it'll fail(return EMFILE).
Hum, I've just tried 4.6-rc1 which I have running on one test machine and it survives hundreds of inotify06 calls in a loop without issues. I have
max_user_instancesset to 128 on that machine... So I suspect the problem is somewhere in your exact userspace setup. Aren't there other processes using inotify heavily for that user?
I doubted so, but please see my debug results in my virtual machine, it still seems that it's a kernel issue...
I add some simple debug code to kernel and ltp test case inotify06, and switched to a normal user "lege" to have a test.
[lege@localhost inotify]$ uname -r
4.6.0-rc3+
From testcase_run.info, we can see that inotify_init1 has been called for 240 iterations(0-239), and the 239th iteration failed(return EMFILE error), meanwhile from dmesg.info, we can also see that kernel function inotify_new_group() was called for 240 iterations, and the last iteration failed(exceed the 128 limits). From test results, I think when I ran inotify06, at least for the period inotify06 ran, there is no other process calling inotify_init1(), so it's not likely a userspace setup issue. Also from demes.info, you can see that every time inotify_new_group() was called, group->inotify_data.user->inotify_devs is not always 0. so whether close(inotify_fd) could not make number of inotify instances dropped as soon as the last descriptor pointing to the instance is closed? Thanks.
Regards,
Xiaoguang Wang
Quoted 3 lines
Honza
-------------- next part --------------inotify_init1 called 0inotify_init1 called 1inotify_init1 called 2inotify_init1 called 3inotify_init1 called 4inotify_init1 called 5inotify_init1 called 6inotify_init1 called 7inotify_init1 called 8inotify_init1 called 9inotify_init1 called 10inotify_init1 called 11inotify_init1 called 12inotify_init1 called 13inotify_init1 called 14inotify_init1 called 15inotify_init1 called 16inotify_init1 called 17inotify_init1 called 18inotify_init1 called 19inotify_init1 called 20inotify_init1 called 21inotify_init1 called 22inotify_init1 called 23inotify_init1 called 24inotify_init1 called 25inotify_init1 called 26inotify_init1 called 27inotify_init1 called 28inotify_init1 called 29inotify_init1 called 30inotify_init1 called 31inotify_init1 called 32inotify_init1 called 33inotify_init1 called 34inotify_init1 called 35inotify_init1 called 36inotify_init1 called 37inotify_init1 called 38inotify_init1 called 39inotify_init1 called 40inotify_init1 called 41inotify_init1 called 42inotify_init1 called 43inotify_init1 called 44inotify_init1 called 45inotify_init1 called 46inotify_init1 called 47inotify_init1 called 48inotify_init1 called 49inotify_init1 called 50inotify_init1 called 51inotify_init1 called 52inotify_init1 called 53inotify_init1 called 54inotify_init1 called 55inotify_init1 called 56inotify_init1 called 57inotify_init1 called 58inotify_init1 called 59inotify_init1 called 60inotify_init1 called 61inotify_init1 called 62inotify_init1 called 63inotify_init1 called 64inotify_init1 called 65inotify_init1 called 66inotify_init1 called 67inotify_init1 called 68inotify_init1 called 69inotify_init1 called 70inotify_init1 called 71inotify_init1 called 72inotify_init1 called 73inotify_init1 called 74inotify_init1 called 75inotify_init1 called 76inotify_init1 called 77inotify_init1 called 78inotify_init1 called 79inotify_init1 called 80inotify_init1 called 81inotify_init1 called 82inotify_init1 called 83inotify_init1 called 84inotify_init1 called 85inotify_init1 called 86inotify_init1 called 87inotify_init1 called 88inotify_init1 called 89inotify_init1 called 90inotify_init1 called 91inotify_init1 called 92inotify_init1 called 93inotify_init1 called 94inotify_init1 called 95inotify_init1 called 96inotify_init1 called 97inotify_init1 called 98inotify_init1 called 99inotify_init1 called 100inotify_init1 called 101inotify_init1 called 102inotify_init1 called 103inotify_init1 called 104inotify_init1 called 105inotify_init1 called 106inotify_init1 called 107inotify_init1 called 108inotify_init1 called 109inotify_init1 called 110inotify_init1 called 111inotify_init1 called 112inotify_init1 called 113inotify_init1 called 114inotify_init1 called 115inotify_init1 called 116inotify_init1 called 117inotify_init1 called 118inotify_init1 called 119inotify_init1 called 120inotify_init1 called 121inotify_init1 called 122inotify_init1 called 123inotify_init1 called 124inotify_init1 called 125inotify_init1 called 126inotify_init1 called 127inotify_init1 called 128inotify_init1 called 129inotify_init1 called 130inotify_init1 called 131inotify_init1 called 132inotify_init1 called 133inotify_init1 called 134inotify_init1 called 135inotify_init1 called 136inotify_init1 called 137inotify_init1 called 138inotify_init1 called 139inotify_init1 called 140inotify_init1 called 141inotify_init1 called 142inotify_init1 called 143inotify_init1 called 144inotify_init1 called 145inotify_init1 called 146inotify_init1 called 147inotify_init1 called 148inotify_init1 called 149inotify_init1 called 150inotify_init1 called 151inotify_init1 called 152inotify_init1 called 153inotify_init1 called 154inotify_init1 called 155inotify_init1 called 156inotify_init1 called 157inotify_init1 called 158inotify_init1 called 159inotify_init1 called 160inotify_init1 called 161inotify_init1 called 162inotify_init1 called 163inotify_init1 called 164inotify_init1 called 165inotify_init1 called 166inotify_init1 called 167inotify_init1 called 168inotify_init1 called 169inotify_init1 called 170inotify_init1 called 171inotify_init1 called 172inotify_init1 called 173inotify_init1 called 174inotify_init1 called 175inotify_init1 called 176inotify_init1 called 177inotify_init1 called 178inotify_init1 called 179inotify_init1 called 180inotify_init1 called 181inotify_init1 called 182inotify_init1 called 183inotify_init1 called 184inotify_init1 called 185inotify_init1 called 186inotify_init1 called 187inotify_init1 called 188inotify_init1 called 189inotify_init1 called 190inotify_init1 called 191inotify_init1 called 192inotify_init1 called 193inotify_init1 called 194inotify_init1 called 195inotify_init1 called 196inotify_init1 called 197inotify_init1 called 198inotify_init1 called 199inotify_init1 called 200inotify_init1 called 201inotify_init1 called 202inotify_init1 called 203inotify_init1 called 204inotify_init1 called 205inotify_init1 called 206inotify_init1 called 207inotify_init1 called 208inotify_init1 called 209inotify_init1 called 210inotify_init1 called 211inotify_init1 called 212inotify_init1 called 213inotify_init1 called 214inotify_init1 called 215inotify_init1 called 216inotify_init1 called 217inotify_init1 called 218inotify_init1 called 219inotify_init1 called 220inotify_init1 called 221inotify_init1 called 222inotify_init1 called 223inotify_init1 called 224inotify_init1 called 225inotify_init1 called 226inotify_init1 called 227inotify_init1 called 228inotify_init1 called 229inotify_init1 called 230inotify_init1 called 231inotify_init1 called 232inotify_init1 called 233inotify_init1 called 234inotify_init1 called 235inotify_init1 called 236inotify_init1 called 237inotify_init1 called 238inotify_init1 called 239
inotify06 1 TBROK : inotify06.c:105: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:105: Remaining cases broken inotify06 1 TBROK : safe_macros.c:370: inotify06.c:96: unlink(fname_1) failed: errno=ENOENT(2): No such file or directory inotify06 2 TBROK : safe_macros.c:370: Remaining cases broken -------------- next part -------------- [ 1008.337077] lege inotify_new_group ffff88007498b880 0 [ 1008.337334] lege inotify_new_group ffff88007498b880 1 [ 1008.337351] lege inotify_new_group ffff88007498b880 2 [ 1008.337377] lege inotify_new_group ffff88007498b880 3 [ 1008.337394] lege inotify_new_group ffff88007498b880 4 [ 1008.337408] lege inotify_new_group ffff88007498b880 5 [ 1008.337422] lege inotify_new_group ffff88007498b880 6 [ 1008.337436] lege inotify_new_group ffff88007498b880 7 [ 1008.337462] lege inotify_new_group ffff88007498b880 8 [ 1008.337479] lege inotify_new_group ffff88007498b880 9 [ 1008.337506] lege inotify_new_group ffff88007498b880 10 [ 1008.337522] lege inotify_new_group ffff88007498b880 11 [ 1008.337549] lege inotify_new_group ffff88007498b880 12 [ 1008.337580] lege inotify_new_group ffff88007498b880 13 [ 1008.337595] lege inotify_new_group ffff88007498b880 14 [ 1008.337620] lege inotify_new_group ffff88007498b880 15 [ 1008.337687] lege inotify_new_group ffff88007498b880 16 [ 1008.337771] lege inotify_new_group ffff88007498b880 16 [ 1008.337786] lege inotify_new_group ffff88007498b880 17 [ 1008.337799] lege inotify_new_group ffff88007498b880 18 [ 1008.337811] lege inotify_new_group ffff88007498b880 19 [ 1008.337823] lege inotify_new_group ffff88007498b880 20 [ 1008.337837] lege inotify_new_group ffff88007498b880 21 [ 1008.337849] lege inotify_new_group ffff88007498b880 22 [ 1008.337897] lege inotify_new_group ffff88007498b880 23 [ 1008.337914] lege inotify_new_group ffff88007498b880 24 [ 1008.337927] lege inotify_new_group ffff88007498b880 25 [ 1008.337941] lege inotify_new_group ffff88007498b880 26 [ 1008.337954] lege inotify_new_group ffff88007498b880 27 [ 1008.337979] lege inotify_new_group ffff88007498b880 28 [ 1008.337994] lege inotify_new_group ffff88007498b880 29 [ 1008.338009] lege inotify_new_group ffff88007498b880 30 [ 1008.338025] lege inotify_new_group ffff88007498b880 31 [ 1008.338040] lege inotify_new_group ffff88007498b880 32 [ 1008.338055] lege inotify_new_group ffff88007498b880 33 [ 1008.338070] lege inotify_new_group ffff88007498b880 34 [ 1008.338087] lege inotify_new_group ffff88007498b880 35 [ 1008.338106] lege inotify_new_group ffff88007498b880 36 [ 1008.338123] lege inotify_new_group ffff88007498b880 37 [ 1008.338137] lege inotify_new_group ffff88007498b880 38 [ 1008.338150] lege inotify_new_group ffff88007498b880 39 [ 1008.338162] lege inotify_new_group ffff88007498b880 40 [ 1008.338172] lege inotify_new_group ffff88007498b880 40 [ 1008.338182] lege inotify_new_group ffff88007498b880 40 [ 1008.338192] lege inotify_new_group ffff88007498b880 40 [ 1008.338201] lege inotify_new_group ffff88007498b880 40 [ 1008.338211] lege inotify_new_group ffff88007498b880 40 [ 1008.338221] lege inotify_new_group ffff88007498b880 40 [ 1008.338231] lege inotify_new_group ffff88007498b880 40 [ 1008.338241] lege inotify_new_group ffff88007498b880 40 [ 1008.338253] lege inotify_new_group ffff88007498b880 41 [ 1008.338264] lege inotify_new_group ffff88007498b880 42 [ 1008.338276] lege inotify_new_group ffff88007498b880 43 [ 1008.338288] lege inotify_new_group ffff88007498b880 44 [ 1008.338299] lege inotify_new_group ffff88007498b880 45 [ 1008.338311] lege inotify_new_group ffff88007498b880 46 [ 1008.338323] lege inotify_new_group ffff88007498b880 47 [ 1008.338336] lege inotify_new_group ffff88007498b880 48 [ 1008.338348] lege inotify_new_group ffff88007498b880 49 [ 1008.338361] lege inotify_new_group ffff88007498b880 50 [ 1008.338373] lege inotify_new_group ffff88007498b880 51 [ 1008.338387] lege inotify_new_group ffff88007498b880 52 [ 1008.338400] lege inotify_new_group ffff88007498b880 53 [ 1008.338414] lege inotify_new_group ffff88007498b880 54 [ 1008.338428] lege inotify_new_group ffff88007498b880 55 [ 1008.338450] lege inotify_new_group ffff88007498b880 56 [ 1008.338464] lege inotify_new_group ffff88007498b880 57 [ 1008.338479] lege inotify_new_group ffff88007498b880 58 [ 1008.338495] lege inotify_new_group ffff88007498b880 59 [ 1008.338512] lege inotify_new_group ffff88007498b880 60 [ 1008.338527] lege inotify_new_group ffff88007498b880 61 [ 1008.338542] lege inotify_new_group ffff88007498b880 62 [ 1008.338560] lege inotify_new_group ffff88007498b880 63 [ 1008.338576] lege inotify_new_group ffff88007498b880 64 [ 1008.338593] lege inotify_new_group ffff88007498b880 65 [ 1008.338606] lege inotify_new_group ffff88007498b880 66 [ 1008.338618] lege inotify_new_group ffff88007498b880 67 [ 1008.338628] lege inotify_new_group ffff88007498b880 67 [ 1008.338637] lege inotify_new_group ffff88007498b880 67 [ 1008.338648] lege inotify_new_group ffff88007498b880 67 [ 1008.338659] lege inotify_new_group ffff88007498b880 67 [ 1008.338669] lege inotify_new_group ffff88007498b880 67 [ 1008.338678] lege inotify_new_group ffff88007498b880 67 [ 1008.338688] lege inotify_new_group ffff88007498b880 67 [ 1008.338698] lege inotify_new_group ffff88007498b880 67 [ 1008.338710] lege inotify_new_group ffff88007498b880 68 [ 1008.338722] lege inotify_new_group ffff88007498b880 69 [ 1008.338733] lege inotify_new_group ffff88007498b880 70 [ 1008.338745] lege inotify_new_group ffff88007498b880 71 [ 1008.338758] lege inotify_new_group ffff88007498b880 72 [ 1008.338770] lege inotify_new_group ffff88007498b880 73 [ 1008.338785] lege inotify_new_group ffff88007498b880 74 [ 1008.338798] lege inotify_new_group ffff88007498b880 75 [ 1008.338812] lege inotify_new_group ffff88007498b880 76 [ 1008.338825] lege inotify_new_group ffff88007498b880 77 [ 1008.338838] lege inotify_new_group ffff88007498b880 78 [ 1008.338852] lege inotify_new_group ffff88007498b880 79 [ 1008.338888] lege inotify_new_group ffff88007498b880 80 [ 1008.338904] lege inotify_new_group ffff88007498b880 81 [ 1008.338918] lege inotify_new_group ffff88007498b880 82 [ 1008.338933] lege inotify_new_group ffff88007498b880 83 [ 1008.338950] lege inotify_new_group ffff88007498b880 84 [ 1008.338977] lege inotify_new_group ffff88007498b880 85 [ 1008.338993] lege inotify_new_group ffff88007498b880 86 [ 1008.339009] lege inotify_new_group ffff88007498b880 87 [ 1008.339024] lege inotify_new_group ffff88007498b880 88 [ 1008.339042] lege inotify_new_group ffff88007498b880 89 [ 1008.339058] lege inotify_new_group ffff88007498b880 90 [ 1008.339072] lege inotify_new_group ffff88007498b880 91 [ 1008.339085] lege inotify_new_group ffff88007498b880 92 [ 1008.339096] lege inotify_new_group ffff88007498b880 93 [ 1008.339155] lege inotify_new_group ffff88007498b880 94 [ 1008.352021] lege inotify_new_group ffff88007498b880 1 [ 1008.352046] lege inotify_new_group ffff88007498b880 2 [ 1008.352063] lege inotify_new_group ffff88007498b880 3 [ 1008.352079] lege inotify_new_group ffff88007498b880 4 [ 1008.352094] lege inotify_new_group ffff88007498b880 5 [ 1008.352110] lege inotify_new_group ffff88007498b880 6 [ 1008.352124] lege inotify_new_group ffff88007498b880 7 [ 1008.352139] lege inotify_new_group ffff88007498b880 8 [ 1008.352154] lege inotify_new_group ffff88007498b880 9 [ 1008.352170] lege inotify_new_group ffff88007498b880 10 [ 1008.352185] lege inotify_new_group ffff88007498b880 11 [ 1008.352201] lege inotify_new_group ffff88007498b880 12 [ 1008.352216] lege inotify_new_group ffff88007498b880 13 [ 1008.352231] lege inotify_new_group ffff88007498b880 14 [ 1008.352246] lege inotify_new_group ffff88007498b880 15 [ 1008.352261] lege inotify_new_group ffff88007498b880 16 [ 1008.352277] lege inotify_new_group ffff88007498b880 17 [ 1008.352292] lege inotify_new_group ffff88007498b880 18 [ 1008.352307] lege inotify_new_group ffff88007498b880 19 [ 1008.352321] lege inotify_new_group ffff88007498b880 20 [ 1008.352336] lege inotify_new_group ffff88007498b880 21 [ 1008.352351] lege inotify_new_group ffff88007498b880 22 [ 1008.352365] lege inotify_new_group ffff88007498b880 23 [ 1008.352380] lege inotify_new_group ffff88007498b880 24 [ 1008.352396] lege inotify_new_group ffff88007498b880 25 [ 1008.352410] lege inotify_new_group ffff88007498b880 26 [ 1008.352426] lege inotify_new_group ffff88007498b880 27 [ 1008.352440] lege inotify_new_group ffff88007498b880 28 [ 1008.352455] lege inotify_new_group ffff88007498b880 29 [ 1008.352470] lege inotify_new_group ffff88007498b880 30 [ 1008.352484] lege inotify_new_group ffff88007498b880 31 [ 1008.352499] lege inotify_new_group ffff88007498b880 32 [ 1008.352514] lege inotify_new_group ffff88007498b880 33 [ 1008.352529] lege inotify_new_group ffff88007498b880 34 [ 1008.352544] lege inotify_new_group ffff88007498b880 35 [ 1008.352560] lege inotify_new_group ffff88007498b880 36 [ 1008.352575] lege inotify_new_group ffff88007498b880 37 [ 1008.352591] lege inotify_new_group ffff88007498b880 38 [ 1008.352606] lege inotify_new_group ffff88007498b880 39 [ 1008.352620] lege inotify_new_group ffff88007498b880 40 [ 1008.352636] lege inotify_new_group ffff88007498b880 41 [ 1008.352651] lege inotify_new_group ffff88007498b880 42 [ 1008.352667] lege inotify_new_group ffff88007498b880 43 [ 1008.352682] lege inotify_new_group ffff88007498b880 44 [ 1008.352696] lege inotify_new_group ffff88007498b880 45 [ 1008.352712] lege inotify_new_group ffff88007498b880 46 [ 1008.352728] lege inotify_new_group ffff88007498b880 47 [ 1008.352742] lege inotify_new_group ffff88007498b880 48 [ 1008.352757] lege inotify_new_group ffff88007498b880 49 [ 1008.352772] lege inotify_new_group ffff88007498b880 50 [ 1008.352787] lege inotify_new_group ffff88007498b880 51 [ 1008.352802] lege inotify_new_group ffff88007498b880 52 [ 1008.352817] lege inotify_new_group ffff88007498b880 53 [ 1008.352832] lege inotify_new_group ffff88007498b880 54 [ 1008.352848] lege inotify_new_group ffff88007498b880 55 [ 1008.352903] lege inotify_new_group ffff88007498b880 56 [ 1008.352927] lege inotify_new_group ffff88007498b880 57 [ 1008.352942] lege inotify_new_group ffff88007498b880 58 [ 1008.352989] lege inotify_new_group ffff88007498b880 59 [ 1008.353012] lege inotify_new_group ffff88007498b880 60 [ 1008.353034] lege inotify_new_group ffff88007498b880 61 [ 1008.353042] lege inotify_new_group ffff88007498b880 62 [ 1008.353049] lege inotify_new_group ffff88007498b880 63 [ 1008.353056] lege inotify_new_group ffff88007498b880 64 [ 1008.353063] lege inotify_new_group ffff88007498b880 65 [ 1008.353070] lege inotify_new_group ffff88007498b880 66 [ 1008.353078] lege inotify_new_group ffff88007498b880 67 [ 1008.353085] lege inotify_new_group ffff88007498b880 68 [ 1008.353092] lege inotify_new_group ffff88007498b880 69 [ 1008.353101] lege inotify_new_group ffff88007498b880 70 [ 1008.353114] lege inotify_new_group ffff88007498b880 71 [ 1008.353122] lege inotify_new_group ffff88007498b880 72 [ 1008.353130] lege inotify_new_group ffff88007498b880 73 [ 1008.353137] lege inotify_new_group ffff88007498b880 74 [ 1008.353145] lege inotify_new_group ffff88007498b880 75 [ 1008.353152] lege inotify_new_group ffff88007498b880 76 [ 1008.353159] lege inotify_new_group ffff88007498b880 77 [ 1008.353166] lege inotify_new_group ffff88007498b880 78 [ 1008.353173] lege inotify_new_group ffff88007498b880 79 [ 1008.353180] lege inotify_new_group ffff88007498b880 80 [ 1008.353187] lege inotify_new_group ffff88007498b880 81 [ 1008.353195] lege inotify_new_group ffff88007498b880 82 [ 1008.353203] lege inotify_new_group ffff88007498b880 83 [ 1008.353210] lege inotify_new_group ffff88007498b880 84 [ 1008.353216] lege inotify_new_group ffff88007498b880 85 [ 1008.353224] lege inotify_new_group ffff88007498b880 86 [ 1008.353232] lege inotify_new_group ffff88007498b880 87 [ 1008.353239] lege inotify_new_group ffff88007498b880 88 [ 1008.353247] lege inotify_new_group ffff88007498b880 89 [ 1008.353254] lege inotify_new_group ffff88007498b880 90 [ 1008.353261] lege inotify_new_group ffff88007498b880 91 [ 1008.353268] lege inotify_new_group ffff88007498b880 92 [ 1008.353276] lege inotify_new_group ffff88007498b880 93 [ 1008.353283] lege inotify_new_group ffff88007498b880 94 [ 1008.353290] lege inotify_new_group ffff88007498b880 95 [ 1008.353298] lege inotify_new_group ffff88007498b880 96 [ 1008.353305] lege inotify_new_group ffff88007498b880 97 [ 1008.353312] lege inotify_new_group ffff88007498b880 98 [ 1008.353320] lege inotify_new_group ffff88007498b880 99 [ 1008.353327] lege inotify_new_group ffff88007498b880 100 [ 1008.353334] lege inotify_new_group ffff88007498b880 101 [ 1008.353347] lege inotify_new_group ffff88007498b880 102 [ 1008.353354] lege inotify_new_group ffff88007498b880 103 [ 1008.353362] lege inotify_new_group ffff88007498b880 104 [ 1008.353370] lege inotify_new_group ffff88007498b880 105 [ 1008.353377] lege inotify_new_group ffff88007498b880 106 [ 1008.353385] lege inotify_new_group ffff88007498b880 107 [ 1008.353392] lege inotify_new_group ffff88007498b880 108 [ 1008.353399] lege inotify_new_group ffff88007498b880 109 [ 1008.353406] lege inotify_new_group ffff88007498b880 110 [ 1008.353413] lege inotify_new_group ffff88007498b880 111 [ 1008.353421] lege inotify_new_group ffff88007498b880 112 [ 1008.353428] lege inotify_new_group ffff88007498b880 113 [ 1008.353435] lege inotify_new_group ffff88007498b880 114 [ 1008.353443] lege inotify_new_group ffff88007498b880 115 [ 1008.353451] lege inotify_new_group ffff88007498b880 116 [ 1008.353460] lege inotify_new_group ffff88007498b880 117 [ 1008.353467] lege inotify_new_group ffff88007498b880 118 [ 1008.353474] lege inotify_new_group ffff88007498b880 119 [ 1008.353481] lege inotify_new_group ffff88007498b880 120 [ 1008.353488] lege inotify_new_group ffff88007498b880 121 [ 1008.353495] lege inotify_new_group ffff88007498b880 122 [ 1008.353502] lege inotify_new_group ffff88007498b880 123 [ 1008.353509] lege inotify_new_group ffff88007498b880 124 [ 1008.353517] lege inotify_new_group ffff88007498b880 125 [ 1008.353524] lege inotify_new_group ffff88007498b880 126 [ 1008.353531] lege inotify_new_group ffff88007498b880 127 [ 1008.353538] lege inotify_new_group ffff88007498b880 128
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-inotify06-add-debug-code.patch
Type: text/x-patch
Size: 1058 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160418/aeb9b04a/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-inotify-add-debug-code.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.linux.it/pipermail/ltp/attachments/20160418/aeb9b04a/attachment-0003.bin>
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
Hello!
Quoted 47 lines · Xiaoguang Wang
Quoted 39 lines · Jan Kara
Quoted 38 lines · Xiaoguang Wang
Quoted 37 lines · Jan Kara
Hello,
Quoted 26 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.Quoted 3 lines
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
Quoted 7 lines
Quoted 1 line
I just call ./inotify06 directly, and about 50% chance, it'll fail(return EMFILE).
Hum, I've just tried 4.6-rc1 which I have running on one test machine and it survives hundreds of inotify06 calls in a loop without issues. I have
max_user_instancesset to 128 on that machine... So I suspect the problem is somewhere in your exact userspace setup. Aren't there other processes using inotify heavily for that user?
Quoted 4 lines
I doubted so, but please see my debug results in my virtual machine, it still seems that it's a kernel issue...
I add some simple debug code to kernel and ltp test case inotify06, and switched to a normal user "lege" to have a test.
Thanks for the debugging! So I was looking more into the code and I now see what is likely going on. The group references from fsnotify marks are dropped only after srcu period expires and inotify instance count is decreased only after group reference count drops to zero. I will think what we can do about this.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
Quoted 55 lines · Jan Kara
Hello!
Quoted 47 lines · Xiaoguang Wang
Quoted 39 lines · Jan Kara
Quoted 38 lines · Xiaoguang Wang
Quoted 37 lines · Jan Kara
Hello,
Quoted 26 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.Quoted 3 lines
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
Quoted 7 lines
Quoted 1 line
I just call ./inotify06 directly, and about 50% chance, it'll fail(return EMFILE).
Hum, I've just tried 4.6-rc1 which I have running on one test machine and it survives hundreds of inotify06 calls in a loop without issues. I have
max_user_instancesset to 128 on that machine... So I suspect the problem is somewhere in your exact userspace setup. Aren't there other processes using inotify heavily for that user?Quoted 4 lines
I doubted so, but please see my debug results in my virtual machine, it still seems that it's a kernel issue...
I add some simple debug code to kernel and ltp test case inotify06, and switched to a normal user "lege" to have a test.
Quoted 5 lines
Thanks for the debugging! So I was looking more into the code and I now see what is likely going on. The group references from fsnotify marks are dropped only after srcu period expires and inotify instance count is decreased only after group reference count drops to zero. I will think what we can do about this.
So attached patch should fix the issue. Can you please test it? Thanks!
Honza
Signature · 9 lines
Jan Kara <[email protected]> SUSE Labs, CR -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-fsnotify-Avoid-spurious-EMFILE-errors-from-inotify_i.patch Type: text/x-patch Size: 8947 bytes Desc: not available URL: <http://lists.linux.it/pipermail/ltp/attachments/20160426/cfb17d9a/attachment.bin>
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
hello,
Quoted 56 lines · Jan Kara
Quoted 55 lines · Jan Kara
Hello!
Quoted 51 lines · Xiaoguang Wang
Quoted 39 lines · Jan Kara
Quoted 38 lines · Xiaoguang Wang
Quoted 37 lines · Jan Kara
Hello,
Quoted 26 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.Quoted 3 lines
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
Quoted 7 lines
Quoted 1 line
I just call ./inotify06 directly, and about 50% chance, it'll fail(return EMFILE).
Hum, I've just tried 4.6-rc1 which I have running on one test machine and it survives hundreds of inotify06 calls in a loop without issues. I have
max_user_instancesset to 128 on that machine... So I suspect the problem is somewhere in your exact userspace setup. Aren't there other processes using inotify heavily for that user?I doubted so, but please see my debug results in my virtual machine, it still seems that it's a kernel issue...
I add some simple debug code to kernel and ltp test case inotify06, and switched to a normal user "lege" to have a test.
Quoted 7 lines
Quoted 5 lines
Thanks for the debugging! So I was looking more into the code and I now see what is likely going on. The group references from fsnotify marks are dropped only after srcu period expires and inotify instance count is decreased only after group reference count drops to zero. I will think what we can do about this.
So attached patch should fix the issue. Can you please test it? Thanks!
Yes, it works, now inotify06 will always pass in my test machine, thanks very much!
Regards,
Xiaoguang Wang
Quoted 3 lines
Honza
PATCH v2 1/1 inotify: Add test for inotify mark destruction race
Hello,
Quoted 57 lines · Xiaoguang Wang
Quoted 56 lines · Jan Kara
Quoted 55 lines · Jan Kara
Hello!
Quoted 51 lines · Xiaoguang Wang
Quoted 39 lines · Jan Kara
Quoted 38 lines · Xiaoguang Wang
Quoted 37 lines · Jan Kara
Hello,
Quoted 26 lines · Xiaoguang Wang
Quoted 8 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Interesting, probably SRCU is much slower with this older kernel. From my experiments 100 iterations isn't quite reliable to trigger the oops in my testing instance. But 400 seem to be good enough.
I've changed the nuber of iterations to 400 and pushed it to git, thanks.
In upstream kernel v4.6-rc3-17-g1c74a7f and RHEL7.2GA, I sometimes get such error:
---------------------------------------------------------------------------inotify06 1 TBROK : inotify06.c:104: inotify_init failed: errno=EMFILE(24): Too many open files inotify06 2 TBROK : inotify06.c:104: Remaining cases broken---------------------------------------------------------------------------
But look at theinotify06.c,inotify_fdis closed every iteration. For normal file descriptors, "close(fd) succeeds" does not mean related kernel resources have been released immediately(processes may still reference fd).Then
inotify_fdalso has similar behavior? Evenclose(inotify_fd)returns,
that does not mean the number of current inotify instances have decreased one immediately, then laterinotify_init()calls may exceeds the/proc/sys/fs/inotify/max_user_instancesand return EMFILE error? I had added some debug code in kernel, it seems thatclose(inotify_fd)does not make sure current inotify instances decreases one immediately.Quoted 3 lines
So I'd like to know this is expected behavior for inotify? If yes, we can echo 400 >
/proc/sys/fs/inotify/max_user_instancesto avoid EMFILE error. If not, this is a kernel bug?Interesting, I've never seen this. Number of inotify instances is maintaned immediately - i.e., it is dropped as soon as the last descriptor pointing to the instance is closed. So I'm not sure how what you describe can happen. How do you reproduce the issue?
Quoted 7 lines
Quoted 1 line
I just call ./inotify06 directly, and about 50% chance, it'll fail(return EMFILE).
Hum, I've just tried 4.6-rc1 which I have running on one test machine and it survives hundreds of inotify06 calls in a loop without issues. I have
max_user_instancesset to 128 on that machine... So I suspect the problem is somewhere in your exact userspace setup. Aren't there other processes using inotify heavily for that user?I doubted so, but please see my debug results in my virtual machine, it still seems that it's a kernel issue...
I add some simple debug code to kernel and ltp test case inotify06, and switched to a normal user "lege" to have a test.
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Thanks for the debugging! So I was looking more into the code and I now see what is likely going on. The group references from fsnotify marks are dropped only after srcu period expires and inotify instance count is decreased only after group reference count drops to zero. I will think what we can do about this.
So attached patch should fix the issue. Can you please test it? Thanks!
Yes, it works, now inotify06 will always pass in my test machine, thanks very much!
Thanks for testing. I have sent the patch for inclusion in the kernel. I'm sorry but I forgot to CC you on the posting but the message id is [email protected] so you can possibly look it up in [email protected] mailing list archive.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR