From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932093AbcFUPYw (ORCPT ); Tue, 21 Jun 2016 11:24:52 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:36007 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752654AbcFUPYt (ORCPT ); Tue, 21 Jun 2016 11:24:49 -0400 Date: Tue, 21 Jun 2016 11:24:47 -0400 From: Tejun Heo To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, evvers@ya.ru, kernel-team@fb.com, John McCutchan , Robert Love , Eric Paris Subject: Re: [PATCH kernfs/for-4.7-fixes] kernfs: don't depend on d_find_any_alias() when generating notifications Message-ID: <20160621152447.GE3262@mtj.duckdns.org> References: <20160617215117.GR3262@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160617215117.GR3262@mtj.duckdns.org> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 17, 2016 at 05:51:17PM -0400, Tejun Heo wrote: > kernfs_notify_workfn() sends out file modified events for the > scheduled kernfs_nodes. Because the modifications aren't from > userland, it doesn't have the matching file struct at hand and can't > use fsnotify_modify(). Instead, it looked up the inode and then used > d_find_any_alias() to find the dentry and used fsnotify_parent() and > fsnotify() directly to generate notifications. > > The assumption was that the relevant dentries would have been pinned > if there are listeners, which isn't true as inotify doesn't pin > dentries at all and watching the parent doesn't pin the child dentries > even for dnotify. This led to, for example, inotify watchers not > getting notifications if the system is under memory pressure and the > matching dentries got reclaimed. It can also be triggered through > /proc/sys/vm/drop_caches or a remount attempt which involves shrinking > dcache. > > fsnotify_parent() only uses the dentry to access the parent inode, > which kernfs can do easily. Update kernfs_notify_workfn() so that it > uses fsnotify() directly for both the parent and target inodes without > going through d_find_any_alias(). While at it, supply the target file > name to fsnotify() from kernfs_node->name. > > Signed-off-by: Tejun Heo > Reported-by: Evgeny Vereshchagin > Fixes: d911d9874801 ("kernfs: make kernfs_notify() trigger inotify events too") > Cc: John McCutchan > Cc: Robert Love > Cc: Eric Paris > Cc: stable@vger.kernel.org # v3.16+ > --- > Hello, > > I'm not sure this is the best way to deal with this but it at least > works fine. If there's a better, please let me know. If this > approach is okay, in the future, maybe we want to implement a helper > on fsnotify side to handle notification generation from back-end side? Greg, can you please pick this one up? Thanks. -- tejun