Skip to content

nbd: NBD_CLEAR_SOCK races with buffered writes and triggers mark_buffer_dirty() warning#1016

Open
blktests-ci[bot] wants to merge 4 commits into
for-next_basefrom
series/1117579=>for-next
Open

nbd: NBD_CLEAR_SOCK races with buffered writes and triggers mark_buffer_dirty() warning#1016
blktests-ci[bot] wants to merge 4 commits into
for-next_basefrom
series/1117579=>for-next

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 28, 2026

Copy link
Copy Markdown

Pull request for series with
subject: nbd: NBD_CLEAR_SOCK races with buffered writes and triggers mark_buffer_dirty() warning
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1117579

axboe and others added 4 commits June 24, 2026 06:44
* io_uring-7.2:
  io_uring/memmap: bound io_pin_pages() by page array byte size
  io_uring: Use system_dfl_wq instead of system_unbound_wq
  io_uring/register: preserve SQ array entries on resize
  io_uring, audit: don't log IORING_OP_RECV_ZC
  io_uring: get rid of tw_pending for !DEFER task work
  io_uring/rw: preserve partial result for iopoll
  io_uring/nop: fix file reference leak with IOSQE_FIXED_FILE
* block-7.2: (43 commits)
  block, bfq: don't grab queue_lock to initialize bfq
  mm/page_io: don't nest queue_lock under rcu in bio_associate_blkg_from_page()
  blk-cgroup: don't nest queue_lock under blkcg->lock in blkcg_destroy_blkgs()
  blk-cgroup: don't nest queue_lock under rcu in bio_associate_blkg()
  blk-cgroup: don't nest queue_lock under rcu in blkg_lookup_create()
  blk-cgroup: don't nest queue_lock under rcu in blkcg_print_blkgs()
  blk-cgroup: delay freeing policy data after rcu grace period
  blk-cgroup: protect iterating blkgs with blkcg->lock in blkcg_print_stat()
  md/raid5: avoid R5_Overlap races while breaking stripe batches
  md/raid5: use stripe state snapshot in break_stripe_batch_list()
  blk-cgroup: defer blkcg css_put until blkg is unlinked from queue
  blk-cgroup: fix UAF in __blkcg_rstat_flush()
  block, bfq: protect async queue reset with blkcg locks
  nbd: don't warn when reclassifying a busy socket lock
  block: fix incorrect error injection static key decrement
  md/raid5: let stripe batch bm_seq comparison wrap-safe
  md/raid1: protect head_position for read balance
  md/raid1: free r1_bio when REQ_NOWAIT is set and read would block on retry
  md/raid1: honor REQ_NOWAIT when waiting for behind writes
  md/raid5: always convert llbitmap bits for discard
  ...
* block-7.2:
  block: handle REQ_OP_ZONE_APPEND in __bio_integrity_action
  block: fix GFP_ flags confusion in bio_integrity_alloc_buf
@blktests-ci

blktests-ci Bot commented Jun 28, 2026

Copy link
Copy Markdown
Author

Upstream branch: 523fc0d
series: https://patchwork.kernel.org/project/linux-block/list/?series=1117579
version: 1

Pull request is NOT updated. Failed to apply https://patchwork.kernel.org/project/linux-block/list/?series=1117579
error message:

Cmd('git') failed due to: exit code(128)
  cmdline: git am --3way
  stdout: 'Applying: nbd: NBD_CLEAR_SOCK races with buffered writes and triggers mark_buffer_dirty() warning
Using index info to reconstruct a base tree...
M	fs/buffer.c
Falling back to patching base and 3-way merge...
Auto-merging fs/buffer.c
CONFLICT (content): Merge conflict in fs/buffer.c
Patch failed at 0001 nbd: NBD_CLEAR_SOCK races with buffered writes and triggers mark_buffer_dirty() warning
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".'
  stderr: 'error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch'

conflict:

diff --cc fs/buffer.c
index 9af5f061a1f8,d5937b193ed2..000000000000
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@@ -54,6 -57,47 +57,50 @@@
  
  #include "internal.h"
  
++<<<<<<< HEAD
++=======
+ static void submit_bh_wbc(blk_opf_t opf, struct buffer_head *bh,
+ 			  enum rw_hint hint, struct writeback_control *wbc);
+ 
+ static unsigned int nbd_block_commit_delay_ms;
+ 
+ /*
+  * Parse the test-only delay that widens the block_commit_write() window for
+  * NBD buffer_heads.
+  */
+ static int __init nbd_block_commit_delay_setup(char *str)
+ {
+ 	if (kstrtouint(str, 0, &nbd_block_commit_delay_ms))
+ 		nbd_block_commit_delay_ms = 0;
+ 	return 1;
+ }
+ __setup("nbd_block_commit_delay_ms=", nbd_block_commit_delay_setup);
+ 
+ /* Return whether a buffer_head belongs to an NBD block device. */
+ static bool buffer_head_is_nbd(struct buffer_head *bh)
+ {
+ 	if (!bh->b_bdev)
+ 		return false;
+ 	return MAJOR(bh->b_bdev->bd_dev) == NBD_MAJOR;
+ }
+ 
+ /*
+  * Delay after BH_Uptodate is set but before mark_buffer_dirty() checks it, so
+  * NBD_CLEAR_SOCK has a larger window to complete an old writeback with IOERR.
+  */
+ static void nbd_block_commit_delay(struct buffer_head *bh)
+ {
+ 	unsigned int delay_ms = READ_ONCE(nbd_block_commit_delay_ms);
+ 
+ 	if (!delay_ms || !buffer_head_is_nbd(bh))
+ 		return;
+ 
+ 	pr_info_ratelimited("nbd-block-commit-delay: delaying %u ms for bh=%p b_state=0x%lx bdev=%pg\n",
+ 			    delay_ms, bh, bh->b_state, bh->b_bdev);
+ 	msleep(delay_ms);
+ }
+ 
++>>>>>>> nbd: NBD_CLEAR_SOCK races with buffered writes and triggers mark_buffer_dirty() warning
  #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
  
  inline void touch_buffer(struct buffer_head *bh)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant