All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext2: check err when partial != NULL
@ 2019-11-05  4:51 Chengguang Xu
  2019-11-05  9:41 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Chengguang Xu @ 2019-11-05  4:51 UTC (permalink / raw)
  To: jack; +Cc: linux-ext4, Chengguang Xu

Check err when partial == NULL is meaningless because
partial == NULL means getting branch successfully without
error.

Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>
---
 fs/ext2/inode.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 7004ce581a32..a16c53655e77 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -701,10 +701,13 @@ static int ext2_get_blocks(struct inode *inode,
 		if (!partial) {
 			count++;
 			mutex_unlock(&ei->truncate_mutex);
-			if (err)
-				goto cleanup;
 			goto got_it;
 		}
+
+		if (err) {
+			mutex_unlock(&ei->truncate_mutex);
+			goto cleanup;
+		}
 	}
 
 	/*
-- 
2.20.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext2: check err when partial != NULL
  2019-11-05  4:51 [PATCH] ext2: check err when partial != NULL Chengguang Xu
@ 2019-11-05  9:41 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-11-05  9:41 UTC (permalink / raw)
  To: Chengguang Xu; +Cc: jack, linux-ext4

On Tue 05-11-19 12:51:00, Chengguang Xu wrote:
> Check err when partial == NULL is meaningless because
> partial == NULL means getting branch successfully without
> error.
> 
> Signed-off-by: Chengguang Xu <cgxu519@mykernel.net>

Good catch! Added to my tree. Thanks!

							Honza

> ---
>  fs/ext2/inode.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index 7004ce581a32..a16c53655e77 100644
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -701,10 +701,13 @@ static int ext2_get_blocks(struct inode *inode,
>  		if (!partial) {
>  			count++;
>  			mutex_unlock(&ei->truncate_mutex);
> -			if (err)
> -				goto cleanup;
>  			goto got_it;
>  		}
> +
> +		if (err) {
> +			mutex_unlock(&ei->truncate_mutex);
> +			goto cleanup;
> +		}
>  	}
>  
>  	/*
> -- 
> 2.20.1
> 
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-05  9:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05  4:51 [PATCH] ext2: check err when partial != NULL Chengguang Xu
2019-11-05  9:41 ` Jan Kara

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.