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] [day] [month] [year] [list]
Date:   Thu, 8 Jul 2021 20:30:22 +0200
From:   Jan Kara <jack@...e.cz>
To:     Lukas Czerner <lczerner@...hat.com>
Cc:     Jan Kara <jack@...e.cz>, Ted Tso <tytso@....edu>,
        linux-ext4@...r.kernel.org
Subject: Re: [PATCH 4/4] ext4: Improve scalability of ext4 orphan file
 handling

On Wed 30-06-21 15:46:35, Lukas Czerner wrote:
> On Wed, Jun 16, 2021 at 12:56:55PM +0200, Jan Kara wrote:
> > @@ -28,28 +42,24 @@ static int ext4_orphan_file_add(handle_t *handle, struct inode *inode)
> >  		 */
> >  		return -ENOSPC;
> >  	}
> > -	oi->of_binfo[i].ob_free_entries--;
> > -	spin_unlock(&oi->of_lock);
> >  
> > -	/*
> > -	 * Get access to orphan block. We have dropped of_lock but since we
> > -	 * have decremented number of free entries we are guaranteed free entry
> > -	 * in our block.
> > -	 */
> >  	ret = ext4_journal_get_write_access(handle, inode->i_sb,
> >  				oi->of_binfo[i].ob_bh, EXT4_JTR_ORPHAN_FILE);
> >  	if (ret)
> >  		return ret;
> >  
> >  	bdata = (__le32 *)(oi->of_binfo[i].ob_bh->b_data);
> > -	spin_lock(&oi->of_lock);
> >  	/* Find empty slot in a block */
> > -	for (j = 0; j < inodes_per_ob && bdata[j]; j++);
> > -	BUG_ON(j == inodes_per_ob);
> > -	bdata[j] = cpu_to_le32(inode->i_ino);
> > +	j = 0;
> > +	do {
> > +		while (bdata[j]) {
> > +			if (++j >= inodes_per_ob)
> > +				j = 0;
> > +		}
> > +	} while (cmpxchg(&bdata[j], 0, cpu_to_le32(inode->i_ino)) != 0);
> 
> In case there is any sort of corruption on disk or in memory we can
> potentially get stuck here forever right ? Not sure if that matters
> all that much.
> 
> Other than that it looks good and negates some of my comments on the
> previous patch, sorry about that ;)
> 
> You can add
> 
> Reviewed-by: Lukas Czerner <lczerner@...hat.com>

Good point. I've added some limitations (and cond_resched()) to the loop so
that we cannot loop indefinitely. Thanks for review!

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ