All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: John Garry <john.g.garry@oracle.com>
Cc: brauner@kernel.org, hch@lst.de, viro@zeniv.linux.org.uk,
	jack@suse.cz, cem@kernel.org, linux-fsdevel@vger.kernel.org,
	dchinner@redhat.com, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, ojaswin@linux.ibm.com,
	ritesh.list@gmail.com, martin.petersen@oracle.com,
	linux-ext4@vger.kernel.org, linux-block@vger.kernel.org,
	catherine.hoang@oracle.com, linux-api@vger.kernel.org
Subject: Re: [PATCH v11 14/16] xfs: add xfs_calc_atomic_write_unit_max()
Date: Mon, 5 May 2025 07:26:05 -0700	[thread overview]
Message-ID: <20250505142605.GI1035866@frogsfrogsfrogs> (raw)
In-Reply-To: <9d5d7037-6ed7-4c61-afec-8422d656de37@oracle.com>

On Mon, May 05, 2025 at 09:02:31AM +0100, John Garry wrote:
> On 05/05/2025 07:08, John Garry wrote:
> > On 05/05/2025 06:25, Darrick J. Wong wrote:
> > > Ok so I even attached the reply to the WRONG VERSION.  Something in
> > > these changes cause xfs/289 to barf up this UBSAN warning, even on a
> > > realtime + rtgroups volume:
> 
> Could this just be from another mount (of not a realtime + rtgroups xfs
> instance)?

Quite possibly.

> > > 
> > > [ 1160.539004] ------------[ cut here ]------------
> > > [ 1160.540701] UBSAN: shift-out-of-bounds in /storage/home/djwong/
> > > cdev/work/linux-djw/include/linux/log2.h:67:13
> > > [ 1160.544597] shift exponent 4294967295 is too large for 64-bit
> > > type 'long unsigned int'
> > > [ 1160.547038] CPU: 3 UID: 0 PID: 288421 Comm: mount Not tainted
> > > 6.15.0-rc5-djwx #rc5 PREEMPT(lazy)
> > > 6f606c17703b80ffff7378e7041918eca24b3e68
> > > [ 1160.547045] Hardware name: QEMU Standard PC (i440FX + PIIX,
> > > 1996), BIOS 1.16.0-4.module+el8.8.0+21164+ed375313 04/01/2014
> > > [ 1160.547047] Call Trace:
> > > [ 1160.547049]  <TASK>
> > > [ 1160.547051]  dump_stack_lvl+0x4f/0x60
> > > [ 1160.547060]  __ubsan_handle_shift_out_of_bounds+0x1bc/0x380
> > > [ 1160.547066]  xfs_set_max_atomic_write_opt.cold+0x22d/0x252 [xfs
> > > 1f657532c3dee9b1d567597a31645929273d3283]
> > > [ 1160.547249]  xfs_mountfs+0xa5c/0xb50 [xfs
> > > 1f657532c3dee9b1d567597a31645929273d3283]
> > > [ 1160.547434]  xfs_fs_fill_super+0x7eb/0xb30 [xfs
> > > 1f657532c3dee9b1d567597a31645929273d3283]
> > > [ 1160.547616]  ? xfs_open_devices+0x240/0x240 [xfs
> > > 1f657532c3dee9b1d567597a31645929273d3283]
> > > [ 1160.547797]  get_tree_bdev_flags+0x132/0x1d0
> > > [ 1160.547801]  vfs_get_tree+0x17/0xa0
> > > [ 1160.547803]  path_mount+0x720/0xa80
> > > [ 1160.547807]  __x64_sys_mount+0x10c/0x140
> > > [ 1160.547810]  do_syscall_64+0x47/0x100
> > > [ 1160.547814]  entry_SYSCALL_64_after_hwframe+0x4b/0x53
> > > [ 1160.547817] RIP: 0033:0x7fde55d62e0a
> > > [ 1160.547820] Code: 48 8b 0d f9 7f 0c 00 f7 d8 64 89 01 48 83 c8 ff
> > > c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00
> > > 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d c6 7f 0c 00 f7 d8 64
> > > 89 01 48
> > > [ 1160.547823] RSP: 002b:00007fff11920ce8 EFLAGS: 00000246 ORIG_RAX:
> > > 00000000000000a5
> > > [ 1160.547826] RAX: ffffffffffffffda RBX: 0000556a10cd1de0 RCX:
> > > 00007fde55d62e0a
> > > [ 1160.547828] RDX: 0000556a10cd2010 RSI: 0000556a10cd2090 RDI:
> > > 0000556a10ce2590
> > > [ 1160.547829] RBP: 0000000000000000 R08: 0000000000000000 R09:
> > > 00007fff11920d50
> > > [ 1160.547830] R10: 0000000000000000 R11: 0000000000000246 R12:
> > > 0000556a10ce2590
> > > [ 1160.547832] R13: 0000556a10cd2010 R14: 00007fde55eca264 R15:
> > > 0000556a10cd1ef8
> > > [ 1160.547834]  </TASK>
> > > [ 1160.547835] ---[ end trace ]---
> > > 
> > > John, can you please figure this one out, seeing as it's 10:30pm on
> > > Sunday night here?
> 
> 
> I could recreate this.
> 
> > 
> 
> I think that we need this change:
> 
> @@ -715,6 +716,9 @@ static inline xfs_extlen_t
> xfs_calc_rtgroup_awu_max(struct xfs_mount *mp)
>  {
>         struct xfs_groups       *rgs = &mp->m_groups[XG_TYPE_RTG];
> 
> +       if (rgs->blocks == 0)
> +               return 0;
>         if (mp->m_rtdev_targp && mp->m_rtdev_targp->bt_bdev_awu_min > 0)
>                 return max_pow_of_two_factor(rgs->blocks);
>         return rounddown_pow_of_two(rgs->blocks);
> 
> My xfs/289 problem goes away with this change.

Ok good.

--D

> 
> > 
> 
> 

  reply	other threads:[~2025-05-05 14:26 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-04  8:59 [PATCH v11 00/16] large atomic writes for xfs John Garry
2025-05-04  8:59 ` [PATCH v11 01/16] fs: add atomic write unit max opt to statx John Garry
2025-05-04  8:59 ` [PATCH v11 02/16] xfs: only call xfs_setsize_buftarg once per buffer target John Garry
2025-05-05  5:40   ` Christoph Hellwig
2025-05-05 10:04     ` John Garry
2025-05-05 10:49       ` Christoph Hellwig
2025-05-05 10:55         ` John Garry
2025-05-05 14:22           ` Darrick J. Wong
2025-05-05 14:48             ` John Garry
2025-05-05 15:27               ` John Garry
2025-05-06  4:22                 ` Christoph Hellwig
2025-05-06  6:57                   ` John Garry
2025-05-04  8:59 ` [PATCH v11 03/16] xfs: add helpers to compute log item overhead John Garry
2025-05-04  8:59 ` [PATCH v11 04/16] xfs: add helpers to compute transaction reservation for finishing intent items John Garry
2025-05-04  8:59 ` [PATCH v11 05/16] xfs: rename xfs_inode_can_atomicwrite() -> xfs_inode_can_hw_atomic_write() John Garry
2025-05-04  8:59 ` [PATCH v11 06/16] xfs: ignore HW which cannot atomic write a single block John Garry
2025-05-05  5:43   ` Christoph Hellwig
2025-05-05  5:45     ` John Garry
2025-05-05  8:12       ` John Garry
2025-05-05  8:30         ` Christoph Hellwig
2025-05-05 14:24           ` Darrick J. Wong
2025-05-04  8:59 ` [PATCH v11 07/16] xfs: allow block allocator to take an alignment hint John Garry
2025-05-04  8:59 ` [PATCH v11 08/16] xfs: refactor xfs_reflink_end_cow_extent() John Garry
2025-05-04  8:59 ` [PATCH v11 09/16] xfs: refine atomic write size check in xfs_file_write_iter() John Garry
2025-05-04  8:59 ` [PATCH v11 10/16] xfs: add xfs_atomic_write_cow_iomap_begin() John Garry
2025-05-04  8:59 ` [PATCH v11 11/16] xfs: add large atomic writes checks in xfs_direct_write_iomap_begin() John Garry
2025-05-04  8:59 ` [PATCH v11 12/16] xfs: commit CoW-based atomic writes atomically John Garry
2025-05-04  8:59 ` [PATCH v11 13/16] xfs: add xfs_file_dio_write_atomic() John Garry
2025-05-04  8:59 ` [PATCH v11 14/16] xfs: add xfs_calc_atomic_write_unit_max() John Garry
2025-05-05  5:25   ` Darrick J. Wong
2025-05-05  6:08     ` John Garry
2025-05-05  8:02       ` John Garry
2025-05-05 14:26         ` Darrick J. Wong [this message]
2025-05-04  8:59 ` [PATCH v11 15/16] xfs: update atomic write limits John Garry
2025-05-04  8:59 ` [PATCH v11 16/16] xfs: allow sysadmins to specify a maximum atomic write limit at mount time John Garry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250505142605.GI1035866@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=brauner@kernel.org \
    --cc=catherine.hoang@oracle.com \
    --cc=cem@kernel.org \
    --cc=dchinner@redhat.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=john.g.garry@oracle.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.