lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 12 Dec 2013 18:30:20 +0800
From:	Zheng Liu <gnehzuil.liu@...il.com>
To:	Jan Kara <jack@...e.cz>
Cc:	Ted Tso <tytso@....edu>, Akira Fujita <a-fujita@...jp.nec.com>,
	linux-ext4@...r.kernel.org
Subject: Re: [PATCH 1/3] ext4: Retry allocation when inline->extent
 conversion failed

On Thu, Dec 12, 2013 at 10:39:36AM +0100, Jan Kara wrote:
> On Thu 12-12-13 14:44:22, Zheng Liu wrote:
> > Hi Jan,
> > 
> > On Tue, Dec 10, 2013 at 11:13:58AM +0100, Jan Kara wrote:
> > > Similarly as other ->write_begin functions in ext4, also
> > > ext4_da_write_inline_data_begin() should retry allocation if the
> > > conversion failed because of ENOSPC. This avoids returning ENOSPC
> > > prematurely because of uncommitted block deletions.
> > 
> > I don't see why we need to try again here.  If there is no enough space
> > in inline data, ext4_da_convert_inline_data_to_extent() just read the
> > inline data into a page and clear EXT4_STATE_MAY_INLINE_DATA flag.  If
> > we try again, we will encounter an ENOSPC error again.  So why do we
> > need to retry allocation?
>   Umm, I don't think so. ext4_da_convert_inline_data_to_extent() calls
> ext4_da_get_block_prep() and that can falsely fail with ENOSPC if there are
> blocks freed in currently running transaction. So we call
> ext4_should_retry_alloc() which forces commit of the current transaction
> and then we retry the allocation.

Ah, I see.  Thanks for your explanation.

                                                - Zheng

> 
> 								Honza
> 
> > > 
> > > Signed-off-by: Jan Kara <jack@...e.cz>
> > > ---
> > >  fs/ext4/inline.c | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> > > index bae987549dc3..ed6e71fe5e9d 100644
> > > --- a/fs/ext4/inline.c
> > > +++ b/fs/ext4/inline.c
> > > @@ -849,11 +849,13 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
> > >  	handle_t *handle;
> > >  	struct page *page;
> > >  	struct ext4_iloc iloc;
> > > +	int retries;
> > >  
> > >  	ret = ext4_get_inode_loc(inode, &iloc);
> > >  	if (ret)
> > >  		return ret;
> > >  
> > > +retry_journal:
> > >  	handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
> > >  	if (IS_ERR(handle)) {
> > >  		ret = PTR_ERR(handle);
> > > @@ -875,6 +877,11 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
> > >  							    inode,
> > >  							    flags,
> > >  							    fsdata);
> > > +		ext4_journal_stop(handle);
> > > +		handle = NULL;
> > > +		if (ret == -ENOSPC &&
> > > +		    ext4_should_retry_alloc(inode->i_sb, &retries))
> > > +			goto retry_journal;
> > >  		goto out;
> > >  	}
> > >  
> > > -- 
> > > 1.8.1.4
> > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> > > the body of a message to majordomo@...r.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> -- 
> Jan Kara <jack@...e.cz>
> SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ