From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752542AbbHMKW1 (ORCPT ); Thu, 13 Aug 2015 06:22:27 -0400 Received: from mx2.suse.de ([195.135.220.15]:44442 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbbHMKWY (ORCPT ); Thu, 13 Aug 2015 06:22:24 -0400 Date: Thu, 13 Aug 2015 12:22:19 +0200 From: Jan Kara To: Oleg Nesterov Cc: Al Viro , Dave Chinner , Dave Hansen , Jan Kara , "Paul E. McKenney" , Peter Zijlstra , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/8] document rwsem_release() in sb_wait_write() Message-ID: <20150813102219.GF26599@quack.suse.cz> References: <20150811170343.GA26881@redhat.com> <20150811170404.GA26911@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150811170404.GA26911@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 11-08-15 19:04:04, Oleg Nesterov wrote: > Not only we need to avoid the warning from lockdep_sys_exit(), the > caller of freeze_super() can never release this lock. Another thread > can do this, so there is another reason for rwsem_release(). > > Plus the comment should explain why we have to fool lockdep. > > Signed-off-by: Oleg Nesterov Looks good. You can add: Reviewed-by: Jan Kara Honza > --- > fs/super.c | 12 +++++++++--- > 1 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/fs/super.c b/fs/super.c > index d0fdd49..89b58fb 100644 > --- a/fs/super.c > +++ b/fs/super.c > @@ -1236,11 +1236,17 @@ static void sb_wait_write(struct super_block *sb, int level) > { > s64 writers; > > + rwsem_acquire(&sb->s_writers.lock_map[level-1], 0, 0, _THIS_IP_); > /* > - * We just cycle-through lockdep here so that it does not complain > - * about returning with lock to userspace > + * We are going to return to userspace and forget about this lock, the > + * ownership goes to the caller of thaw_super() which does unlock. > + * > + * FIXME: we should do this before return from freeze_super() after we > + * called sync_filesystem(sb) and s_op->freeze_fs(sb), and thaw_super() > + * should re-acquire these locks before s_op->unfreeze_fs(sb). However > + * this leads to lockdep false-positives, so currently we do the early > + * release right after acquire. > */ > - rwsem_acquire(&sb->s_writers.lock_map[level-1], 0, 0, _THIS_IP_); > rwsem_release(&sb->s_writers.lock_map[level-1], 1, _THIS_IP_); > > do { > -- > 1.5.5.1 > -- Jan Kara SUSE Labs, CR