* [PATCH] ext4: Fix unnecessary hold lock when judge jinode in ext4_inode_attach_jinode
@ 2020-08-22 9:25 Ye Bin
2020-08-22 9:29 ` yebin
0 siblings, 1 reply; 2+ messages in thread
From: Ye Bin @ 2020-08-22 9:25 UTC (permalink / raw)
To: adilger.kernel, tytso, linux-ext4, yebin10
Signed-off-by: Ye Bin <yebin10@huawei.com>
---
fs/ext4/inode.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3a196d81f594..3504b4cec5b8 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4100,12 +4100,11 @@ int ext4_inode_attach_jinode(struct inode *inode)
return 0;
jinode = jbd2_alloc_inode(GFP_KERNEL);
+ if (!jinode)
+ return -ENOMEM;
+
spin_lock(&inode->i_lock);
if (!ei->jinode) {
- if (!jinode) {
- spin_unlock(&inode->i_lock);
- return -ENOMEM;
- }
ei->jinode = jinode;
jbd2_journal_init_jbd_inode(ei->jinode, inode);
jinode = NULL;
--
2.25.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ext4: Fix unnecessary hold lock when judge jinode in ext4_inode_attach_jinode
2020-08-22 9:25 [PATCH] ext4: Fix unnecessary hold lock when judge jinode in ext4_inode_attach_jinode Ye Bin
@ 2020-08-22 9:29 ` yebin
0 siblings, 0 replies; 2+ messages in thread
From: yebin @ 2020-08-22 9:29 UTC (permalink / raw)
To: adilger.kernel, tytso, linux-ext4
Sorry, please ignore it.
On 2020/8/22 17:25, Ye Bin wrote:
> Signed-off-by: Ye Bin <yebin10@huawei.com>
> ---
> fs/ext4/inode.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 3a196d81f594..3504b4cec5b8 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4100,12 +4100,11 @@ int ext4_inode_attach_jinode(struct inode *inode)
> return 0;
>
> jinode = jbd2_alloc_inode(GFP_KERNEL);
> + if (!jinode)
> + return -ENOMEM;
> +
> spin_lock(&inode->i_lock);
> if (!ei->jinode) {
> - if (!jinode) {
> - spin_unlock(&inode->i_lock);
> - return -ENOMEM;
> - }
> ei->jinode = jinode;
> jbd2_journal_init_jbd_inode(ei->jinode, inode);
> jinode = NULL;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-22 9:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-22 9:25 [PATCH] ext4: Fix unnecessary hold lock when judge jinode in ext4_inode_attach_jinode Ye Bin
2020-08-22 9:29 ` yebin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).