Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755990AbcKJWlt (ORCPT ); Thu, 10 Nov 2016 17:41:49 -0500 Received: from mail-wm0-f46.google.com ([74.125.82.46]:35328 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934434AbcKJWlr (ORCPT ); Thu, 10 Nov 2016 17:41:47 -0500 MIME-Version: 1.0 In-Reply-To: References: <20161102220851.GA1839@veci.piliscsaba.szeredi.hu> <20161105213411.GA32353@quack2.suse.cz> <20161109111005.GA32353@quack2.suse.cz> <20161110194625.GG31098@quack2.suse.cz> From: Amir Goldstein Date: Fri, 11 Nov 2016 00:41:45 +0200 Message-ID: Subject: Re: fsnotify_mark_srcu wtf? To: Miklos Szeredi Cc: Jan Kara , Eric Paris , linux-fsdevel , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1355 Lines: 33 On Thu, Nov 10, 2016 at 10:44 PM, Miklos Szeredi wrote: > On Thu, Nov 10, 2016 at 8:46 PM, Jan Kara wrote: >> Except it doesn't quite work. We can pin the current marks by a refcount >> but they can still be removed from the list so after we regain srcu lock, >> we are not sure their ->next pointers still point to still allocated marks >> :-| Sadly I realized this only after implementing all this. > > I think the real problem is the synchronous nature of the notification > interface, that really doesn't fit the permission events model very > well. > > If it were to be changed around to an async interface then all the > marks could be iterated, the permission events queued and then the > srcu lock can be released for good. > > Did I miss something? > Just one annoying fact - the the spec says that permission events must be delivered before the lower priority class events (i.e. the passive listeners). But unlike fanotify, that doesn't need the marks after they have been iterated, inotify does need the marks further along and dnotify goes further by taking a lock, which is on the mark itself, throughout the emittion of the event. This is the reason I suggested to walk the mark list while taking different SRCUs, but as I said, that's easier said then done, so I am not sure its a feasible idea. Amir.