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: <f467a921-e7dd-4f5b-ac9f-c6e8c043143c@oracle.com>
Date: Wed, 23 Apr 2025 08:15:43 +0100
From: John Garry <john.g.garry@...cle.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: brauner@...nel.org, hch@....de, viro@...iv.linux.org.uk, jack@...e.cz,
        cem@...nel.org, linux-fsdevel@...r.kernel.org, dchinner@...hat.com,
        linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org,
        ojaswin@...ux.ibm.com, ritesh.list@...il.com,
        martin.petersen@...cle.com, linux-ext4@...r.kernel.org,
        linux-block@...r.kernel.org, catherine.hoang@...cle.com,
        linux-api@...r.kernel.org
Subject: Re: [PATCH v8 05/15] xfs: ignore HW which cannot atomic write a
 single block

On 23/04/2025 01:38, Darrick J. Wong wrote:
>>   
>> +	/*
>> +	 * Set atomic write unit max for mp. Ignore devices which cannot atomic
>> +	 * a single block, as they would be uncommon and more difficult to
>> +	 * support.
>> +	 */
>> +	if (mp->m_ddev_targp->bt_bdev_awu_min <= mp->m_sb.sb_blocksize &&
>> +	    mp->m_ddev_targp->bt_bdev_awu_max >= mp->m_sb.sb_blocksize)
>> +		mp->m_dd_awu_hw_max = mp->m_ddev_targp->bt_bdev_awu_max;
> If we don't want to use the device's atomic write capabilities due to
> fsblock alignment problems, why not just zero out bt_bdev_awu_min/max?
> That would cut down on the number of "awu" variables around the
> codebase.

Sure, I did consider this, but thought it a bit unpleasant to zero out 
structure members like this.

Ideally we could have not set them in the first place, but need to know 
the blocksize when xfs_alloc_buftarg() is called, but it is not yet set 
for mp/sb. Is there any neat way to know the blocksize when 
xfs_alloc_buftarg() is called?

> 
> /*
>   * Ignore hardware atomic writes if the device can't handle a single
>   * fsblock for us.  Most devices set the min_awu to the LBA size, but
>   * the spec allows for a functionality gap.
>   */
> static void

You would call this around the same point in xfs_mountfs(), right?

> xfs_buftarg_reconcile_awu(
> 	struct xfs_buftarg	*btp)
> {
> 	struct xfs_mount	*mp = btp->bt_mount;
> 
> 	if (btp->bt_bdev_awu_min > mp->m_sb.sb_blocksize ||
> 	    btp->bt_bdev_awu_max < mp->m_sb.sb_blocksize) {
> 		btp->bt_bdev_awu_min = 0;
> 		btp->bt_bdev_awu_max = 0;
> 	}
> }
> 
> 	xfs_buftarg_reconcile_awu(mp->m_ddev_targp);
> 	if (mp->m_rtdev_targp)
> 		xfs_buftarg_reconcile_awu(mp->m_rtdev_targp);
> 
> Hrm?

Cheers,
John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ