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:	Sun, 15 Feb 2009 17:46:59 -0500
From:	Theodore Tso <tytso@....edu>
To:	Fernando Luis Vázquez Cao 
	<fernando@....ntt.co.jp>
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 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.

      	 	     	     	      - Ted
--
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