[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200221012625.GT10776@dread.disaster.area>
Date: Fri, 21 Feb 2020 12:26:25 +1100
From: Dave Chinner <david@...morbit.com>
To: ira.weiny@...el.com
Cc: linux-kernel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Dan Williams <dan.j.williams@...el.com>,
Christoph Hellwig <hch@....de>,
"Theodore Y. Ts'o" <tytso@....edu>, Jan Kara <jack@...e.cz>,
linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH V4 01/13] fs/xfs: Remove unnecessary initialization of
i_rwsem
On Thu, Feb 20, 2020 at 04:41:22PM -0800, ira.weiny@...el.com wrote:
> From: Ira Weiny <ira.weiny@...el.com>
>
> xfs_reinit_inode() -> inode_init_always() already handles calling
> init_rwsem(i_rwsem). Doing so again is unneeded.
>
> Signed-off-by: Ira Weiny <ira.weiny@...el.com>
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@...morbit.com
Powered by blists - more mailing lists