From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53420 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751584AbeEMQEJ (ORCPT ); Sun, 13 May 2018 12:04:09 -0400 Date: Sun, 13 May 2018 18:04:04 +0200 From: Oleg Nesterov To: Amir Goldstein Cc: Waiman Long , Ingo Molnar , linux-fsdevel , linux-kernel , Jan Kara , Al Viro Subject: Re: DEBUG_RWSEMS warning from thaw_super() Message-ID: <20180513160404.GA19620@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 05/13, Amir Goldstein wrote: > > Since kernel v4.17-rc1 and DEBUG_RWSEMS, I see the > warning below after filesystem freeze/thaw. > > This is a case where one process acquires a bunch of rwsem > and another process releases them. > > To convey this use case to lockdep, freeze_super() calls > lockdep_sb_freeze_release() on exit and thaw_super() > calls lockdep_sb_freeze_acquire() on entry. This was already discussed, but I forgot the result... So once again, why we can't simply update percpu_rwsem_acquire() ? Or we can check CONFIG_RWSEM_SPIN_ON_OWNER to match percpu_rwsem_release(), but CONFIG_DEBUG_RWSEMS explains the purpose better. Oleg. --- x/include/linux/percpu-rwsem.h +++ x/include/linux/percpu-rwsem.h @@ -141,6 +141,10 @@ static inline void percpu_rwsem_acquire( bool read, unsigned long ip) { lock_acquire(&sem->rw_sem.dep_map, 0, 1, read, 1, NULL, ip); +#ifdef CONFIG_DEBUG_RWSEMS + if (!read) + sem->rw_sem.owner = current; +#endif } #endif