RFC fsnotify: Rework inode tracking
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest13 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | fsnotify: Make detached connectors point to the superblockfs/ fs/ | +6 | 0 replies | |
| 2/13 | fsnotify: Remove sb argument from fsnotify_update_sb_watchers()fs/ | +5 | 0 replies | |
| 3/13 | fsnotify: Introduce inode connector hashfs/ fs/ fs/ +3 more | +187 | 1 reply | |
| 4/13 | fsnotify: Track number of connectors for superblock separatelyfs/ fs/ include/ | +13 | 0 replies | |
| 5/13 | fsnotify: Remove fsnotify_sb_watched_objects()fs/ include/ | +10 | 0 replies | |
| 6/13 | isofs: Provide fsnotify inode mark connectorfs/ | +41 | 0 replies | |
| 7/13 | fsnotify: Use connector hash for destroying inode marksfs/ | +32 | 1 reply | |
| 8/13 | fsnotify: Shutdown fsnotify before destroying sb's dcachefs/ | +2 | 0 replies | |
| 9/13 | fsnotify: Reconnect inode marks to inode on lookupfs/ fs/ include/ | +51 | 0 replies | |
| 10/13 | fsnotify: Stop holding inode references from inode mark connectorsfs/ fs/ fs/ +3 more | +76 | 0 replies | |
| 11/13 | fsnotify: Drop fsnotify_{get,put}_sb_watched_objects()fs/ | +2 | 0 replies | |
| 12/13 | fanotify: Don't recalculate mask when mark evictable flag changesfs/ | +6 | 0 replies | |
| 13/13 | fsnotify: Rename FSNOTIFY_MARK_FLAG_NO_IREFfs/ fs/ include/ | +6 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH RFC 0/13] fsnotify: Rework inode tracking
Hello!
This patch set reworks how fsnotify subsystem tracks inodes. So far we have held inode references from notification marks (connectors of list of notification marks to be more precise). This has three issues:
1) Placing a notification mark pins inode in memory. Since inodes are relatively big objects, users could pin significant amount of kernel memory by this. This then requires administrators to configure suitable limits on maximum amount of notification marks each user can place which is cumbersome.
2) During filesystem unmount we have walk a list of all inodes for the superblock to drop these inode references. This is either slow (when we do it before evicting all other inodes) or opens nasty races (when fsnotify() can run after dcache for the superblock has been evicted).
3) Since sb global inode list is a noticeable contention point we are trying to transition its users to something else so that we can eventually get rid of it.
In this patch set, fsnotify subsystem tracks notification marks attached to inodes in a specialrhashtable indexed by inode identifier. This way we can stop holding inode references and instead disconnect notification marks from the inode on inode eviction (and reconnect them when inode gets loaded into memory again). Credit for the original idea of this tracking actually goes to Dave Chinner.
The patches are so far incomplete - I still need to implement proper handling for filesystems where inode number isn't enough to identify the inode. isofs is provided as a sample how such support will look like for these filesystems.
Also we need to decide what to do with evictable notification marks. With the patches as is they are now never evicted. This makes sense because the main reason behind evictable marks was to avoid pinning the inode. On the other hand this *might* surprise some userspace - definitely it breaks couple of LTP tests we have for evictable marks.
Overall the patches passed some basic testing with LTP so they shouldn't be completely wrong but there could be bugs lurking so handle with care ;). I'm sending the patches for comments to the approach and whether people find this approach acceptable.
Honza