From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67214C433DB for ; Fri, 5 Mar 2021 15:19:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36CA2650A3 for ; Fri, 5 Mar 2021 15:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbhCEPTB (ORCPT ); Fri, 5 Mar 2021 10:19:01 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:55530 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229679AbhCEPS2 (ORCPT ); Fri, 5 Mar 2021 10:18:28 -0500 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 125FIGgY009749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 5 Mar 2021 10:18:16 -0500 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 2FE7815C3A88; Fri, 5 Mar 2021 10:18:16 -0500 (EST) Date: Fri, 5 Mar 2021 10:18:16 -0500 From: "Theodore Ts'o" To: Alexander Lochmann Cc: Horst Schirmeier , Jan Kara , Jan Kara , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] inode.i_opflags - Usage of two different locking schemes Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 05, 2021 at 02:10:09PM +0100, Alexander Lochmann wrote: > Hi folks, > > I've stumbled across an interesting locking scheme. It's related to struct > inode, more precisely it is an mqueue inode. > Our results show that inode:mqueue.i_opflags is read with i_rwsem being > hold. > In d_flags_for_inode, and do_inode_permission the i_lock is used to read and > write i_opflags. > Is this a real locking scheme? Is a lock needed to access i_opflags at all? > What is the magic behind this contradiction? > > I've put the report of the counterexamples on our webserver: > https://ess.cs.tu-dortmund.de/lockdoc-bugs/cex-inode-mqueue.html. > It contains the stacktraces leading to those accesses, and the locks that > were actually held. 1) I don't see where i_opflags is being read in ipc/mqueue.c at all, either with or without i_rwsem. 2) I'm not sure what this has to do with ext4? - Ted