Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750858AbcKEVeQ (ORCPT ); Sat, 5 Nov 2016 17:34:16 -0400 Received: from mx2.suse.de ([195.135.220.15]:39622 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750696AbcKEVeP (ORCPT ); Sat, 5 Nov 2016 17:34:15 -0400 Date: Sat, 5 Nov 2016 22:34:11 +0100 From: Jan Kara To: Miklos Szeredi Cc: Jan Kara , Eric Paris , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: fsnotify_mark_srcu wtf? Message-ID: <20161105213411.GA32353@quack2.suse.cz> References: <20161102220851.GA1839@veci.piliscsaba.szeredi.hu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161102220851.GA1839@veci.piliscsaba.szeredi.hu> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1305 Lines: 31 On Wed 02-11-16 23:09:26, Miklos Szeredi wrote: > We've got a report where a fanotify daemon that implements permission checks > screws up and doesn't send a reply. This then causes widespread hangs due to > fsnotify_mark_srcu read side lock being held and thus causing synchronize_srcu() > called from e.g. inotify_release()-> fsnotify_destroy_group()-> > fsnotify_mark_destroy_list() to block. Yes. But if a program implementing permission checks does not reply, your system is likely hosed anyway. We can only try to somewhat limit the damage... > Below program demonstrates the issue. It should output a single line: > > close(inotify_fd): success > > Instead it outputs nothing, which means that close(inotify_fd) got blocked by > the waiting permission event. > > Wouldn't making the srcu per-group fix this? Would that be too expensive? Per-group would be IMHO too expensive. You can have lots of groups and I'm not sure srcu would scale to that. Furthermore the SRCU protects the list of groups that need to get notification so it would not even be easily possible. Also Amir's solution is buggy - I'll comment on that as a reply to his patch. I'll try to find something to improve the situation but so far I have no good idea... Honza -- Jan Kara SUSE Labs, CR