Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp687168ybb; Fri, 3 Apr 2020 09:58:35 -0700 (PDT) X-Google-Smtp-Source: APiQypLjc++IP+TZoSw3tr5a2cowDEYiqErOWpp8vrxgjV5mRZtk3kir2ZZz5Rbw/zyh7MZdcu3k X-Received: by 2002:aca:5454:: with SMTP id i81mr3879089oib.23.1585933115635; Fri, 03 Apr 2020 09:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585933115; cv=none; d=google.com; s=arc-20160816; b=lRmfxgfsvKTLRVQN1nJuC6cwdnxlSltZ1guMaNRvDmVoLX62p30SHukqRYwWbJTeEQ N6c/y2yI/gKUDC8CUspwfBFrWvoOuJRCwNAn3gnpDbmLi82xK1yKyBTctBNa4Up+doo9 vIw8G1oHF35tJMJ8zAPSr/7ZnHv4TxeSyb80e7rEqMLBPrcmfNCrs9RaNq/sZWlIqHmh dy6atb9Y3+Vx9izkxcWyfD//fuLyQzpouP6prFQL4o4UJEGNIlrasGJwxYMxhtXa4yYc k0D6Y+OUrlpBx5QW4S+a0k0S9Wc3hl18pDkQUZczQGA3FDC3BYLCdDfQP5GdKzi0H7RU 5KYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=h4PnWKPs08GDZWulWmh33Q6FsQi17PF4MxytAmipmIM=; b=Xd9dJBVwn3byILK3/Gd03RCfjorBCcqFiTu1tYOKRJr7UB01Azysb1xDSF4X0nzk2V fMo2gfTXECspxDPkZ8A4nz5QSODkP3exUy7CbDJyfWlyHFT5M21PXn/yb2ZtxNqcq4U/ SkB3wpDiXQ4bCoN573VQ2IR9bPSDB61o5ZAGNOMTZ8kV9re6iqdHbOCFngaKOlYmzNgC fyBDNn4IZLZ3GGKY42GtkxXqtNEynIsYuG4wYIilnTxf1e0L9s9L6afZ6NWTIoho5iY2 JfyR8NCnBB2JIv6gwEKm44WXSFHbPvKOBvt8jRRFTYECr0ON2OcvM8rRuQmZ1nLmc0yn UgcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17si3876584ook.62.2020.04.03.09.58.22; Fri, 03 Apr 2020 09:58:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404629AbgDCQw2 (ORCPT + 99 others); Fri, 3 Apr 2020 12:52:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:41364 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728420AbgDCQw2 (ORCPT ); Fri, 3 Apr 2020 12:52:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C4AFCAA7C; Fri, 3 Apr 2020 16:52:25 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 816351E1235; Fri, 3 Apr 2020 18:52:25 +0200 (CEST) Date: Fri, 3 Apr 2020 18:52:25 +0200 From: Jan Kara To: Jules Irenge Cc: Jan Kara , linux-kernel@vger.kernel.org, boqun.feng@gmail.com, Amir Goldstein , "open list:FSNOTIFY: FILESYSTEM NOTIFICATION INFRASTRUCTURE" Subject: Re: [PATCH 2/7] fsnotify: Add missing annotation for fsnotify_finish_user_wait() Message-ID: <20200403165225.GC29920@quack2.suse.cz> References: <0/7> <20200331204643.11262-1-jbi.octave@gmail.com> <20200331204643.11262-3-jbi.octave@gmail.com> <20200401092433.GA19466@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 03-04-20 17:15:44, Jules Irenge wrote: > > > On Wed, 1 Apr 2020, Jan Kara wrote: > > > On Tue 31-03-20 21:46:38, Jules Irenge wrote: > > > Sparse reports a warning at fsnotify_finish_user_wait() > > > > > > warning: context imbalance in fsnotify_finish_user_wait() > > > - wrong count at exit > > > > > > The root cause is the missing annotation at fsnotify_finish_user_wait() > > > Add the missing __acquires(&fsnotify_mark_srcu) annotation. > > > > > > Signed-off-by: Jules Irenge > > > > OK, but then fsnotify_prepare_user_wait() needs __releases annotation as > > well if we're going to be serious about sparse warnings in this code? > > > > Honza > > > > > --- > > > fs/notify/mark.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/fs/notify/mark.c b/fs/notify/mark.c > > > index 1d96216dffd1..44fea637bb02 100644 > > > --- a/fs/notify/mark.c > > > +++ b/fs/notify/mark.c > > > @@ -350,6 +350,7 @@ bool fsnotify_prepare_user_wait(struct fsnotify_iter_info *iter_info) > > > } > > > > > > void fsnotify_finish_user_wait(struct fsnotify_iter_info *iter_info) > > > + __acquires(&fsnotify_mark_srcu) > > > { > > > int type; > > > > > > -- > > > 2.24.1 > > > > > -- > > Jan Kara > > SUSE Labs, CR > > > > Thanks for the reply. I think adding an annotation at > fsnotify_prepare_user_wait() will not theoretically remove the warning. > That's the only reason why I skipped it . Well, I think the goal isn't really to remove warnings but to make annotations correct... So even if sparse was not clever enough to spot that missing annotation, you should add it if you've decided to fix sparse annotations for fsnotify code. Honza -- Jan Kara SUSE Labs, CR