io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Yang Xiuwei <yangxiuwei@kylinos.cn>
Cc: clm@fb.com, dsterba@suse.com, quwenruo.btrfs@gmx.com,
	linux-btrfs@vger.kernel.org, io-uring@vger.kernel.org
Subject: Re: [PATCH v3 0/5] btrfs: fix io_uring encoded IO cleanup
Date: Mon, 21 Sep 2026 14:49:27 +0200	[thread overview]
Message-ID: <20260921124927.GC54722@twin.jikos.cz> (raw)
In-Reply-To: <20260819025436.1949152-1-yangxiuwei@kylinos.cn>

On Wed, Aug 19, 2026 at 10:54:31AM +0800, Yang Xiuwei wrote:
> Hi,
> 
> Fixes for the io_uring ENCODED_READ / ENCODED_WRITE cleanup paths.
> 
> 1. Always return -EIOCBQUEUED after endio so the caller and
>    btrfs_uring_read_finished() do not both clean up.
> 
>    Link: https://lore.kernel.org/linux-btrfs/20260630091609.3414-1-samsun1006219@gmail.com/
> 
> 2. btrfs_uring_read_extent() failure skipped kfree(data->iov).
> 
> 3. Unlock inode/extent in the caller on read-extent failure.
> 
> 4. Do not stash encoded data in the cmd PDU across -EAGAIN.
> 
> 5. Drop the unused REISSUE restore.
> 
> v2 also exported __import_iovec() and passed IO_URING_F_COMPAT.
> That is not a bug with the current io_uring thread setup:
> create_io_thread() copies TS_COMPAT, so import_iovec() already
> sees compat iovecs. Passing the flag explicitly would still be a
> cleanup, but this series does not take it.
> 
> Testing:
> - xfstests btrfs/333 passed.
> - kmemleak after dropping the ring on NONBLOCK encoded write/read:
> 
>   unreferenced object (size 512):
>     comm "btrfs_uring_eag"
>     __kmalloc_cache_noprof+0x38f/0x4a0
>     btrfs_uring_encoded_write+0x78d/0x1790 [btrfs]
>     btrfs_uring_cmd+0x142/0x1d0 [btrfs]
>     io_uring_cmd+0x296/0x5e0
> 
>   unreferenced object (size 512):
>     comm "btrfs_uring_eag"
>     __kmalloc_cache_noprof+0x38f/0x4a0
>     btrfs_uring_encoded_read+0x89a/0x12b0 [btrfs]
>     btrfs_uring_cmd+0x173/0x1d0 [btrfs]
>     io_uring_cmd+0x296/0x5e0
> 
>   After 4/5 the same repro is clean.
> 
> Changes in v3:
> - Drop the __import_iovec / IO_URING_F_COMPAT patches. 
> - 3/5: drop a leftover goto out_fail from v2.

Added to for-next, thanks.

IORING_URING_CMD_REISSUE is now only used in block layer code.

      parent reply	other threads:[~2026-09-21 12:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19  2:54 [PATCH v3 0/5] btrfs: fix io_uring encoded IO cleanup Yang Xiuwei
2026-08-19  2:54 ` [PATCH v3 1/5] btrfs: always return -EIOCBQUEUED after btrfs_uring_read_extent_endio Yang Xiuwei
2026-08-19  2:54 ` [PATCH v3 2/5] btrfs: free iov when btrfs_uring_read_extent fails Yang Xiuwei
2026-08-19  2:54 ` [PATCH v3 3/5] btrfs: unlock inode and extent in caller when uring read extent fails Yang Xiuwei
2026-08-19  2:54 ` [PATCH v3 4/5] btrfs: don't stash uring encoded data across -EAGAIN Yang Xiuwei
2026-08-19  2:54 ` [PATCH v3 5/5] btrfs: drop unused uring encoded IO REISSUE stash helpers Yang Xiuwei
2026-09-01  2:09 ` [PATCH v3 0/5] btrfs: fix io_uring encoded IO cleanup Yang Xiuwei
2026-09-07 17:55   ` David Sterba
2026-09-21 12:49 ` David Sterba [this message]

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=20260921124927.GC54722@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=yangxiuwei@kylinos.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).