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]
Message-Id: <1234768181.32677.7.camel@sebastian.kern.oss.ntt.co.jp>
Date:	Mon, 16 Feb 2009 16:09:41 +0900
From:	Fernando Luis Vázquez Cao 
	<fernando@....ntt.co.jp>
To:	Theodore Tso <tytso@....edu>
Cc:	Jan Kara <jack@...e.cz>, Alan Cox <alan@...rguk.ukuu.org.uk>,
	Pavel Machek <pavel@...e.cz>,
	kernel list <linux-kernel@...r.kernel.org>,
	Jens Axboe <jens.axboe@...cle.com>, sandeen@...hat.com,
	fernando@....ac.jp
Subject: Re: ext4: call blkdev_issue_flush on fsync

On Sun, 2009-02-15 at 17:46 -0500, Theodore Tso wrote:
> On Thu, Feb 12, 2009 at 07:40:45PM +0900, Fernando Luis Vázquez Cao wrote:
> > @@ -76,25 +77,34 @@ int ext4_sync_file(struct file *file, st
> >  	 */
> >  	if (ext4_should_journal_data(inode)) {
> >  		ret = ext4_force_commit(inode->i_sb);
> > +		if (!(journal->j_flags & JBD2_BARRIER))
> > +			goto no_journal_barrier;
> >  		goto out;
> >  	}
> 
> All of these goto statements makes it one gigantic pile of spaghetti.
> The code will be much more understable if you do:
> 
> 		if (!(journal->j_flags & JBD2_BARRIER))
> 			block_flush_device(inode->i_sb);
> 		return ret;	
> 
> >  
> > -	if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
> > -		goto out;
> > +	if (datasync && !(i_state & I_DIRTY_DATASYNC))
> > +		goto flush_blkdev;
> >  
> 
> Maybe instead:
> 	if (datasync && !(i_state & I_DIRTY_DATASYNC)) {
> 		if (i_state & I_DIRTY_PAGES)
> 			block_flush_device(inode->i_sb);
> 		return ret;
> 	}
> 
> 
> > -		if (journal && (journal->j_flags & JBD2_BARRIER))
> > -			blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
> > +		if (journal && !(journal->j_flags & JBD2_BARRIER))
> > +			goto no_journal_barrier;
> > +		goto out;
> 
> Maybe instead:
> 		if (journal && !(journal->j_flags & JBD2_BARRIER))
> 			block_flush_device(inode->i_sb);
> 		return ret;
>   	}
> 
> I'm not a fanatic about eliminating all goto's, but "goto out" which
> could be replaced by "return ret;" is just silly.

Yes, you are right. I just wanted to follow the current style of the
code, but I got carried away and took things a bit too far.

I'll be replying to this email with a new iteration of the patch-set
that leaves out the potentially conflictive bits and should be more
readable.

Regards,

Fernando

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ