diff mbox series

ext4: initialize retries variable in ext4_da_write_inline_data_begin()

Message ID 20180813133459.24241-1-lczerner@redhat.com
State Accepted, archived
Headers show
Series ext4: initialize retries variable in ext4_da_write_inline_data_begin() | expand

Commit Message

Lukas Czerner Aug. 13, 2018, 1:34 p.m. UTC
Variable retries is not initialized in ext4_da_write_inline_data_begin()
which can lead to nondeterministic number of retries in case we hit
ENOSPC. Initialize retries to zero as we do everywhere else.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Fixes: bc0ca9df3b2a ("ext4: retry allocation when inline->extent conversion failed")
Cc: stable@kernel.org
---
 fs/ext4/inline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Kara Sept. 12, 2018, 3:54 p.m. UTC | #1
On Mon 13-08-18 15:34:59, Lukas Czerner wrote:
> Variable retries is not initialized in ext4_da_write_inline_data_begin()
> which can lead to nondeterministic number of retries in case we hit
> ENOSPC. Initialize retries to zero as we do everywhere else.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> Fixes: bc0ca9df3b2a ("ext4: retry allocation when inline->extent conversion failed")
> Cc: stable@kernel.org
> ---
>  fs/ext4/inline.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Ted, this seems to have fallen through the cracks...

								Honza

> 
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index 3543fe80a3c4..1b13fa5c9d6e 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -863,7 +863,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
>  	handle_t *handle;
>  	struct page *page;
>  	struct ext4_iloc iloc;
> -	int retries;
> +	int retries = 0;
>  
>  	ret = ext4_get_inode_loc(inode, &iloc);
>  	if (ret)
> -- 
> 2.17.1
>
Lukas Czerner Sept. 26, 2018, 9:01 a.m. UTC | #2
On Wed, Sep 12, 2018 at 05:54:48PM +0200, Jan Kara wrote:
> On Mon 13-08-18 15:34:59, Lukas Czerner wrote:
> > Variable retries is not initialized in ext4_da_write_inline_data_begin()
> > which can lead to nondeterministic number of retries in case we hit
> > ENOSPC. Initialize retries to zero as we do everywhere else.
> > 
> > Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> > Fixes: bc0ca9df3b2a ("ext4: retry allocation when inline->extent conversion failed")
> > Cc: stable@kernel.org
> > ---
> >  fs/ext4/inline.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Ted, this seems to have fallen through the cracks...

Yeah it did, Ted can you pick this up ?

-Lukas

> 
> 								Honza
> 
> > 
> > diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> > index 3543fe80a3c4..1b13fa5c9d6e 100644
> > --- a/fs/ext4/inline.c
> > +++ b/fs/ext4/inline.c
> > @@ -863,7 +863,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
> >  	handle_t *handle;
> >  	struct page *page;
> >  	struct ext4_iloc iloc;
> > -	int retries;
> > +	int retries = 0;
> >  
> >  	ret = ext4_get_inode_loc(inode, &iloc);
> >  	if (ret)
> > -- 
> > 2.17.1
> > 
> -- 
> Jan Kara <jack@suse.com>
> SUSE Labs, CR
Theodore Ts'o Oct. 3, 2018, 1:24 a.m. UTC | #3
On Mon, Aug 13, 2018 at 03:34:59PM +0200, Lukas Czerner wrote:
> Variable retries is not initialized in ext4_da_write_inline_data_begin()
> which can lead to nondeterministic number of retries in case we hit
> ENOSPC. Initialize retries to zero as we do everywhere else.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> Fixes: bc0ca9df3b2a ("ext4: retry allocation when inline->extent conversion failed")
> Cc: stable@kernel.org

Applied, thanks.

					- Ted
diff mbox series

Patch

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 3543fe80a3c4..1b13fa5c9d6e 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -863,7 +863,7 @@  int ext4_da_write_inline_data_begin(struct address_space *mapping,
 	handle_t *handle;
 	struct page *page;
 	struct ext4_iloc iloc;
-	int retries;
+	int retries = 0;
 
 	ret = ext4_get_inode_loc(inode, &iloc);
 	if (ret)