Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1301999ybv; Thu, 20 Feb 2020 17:27:00 -0800 (PST) X-Google-Smtp-Source: APXvYqz7VobJY/f8feaykP4Rh6xbVV57LWpsAp533KWK54h4BAprGk9Pii08xYH8CyfDQ+L0MFbs X-Received: by 2002:aca:1c09:: with SMTP id c9mr55249oic.85.1582248420048; Thu, 20 Feb 2020 17:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582248420; cv=none; d=google.com; s=arc-20160816; b=RtdKd1bNEXgZtKz1oaxvhfFk3ITnzQb07IuVLzzxEEeXHcbHtO8CkcOKrGd/W4lCMh N/P0y5255+3rs74B7mcz2IlRJo9UVmILW5E7p+dUWaCpGWsb46wgjSE9LzTFjNTNXPH6 rUO8n0bwdzlShWV5C8qesxYh1IFFqyVRZ0m2kQR6UCcEKBQcsf3uVdxrZluwkzElWc73 B3mxbL6Enem7tdP/wG+ygKuwrnetj3dj+3zda2bh1fYRbpn7+rE37DKViTO4yLGy3zyt 8PfIYv4DPimdac4Hl/wFdIMajf+w+w3S5+n+m/t4EhV+AqhJi2YqRtnQaAq8E/V2+mRm k3zw== 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=0vh6y2JzMt+bmTGNqVEhHf2Xj+XIvWg44U91H4bjMzk=; b=phSzed+NapFXXVoDR41dxAHMdYlVmXkm1ELVhQ+47J41HsEQf4aA5Tbu94bFGxheYQ Mftrw/BX796H3H4XaNgStTsJtO8HGM9+t+leVrELrSKvFsKC7EZXaLb2FMc6sF2N64GY XwawfW/6ryRnq2CggMFkaJNfwtm+nDBEXpyy4vXRFJlIQ2Cd1tP06xXMmEe0OgyTBvox +9JIqqfqNLItcJK5cBGanIwONohKY1l9HMPM8paFyf1dVHuKcVfc+BphhJySZX08ICld BbsHAyI+84MKw3zhfaVGOaICisjy77+RPbg9ly00ExHebRziPpF3UYvHo8QdYY86hdsM dTYQ== 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 i20si631438otk.270.2020.02.20.17.26.47; Thu, 20 Feb 2020 17:27:00 -0800 (PST) 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 S1729565AbgBUB0d (ORCPT + 99 others); Thu, 20 Feb 2020 20:26:33 -0500 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:59810 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729476AbgBUB0c (ORCPT ); Thu, 20 Feb 2020 20:26:32 -0500 Received: from dread.disaster.area (pa49-195-185-106.pa.nsw.optusnet.com.au [49.195.185.106]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id EF33682017D; Fri, 21 Feb 2020 12:26:26 +1100 (AEDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1j4x5F-000591-FM; Fri, 21 Feb 2020 12:26:25 +1100 Date: Fri, 21 Feb 2020 12:26:25 +1100 From: Dave Chinner To: ira.weiny@intel.com Cc: linux-kernel@vger.kernel.org, Alexander Viro , "Darrick J. Wong" , Dan Williams , Christoph Hellwig , "Theodore Y. Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH V4 01/13] fs/xfs: Remove unnecessary initialization of i_rwsem Message-ID: <20200221012625.GT10776@dread.disaster.area> References: <20200221004134.30599-1-ira.weiny@intel.com> <20200221004134.30599-2-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200221004134.30599-2-ira.weiny@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=LYdCFQXi c=1 sm=1 tr=0 a=bkRQb8bsQZKWSSj4M57YXw==:117 a=bkRQb8bsQZKWSSj4M57YXw==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=l697ptgUJYAA:10 a=QyXUC8HyAAAA:8 a=7-415B0cAAAA:8 a=V8yeCck6NC70EfR_wKwA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 20, 2020 at 04:41:22PM -0800, ira.weiny@intel.com wrote: > From: Ira Weiny > > xfs_reinit_inode() -> inode_init_always() already handles calling > init_rwsem(i_rwsem). Doing so again is unneeded. > > Signed-off-by: Ira Weiny Except that this inode has been destroyed and freed by the VFS, and we are now recycling it back into the VFS before we actually physically freed it. Hence we have re-initialise the semaphore because the semaphore can contain internal state that is specific to it's new life cycle (e.g. the lockdep context) that will cause problems if we just assume that the inode is the same inode as it was before we recycled it back into the VFS caches. So, yes, we actually do need to re-initialise the rwsem here. Cheers, Dave. -- Dave Chinner david@fromorbit.com