[PATCH] fs: assert ->i_lock held in __iget()

Mateusz Guzik posted 1 patch 20 hours ago
include/linux/fs.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] fs: assert ->i_lock held in __iget()
Posted by Mateusz Guzik 20 hours ago
Also remove the now redundant comment.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---

verified this booted with ext4 on root, no splats

 include/linux/fs.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9e9d7c757efe..4c773c4ee7aa 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3368,11 +3368,9 @@ static inline bool is_zero_ino(ino_t ino)
 	return (u32)ino == 0;
 }
 
-/*
- * inode->i_lock must be held
- */
 static inline void __iget(struct inode *inode)
 {
+	lockdep_assert_held(&inode->i_lock);
 	atomic_inc(&inode->i_count);
 }
 
-- 
2.34.1
Re: [PATCH] fs: assert ->i_lock held in __iget()
Posted by Jan Kara 8 hours ago
On Wed 01-10-25 01:53:14, Mateusz Guzik wrote:
> Also remove the now redundant comment.
> 
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
> 
> verified this booted with ext4 on root, no splats
> 
>  include/linux/fs.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 9e9d7c757efe..4c773c4ee7aa 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3368,11 +3368,9 @@ static inline bool is_zero_ino(ino_t ino)
>  	return (u32)ino == 0;
>  }
>  
> -/*
> - * inode->i_lock must be held
> - */
>  static inline void __iget(struct inode *inode)
>  {
> +	lockdep_assert_held(&inode->i_lock);
>  	atomic_inc(&inode->i_count);
>  }
>  
> -- 
> 2.34.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR