Bug 196815 - fanotify hangs with AUFS
Summary: fanotify hangs with AUFS
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 high
Assignee: fs_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-03 10:53 UTC by Ariel Zelivansky
Modified: 2017-09-11 13:19 UTC (History)
0 users

See Also:
Kernel Version: 4.13.*
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Fanotify sample code (from the manpage) (4.87 KB, text/plain)
2017-09-03 10:53 UTC, Ariel Zelivansky
Details

Description Ariel Zelivansky 2017-09-03 10:53:20 UTC
Created attachment 258175 [details]
Fanotify sample code (from the manpage)

fanotify hangs indefinitely when an event occurs on an AUFS mount.

I get messages that the calling process was blocked for more than 120 seconds. The call stack from dmesg shows the hang is on schedule, called from fanotify_handle_event (I'll post the whole thing if needed).

I first encountered this on my machine with a 4.10.0 kernel, reproduced it on a 4.0.4 kernel that I compiled with AUFS myself, and finally reproduced the same issue on the mainline kernel (4.13.0-rc5).

Steps to reproduce:

1. Build the sample code from the fanotify (7) manpage, attached for convenience.
2. Create a Docker container with AUFS as storage driver (docker run -ti ubuntu)
3. Copy fanotify sample binary to container
4. Enter the container namespace from the host (nsenter --mount=/proc/.../ns/mnt)
5. Run the sample on the root mount (./fanotify /)
6. Write to any random file from the container

Both the process and the container will hang, and dmesg will produce the fault messages.

I tried to debug fanotify myself and the line that blocks seems to be wait_event in fanotify_get_response. I looked around in the code a bit but I'm not sure what this lock is for. 

In any case you can't find time to fix this I'd appreciate any suggestions on trying to figure out what's blocking here.
Comment 1 Ariel Zelivansky 2017-09-11 13:19:16 UTC
This turned out to be an issue with aufs. J. R. Okajima pushed his fixes to aufs4.13. See: https://sourceforge.net/p/aufs/mailman/message/36032869/

Note You need to log in before you can comment on or make changes to this bug.