2020-04-15 22:12:55

by Ira Weiny

[permalink] [raw]
Subject: [PATCH V8 01/11] fs/xfs: Remove unnecessary initialization of i_rwsem

From: Ira Weiny <[email protected]>

An earlier call of xfs_reinit_inode() from xfs_iget_cache_hit() already
handles initialization of i_rwsem.

Doing so again is unneeded.

Reviewed-by: Dave Chinner <[email protected]>
Signed-off-by: Ira Weiny <[email protected]>

---
Changes from V4:
Update commit message to make it clear the xfs_iget_cache_hit()
is actually doing the initialization via xfs_reinit_inode()

New for V4:

NOTE: This was found while ensuring the new i_aops_sem was properly
handled. It seems like this is a layering violation so I think it is
worth cleaning up so as to not confuse others.
---
fs/xfs/xfs_icache.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 8dc2e5414276..836a1f09be03 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -419,6 +419,7 @@ xfs_iget_cache_hit(
spin_unlock(&ip->i_flags_lock);
rcu_read_unlock();

+ ASSERT(!rwsem_is_locked(&inode->i_rwsem));
error = xfs_reinit_inode(mp, inode);
if (error) {
bool wake;
@@ -452,9 +453,6 @@ xfs_iget_cache_hit(
ip->i_sick = 0;
ip->i_checked = 0;

- ASSERT(!rwsem_is_locked(&inode->i_rwsem));
- init_rwsem(&inode->i_rwsem);
-
spin_unlock(&ip->i_flags_lock);
spin_unlock(&pag->pag_ici_lock);
} else {
--
2.25.1


2020-04-16 00:15:02

by Darrick J. Wong

[permalink] [raw]
Subject: Re: [PATCH V8 01/11] fs/xfs: Remove unnecessary initialization of i_rwsem

On Tue, Apr 14, 2020 at 11:45:13PM -0700, [email protected] wrote:
> From: Ira Weiny <[email protected]>
>
> An earlier call of xfs_reinit_inode() from xfs_iget_cache_hit() already
> handles initialization of i_rwsem.
>
> Doing so again is unneeded.
>
> Reviewed-by: Dave Chinner <[email protected]>
> Signed-off-by: Ira Weiny <[email protected]>

Still looks ok,
Reviewed-by: Darrick J. Wong <[email protected]>

--D

>
> ---
> Changes from V4:
> Update commit message to make it clear the xfs_iget_cache_hit()
> is actually doing the initialization via xfs_reinit_inode()
>
> New for V4:
>
> NOTE: This was found while ensuring the new i_aops_sem was properly
> handled. It seems like this is a layering violation so I think it is
> worth cleaning up so as to not confuse others.
> ---
> fs/xfs/xfs_icache.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
> index 8dc2e5414276..836a1f09be03 100644
> --- a/fs/xfs/xfs_icache.c
> +++ b/fs/xfs/xfs_icache.c
> @@ -419,6 +419,7 @@ xfs_iget_cache_hit(
> spin_unlock(&ip->i_flags_lock);
> rcu_read_unlock();
>
> + ASSERT(!rwsem_is_locked(&inode->i_rwsem));
> error = xfs_reinit_inode(mp, inode);
> if (error) {
> bool wake;
> @@ -452,9 +453,6 @@ xfs_iget_cache_hit(
> ip->i_sick = 0;
> ip->i_checked = 0;
>
> - ASSERT(!rwsem_is_locked(&inode->i_rwsem));
> - init_rwsem(&inode->i_rwsem);
> -
> spin_unlock(&ip->i_flags_lock);
> spin_unlock(&pag->pag_ici_lock);
> } else {
> --
> 2.25.1
>