Skip to content

RFC fsnotify: Rework inode tracking

Jan Kara linux-fsdevel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest13 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13fsnotify: Make detached connectors point to the superblockfs/notify/fsnotify.h fs/notify/mark.c+6 -30 replies
2/13fsnotify: Remove sb argument from fsnotify_update_sb_watchers()fs/notify/mark.c+5 -90 replies
3/13fsnotify: Introduce inode connector hashfs/notify/fsnotify.c fs/notify/fsnotify.h fs/notify/mark.c +3 more+187 -231 reply
4/13fsnotify: Track number of connectors for superblock separatelyfs/notify/fsnotify.c fs/notify/mark.c include/linux/fsnotify_backend.h+13 -70 replies
5/13fsnotify: Remove fsnotify_sb_watched_objects()fs/notify/mark.c include/linux/fsnotify_backend.h+10 -150 replies
6/13isofs: Provide fsnotify inode mark connectorfs/isofs/inode.c+41 -00 replies
7/13fsnotify: Use connector hash for destroying inode marksfs/notify/fsnotify.c+32 -461 reply
8/13fsnotify: Shutdown fsnotify before destroying sb's dcachefs/super.c+2 -20 replies
9/13fsnotify: Reconnect inode marks to inode on lookupfs/inode.c fs/notify/mark.c include/linux/fsnotify_backend.h+51 -00 replies
10/13fsnotify: Stop holding inode references from inode mark connectorsfs/inode.c fs/notify/fsnotify.c fs/notify/fsnotify.h +3 more+76 -1210 replies
11/13fsnotify: Drop fsnotify_{get,put}_sb_watched_objects()fs/notify/mark.c+2 -120 replies
12/13fanotify: Don't recalculate mask when mark evictable flag changesfs/notify/fanotify/fanotify_user.c+6 -150 replies
13/13fsnotify: Rename FSNOTIFY_MARK_FLAG_NO_IREFfs/notify/fanotify/fanotify.h fs/notify/fanotify/fanotify_user.c include/linux/fsnotify_backend.h+6 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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