From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934905AbcKMSnz (ORCPT ); Sun, 13 Nov 2016 13:43:55 -0500 Received: from mail-wm0-f44.google.com ([74.125.82.44]:37393 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932803AbcKMSny (ORCPT ); Sun, 13 Nov 2016 13:43:54 -0500 MIME-Version: 1.0 In-Reply-To: <20161110194625.GG31098@quack2.suse.cz> 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: Sun, 13 Nov 2016 20:43:12 +0200 Message-ID: Subject: Re: fsnotify_mark_srcu wtf? To: Jan Kara Cc: Miklos Szeredi , 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 On Thu, Nov 10, 2016 at 9:46 PM, Jan Kara wrote: ... > > Well but how would you like to protect the mark list hanging off the inode > / mountpoint with two SRCUs? You'd need two lists hanging off the inode & > mountpoint (for different priorities) and that's too big cost to pay to > accomodate broken userspace... > This is the plan. I have a rough implementation, which still requires some testing: /* * fsnotify_perm_mark[1] protects reads of the first half of inode/vfsmount * mark lists, which consist of the high priority (>0) marks, whose masks * may contain permission events. * * fsnotify_perm_mark[0] protects reads of the second half of inode/vfsmount * mark lists, which consist of the low priority (0) marks, whose masks * do not contain permission events. * * High priority marks and low priority marks are added to different * destroy lists and freed by different reapers, who synchronize only * the relevant srcu. * * Before traversing to first mark on the list we must hold both srcu. * While traversing first half, we may temporary drop fsnotify_perm_mark[0] * to handle a blocking permission event. * When we reach the first low level mark, we may drop fsnotify_perm_mark[1] * for good. */