All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] xfs: don't reset max_atomic_write on a remount without the option
@ 2026-12-05  1:22 Yifan Feng
  2026-12-05 20:21 ` John Garry
  0 siblings, 1 reply; 2+ messages in thread
From: Yifan Feng @ 2026-12-05  1:22 UTC (permalink / raw)
  To: Carlos Maiolino
  Cc: Christoph Hellwig, Darrick J. Wong, John Garry, linux-xfs,
	linux-kernel, Yifan Feng

xfs_fs_reconfigure() applies the max_atomic_write value of the remount
options whenever it differs from the mounted one, and without the
option that value is 0, the default.  So a remount that does not name
max_atomic_write resets the limit:

  # mount -o max_atomic_write=64k /dev/vda /mnt
  # findmnt -no OPTIONS /mnt
  rw,relatime,inode64,logbufs=8,logbsize=32k,noquota,max_atomic_write=64k
  # mount -o remount,noatime /dev/vda /mnt
  # findmnt -no OPTIONS /mnt
  rw,noatime,inode64,logbufs=8,logbsize=32k,noquota

Start the options of a remount from the value in use, in one block
with the inode32 setting.  A remount with max_atomic_write=0 still goes
back to the default.

Fixes: 4528b9052731 ("xfs: allow sysadmins to specify a maximum atomic write limit at mount time")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
v3: rebased on the for-next branch of xfs-linux (ab1a77ab136c), which has the inode32 patch. No code change. Added the Reviewed-by.
v2: https://lore.kernel.org/r/20261203225201.52120-1-evanfengff@gmail.com

Built and tested on that branch in QEMU with mount(2), mount(8) and fspick()/fsconfig().
Found and written with the help of an AI coding assistant.

 fs/xfs/xfs_super.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index bdab50bce3c9..808be1bafe3e 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -2319,10 +2319,13 @@ xfs_init_fs_context(
 	mp->m_allocsize_log = 16; /* 64k */
 	mp->m_read_bounce = XFS_READ_BOUNCE_LAZY;
 
-	/* A remount without inode32 or inode64 keeps what is in use. */
-	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE &&
-	    xfs_has_small_inums(XFS_M(fc->root->d_sb)))
-		mp->m_features |= XFS_FEAT_SMALL_INUMS;
+	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
+		struct xfs_mount	*cur = XFS_M(fc->root->d_sb);
+
+		if (xfs_has_small_inums(cur))
+			mp->m_features |= XFS_FEAT_SMALL_INUMS;
+		mp->m_awu_max_bytes = cur->m_awu_max_bytes;
+	}
 
 	xfs_hooks_init(&mp->m_dir_update_hooks);
 

base-commit: ab1a77ab136c24fdbc81291530963d2be5d482d9
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] xfs: don't reset max_atomic_write on a remount without the option
  2026-12-05  1:22 [PATCH v3] xfs: don't reset max_atomic_write on a remount without the option Yifan Feng
@ 2026-12-05 20:21 ` John Garry
  0 siblings, 0 replies; 2+ messages in thread
From: John Garry @ 2026-12-05 20:21 UTC (permalink / raw)
  To: Yifan Feng, Carlos Maiolino
  Cc: Christoph Hellwig, Darrick J. Wong, linux-xfs, linux-kernel

On 12/5/26 01:22, Yifan Feng wrote:
> xfs_fs_reconfigure() applies the max_atomic_write value of the remount
> options whenever it differs from the mounted one, and without the
> option that value is 0, the default.  So a remount that does not name
> max_atomic_write resets the limit:
> 
>    # mount -o max_atomic_write=64k /dev/vda /mnt
>    # findmnt -no OPTIONS /mnt
>    rw,relatime,inode64,logbufs=8,logbsize=32k,noquota,max_atomic_write=64k
>    # mount -o remount,noatime /dev/vda /mnt
>    # findmnt -no OPTIONS /mnt
>    rw,noatime,inode64,logbufs=8,logbsize=32k,noquota
> 
> Start the options of a remount from the value in use, in one block
> with the inode32 setting.  A remount with max_atomic_write=0 still goes
> back to the default.
> 
> Fixes: 4528b9052731 ("xfs: allow sysadmins to specify a maximum atomic write limit at mount time")
> Signed-off-by: Yifan Feng <evanfengff@gmail.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

This looks ok to me, so FWIW:

Reviewed-by: John Garry <john.garry@linux.dev>

> ---
> v3: rebased on the for-next branch of xfs-linux (ab1a77ab136c), which has the inode32 patch. No code change. Added the Reviewed-by.
> v2: https://lore.kernel.org/r/20261203225201.52120-1-evanfengff@gmail.com
> 
> Built and tested on that branch in QEMU with mount(2), mount(8) and fspick()/fsconfig().
> Found and written with the help of an AI coding assistant.
> 
>   fs/xfs/xfs_super.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index bdab50bce3c9..808be1bafe3e 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -2319,10 +2319,13 @@ xfs_init_fs_context(
>   	mp->m_allocsize_log = 16; /* 64k */
>   	mp->m_read_bounce = XFS_READ_BOUNCE_LAZY;
>   
> -	/* A remount without inode32 or inode64 keeps what is in use. */
> -	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE &&
> -	    xfs_has_small_inums(XFS_M(fc->root->d_sb)))
> -		mp->m_features |= XFS_FEAT_SMALL_INUMS;
> +	if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) {
> +		struct xfs_mount	*cur = XFS_M(fc->root->d_sb);
> +
> +		if (xfs_has_small_inums(cur))
> +			mp->m_features |= XFS_FEAT_SMALL_INUMS;
> +		mp->m_awu_max_bytes = cur->m_awu_max_bytes;
> +	}
>   
>   	xfs_hooks_init(&mp->m_dir_update_hooks);
>   
> 
> base-commit: ab1a77ab136c24fdbc81291530963d2be5d482d9


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-05 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  1:22 [PATCH v3] xfs: don't reset max_atomic_write on a remount without the option Yifan Feng
2026-12-05 20:21 ` John Garry

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.