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:	Tue, 15 Apr 2014 19:06:11 +0200
From:	Jan Kara <jack@...e.cz>
To:	Theodore Ts'o <tytso@....edu>
Cc:	Ext4 Developers List <linux-ext4@...r.kernel.org>,
	viro@...IV.linux.org.uk
Subject: Re: [PATCH 1/5] ext4: inline generic_file_aio_write() into
 ext4_file_write()

On Sat 12-04-14 13:02:37, Ted Tso wrote:
> Copy generic_file_aio_write() into ext4_file_write().  This is part of
> a patch series which allows us to simplify ext4_file_write() and
> ext4_file_dio_write(), by calling __generic_file_aio_write() directly.
  Looks good. You can add:
Reviewed-by: Jan Kara <jack@...e.cz>

								Honza
> 
> Signed-off-by: "Theodore Ts'o" <tytso@....edu>
> ---
>  fs/ext4/file.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index 25a20b6..8b22556 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -113,8 +113,6 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
>  		ext4_unwritten_wait(inode);
>  	}
>  
> -	BUG_ON(iocb->ki_pos != pos);
> -
>  	mutex_lock(&inode->i_mutex);
>  	blk_start_plug(&plug);
>  
> @@ -168,9 +166,12 @@ static ssize_t
>  ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
>  		unsigned long nr_segs, loff_t pos)
>  {
> +	struct file *file = iocb->ki_filp;
>  	struct inode *inode = file_inode(iocb->ki_filp);
>  	ssize_t ret;
>  
> +	BUG_ON(iocb->ki_pos != pos);
> +
>  	/*
>  	 * If we have encountered a bitmap-format file, the size limit
>  	 * is smaller than s_maxbytes, which is for extent-mapped files.
> @@ -192,8 +193,20 @@ ext4_file_write(struct kiocb *iocb, const struct iovec *iov,
>  
>  	if (unlikely(iocb->ki_filp->f_flags & O_DIRECT))
>  		ret = ext4_file_dio_write(iocb, iov, nr_segs, pos);
> -	else
> -		ret = generic_file_aio_write(iocb, iov, nr_segs, pos);
> +	else {
> +		mutex_lock(&inode->i_mutex);
> +		ret = __generic_file_aio_write(iocb, iov, nr_segs,
> +					       &iocb->ki_pos);
> +		mutex_unlock(&inode->i_mutex);
> +
> +		if (ret > 0) {
> +			ssize_t err;
> +
> +			err = generic_write_sync(file, iocb->ki_pos - ret, ret);
> +			if (err < 0)
> +				ret = err;
> +		}
> +	}
>  
>  	return ret;
>  }
> -- 
> 1.9.0
> 
> --
> 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