• Jeff Layton's avatar
    Revert "fsnotify: destroy marks with call_srcu instead of dedicated thread" · 13d34ac6
    Jeff Layton authored
    This reverts commit c510eff6 ("fsnotify: destroy marks with
    call_srcu instead of dedicated thread").
    
    Eryu reported that he was seeing some OOM kills kick in when running a
    testcase that adds and removes inotify marks on a file in a tight loop.
    
    The above commit changed the code to use call_srcu to clean up the
    marks.  While that does (in principle) work, the srcu callback job is
    limited to cleaning up entries in small batches and only once per jiffy.
    It's easily possible to overwhelm that machinery with too many call_srcu
    callbacks, and Eryu's reproduer did just that.
    
    There's also another potential problem with using call_srcu here.  While
    you can obviously sleep while holding the srcu_read_lock, the callbacks
    run under local_bh_disable, so you can't sleep there.
    
    It's possible when putting the last reference to the fsnotify_mark that
    we'll end up putting a chain of references including the fsnotify_group,
    uid, and associated keys.  While I don't see any obvious ways that that
    could occurs, it's probably still best to avoid using call_srcu here
    after all.
    
    This patch reverts the above patch.  A later patch will take a different
    approach to eliminated the dedicated thread here.
    Signed-off-by: default avatarJeff Layton <jeff.layton@primarydata.com>
    Reported-by: default avatarEryu Guan <guaneryu@gmail.com>
    Tested-by: default avatarEryu Guan <guaneryu@gmail.com>
    Cc: Jan Kara <jack@suse.com>
    Cc: Eric Paris <eparis@parisplace.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    13d34ac6
mark.c 15.1 KB