* [PATCH] ext4: recheck buffer uptodate bit under buffer lock
@ 2021-09-10 8:03 Zhang Yi
2021-09-16 8:05 ` Jan Kara
2021-10-01 4:11 ` Theodore Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Zhang Yi @ 2021-09-10 8:03 UTC (permalink / raw)
To: linux-ext4; +Cc: tytso, adilger.kernel, jack, yi.zhang, yukuai3
Commit 8e33fadf945a ("ext4: remove an unnecessary if statement in
__ext4_get_inode_loc()") forget to recheck buffer's uptodate bit again
under buffer lock, which may overwrite the buffer if someone else have
already brought it uptodate and changed it.
Fixes: 8e33fadf945a ("ext4: remove an unnecessary if statement in __ext4_get_inode_loc()")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
fs/ext4/inode.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d18852d6029c..236adc647eb0 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4340,6 +4340,12 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
goto has_buffer;
lock_buffer(bh);
+ if (ext4_buffer_uptodate(bh)) {
+ /* Someone brought it uptodate while we waited */
+ unlock_buffer(bh);
+ goto has_buffer;
+ }
+
/*
* If we have all information of the inode in memory and this
* is the only valid inode in the block, we need not read the
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: recheck buffer uptodate bit under buffer lock
2021-09-10 8:03 [PATCH] ext4: recheck buffer uptodate bit under buffer lock Zhang Yi
@ 2021-09-16 8:05 ` Jan Kara
2021-10-01 4:11 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Jan Kara @ 2021-09-16 8:05 UTC (permalink / raw)
To: Zhang Yi; +Cc: linux-ext4, tytso, adilger.kernel, jack, yukuai3
On Fri 10-09-21 16:03:16, Zhang Yi wrote:
> Commit 8e33fadf945a ("ext4: remove an unnecessary if statement in
> __ext4_get_inode_loc()") forget to recheck buffer's uptodate bit again
> under buffer lock, which may overwrite the buffer if someone else have
> already brought it uptodate and changed it.
>
> Fixes: 8e33fadf945a ("ext4: remove an unnecessary if statement in __ext4_get_inode_loc()")
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Oh, right. Thanks for fixing this. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/ext4/inode.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index d18852d6029c..236adc647eb0 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4340,6 +4340,12 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
> goto has_buffer;
>
> lock_buffer(bh);
> + if (ext4_buffer_uptodate(bh)) {
> + /* Someone brought it uptodate while we waited */
> + unlock_buffer(bh);
> + goto has_buffer;
> + }
> +
> /*
> * If we have all information of the inode in memory and this
> * is the only valid inode in the block, we need not read the
> --
> 2.31.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ext4: recheck buffer uptodate bit under buffer lock
2021-09-10 8:03 [PATCH] ext4: recheck buffer uptodate bit under buffer lock Zhang Yi
2021-09-16 8:05 ` Jan Kara
@ 2021-10-01 4:11 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2021-10-01 4:11 UTC (permalink / raw)
To: linux-ext4, Zhang Yi; +Cc: Theodore Ts'o, yukuai3, adilger.kernel, jack
On Fri, 10 Sep 2021 16:03:16 +0800, Zhang Yi wrote:
> Commit 8e33fadf945a ("ext4: remove an unnecessary if statement in
> __ext4_get_inode_loc()") forget to recheck buffer's uptodate bit again
> under buffer lock, which may overwrite the buffer if someone else have
> already brought it uptodate and changed it.
>
>
Applied, thanks!
[1/1] ext4: recheck buffer uptodate bit under buffer lock
commit: f2c77973507fd116c3657df1dc048864a2b16a1c
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-01 4:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 8:03 [PATCH] ext4: recheck buffer uptodate bit under buffer lock Zhang Yi
2021-09-16 8:05 ` Jan Kara
2021-10-01 4:11 ` Theodore Ts'o
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.