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: <20250611061058.GB4613@lst.de>
Date: Wed, 11 Jun 2025 08:10:58 +0200
From: Christoph Hellwig <hch@....de>
To: Zhang Yi <yi.zhang@...weicloud.com>
Cc: linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org,
	linux-block@...r.kernel.org, dm-devel@...ts.linux.dev,
	linux-nvme@...ts.infradead.org, linux-scsi@...r.kernel.org,
	linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org, hch@....de,
	tytso@....edu, djwong@...nel.org, john.g.garry@...cle.com,
	bmarzins@...hat.com, chaitanyak@...dia.com,
	shinichiro.kawasaki@....com, brauner@...nel.org,
	martin.petersen@...cle.com, yi.zhang@...wei.com,
	chengzhihao1@...wei.com, yukuai3@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH 09/10] block: add FALLOC_FL_WRITE_ZEROES support

On Wed, Jun 04, 2025 at 10:08:49AM +0800, Zhang Yi wrote:
> @@ -856,6 +856,13 @@ static long blkdev_fallocate(struct file *file, int mode, loff_t start,
>  	/* Fail if we don't recognize the flags. */
>  	if (mode & ~BLKDEV_FALLOC_FL_SUPPORTED)
>  		return -EOPNOTSUPP;
> +	/*
> +	 * Don't allow writing zeroes if the device does not enable the
> +	 * unmap write zeroes operation.
> +	 */
> +	if (!bdev_write_zeroes_unmap(bdev) &&
> +	    (mode & FALLOC_FL_WRITE_ZEROES))

Cosmetic nitpick, but I'd turn the check around to check the mode first
as that's easier to read.  The whole check also fits onto a single line:

	if ((mode & FALLOC_FL_WRITE_ZEROES) && !bdev_write_zeroes_unmap(bdev))

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@....de>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ