From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-00364e01.pphosted.com (mx0b-00364e01.pphosted.com [148.163.139.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7B293AB48C for ; Sun, 2 Aug 2026 11:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.139.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785669303; cv=none; b=YnLENYiaCmib9SnAWkAgd6UVo9AHv6xW9bBVT03mIZeVhg49DTa8zoTy8RLIKmWUFB3NyQfjLLrj/UGRYbDkgfC2A2N2KQ9KzpCkTIj8bZl0OgQgfaJ1WzWyvMZG8vqSkQhdgXbwaaQvxzqh0CZBOIQC4QjXcNQGpH0k1KmogAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785669303; c=relaxed/simple; bh=nqi5SVdPgj60DLFNV8hMjaRd+M1KFnZMQ4Z04XcbmX8=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=IytPBGporINJmRnr5WssgK057wqPg1j16FSdNsRXREL0MD/W+U/Yb6vOVkkmFP4u84bAshzByGw3fREHpsbsxFdWyH+Jj3uR+7MOwnUOfV8BVhM1xA0xeRA/zDDWSYHiTISYfGAg+wlw92k3m1DXPMQJ57TXQ2PNZwE/2Wo0PVk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=columbia.edu; spf=pass smtp.mailfrom=columbia.edu; dkim=pass (2048-bit key) header.d=columbia.edu header.i=@columbia.edu header.b=BDBkrbYr; arc=none smtp.client-ip=148.163.139.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=columbia.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=columbia.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=columbia.edu header.i=@columbia.edu header.b="BDBkrbYr" Received: from pps.filterd (m0167073.ppops.net [127.0.0.1]) by mx0b-00364e01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 672AvkiS3406250 for ; Sun, 2 Aug 2026 07:14:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=columbia.edu; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pps01; bh=OXHOQJXSYXpIJM0xdhOE9lspGw 2ZMSlGLW2FlW8SCII=; b=BDBkrbYr6PIV+rfhIgek7RHchg1+Dyg9fS6UPkkaZf VehfN8TL9oyieCGPmxryoffga2fKUtcW/Lg63Wrlc4G2BQ1jtN0nrpMntoK5PXpf thGjYtVz8K3v62uoyTZLVbXkKDLRctViJxA1kRweKntokcrf/qw7taizzBnFanR2 xYOkDxOomAv78zrnsbyB9QwWjNo71oDfhLU+z72HvDaYxwlxy95beuJic1BHiLws HqfdAapO3qgD3qfczK5cvSYQhfoErrLu9iuDp6DZC46dFuEC09tho4wmKu/nlFeH SzwUG77QAo6diIxKmORs0UyEW7IC8rAenov5Igetwm8Q== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0b-00364e01.pphosted.com (PPS) with ESMTPS id 4fscp9vfud-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 02 Aug 2026 07:14:54 -0400 (EDT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-92e4f946461so265294485a.2 for ; Sun, 02 Aug 2026 04:14:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785669293; x=1786274093; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=OXHOQJXSYXpIJM0xdhOE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4T+nfiUO1HznGKUaq1tTbARHD4+HDpuxTsOIxyQbXOxwfQ= X-Received: by 2002:a05:622a:1e0f:b0:51c:21d1:3852 with SMTP id d75a77b69052e-52b5676001fmr131469891cf.5.1785669293671; Sun, 02 Aug 2026 04:14:53 -0700 (PDT) X-Received: by 2002:a05:622a:1e0f:b0:51c:21d1:3852 with SMTP id d75a77b69052e-52b5676001fmr131469531cf.5.1785669293198; Sun, 02 Aug 2026 04:14:53 -0700 (PDT) Received: from [127.0.1.1] (CBL217-132-158-98.bb.netvision.net.il. [217.132.158.98]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49807b917efsm208062155e9.11.2026.08.02.04.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2026 04:14:52 -0700 (PDT) From: Tal Zussman Subject: [PATCH 0/2] block device write path fixes Date: Sun, 02 Aug 2026 07:14:25 -0400 Message-Id: <20260802-blkdev-fixes-v1-0-a82fc549fd74@columbia.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAJEmb2oC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDCwND3aSc7JTUMt20zIrUYl1zc8Mkw2RjQ5PUpCQloJaColSwBFBHdCy EX1yalJWaXAIyQ6m2FgD3nb7rcAAAAA== X-Change-ID: 20260801-blkdev-fixes-771b1c314ebb To: Jens Axboe , Johannes Thumshirn , Luis Chamberlain , "Darrick J. Wong" , Christoph Hellwig Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Tal Zussman , Sashiko X-Mailer: b4 0.14.3-dev-d7477 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785669291; l=1456; i=tz2294@columbia.edu; s=20250528; h=from:subject:message-id; bh=nqi5SVdPgj60DLFNV8hMjaRd+M1KFnZMQ4Z04XcbmX8=; b=d9AErRvGwo1lUJ92LIPfsJlRo3HzhJudn+bijpjys+m3YIMM2zOBVnOksQKR2piG5erwJROsu cSe/4U3lOddBYzLDF3b+YWpbR681o2wTmRG7JhR86uZDto0tkuujKID X-Developer-Key: i=tz2294@columbia.edu; a=ed25519; pk=BIj5KdACscEOyAC0oIkeZqLB3L94fzBnDccEooxeM5Y= X-Proofpoint-Spam-Info: AW1haW4tMjYwODAyMDA5NSBTYWx0ZWRfX9H6GczT8DyyP zkwy+A073e7VbCU6KwVwZFq8KHUlNrypQxcq97arKXZMEhekX2qe/Rh2lwVlhp4Iopnku6nfyrS Pa95GBUSIGhShJlfWhpPZ+qZE/K69NiI0i1fa07Jua2kIfqRhs7Z X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODAyMDA5NSBTYWx0ZWRfXyVe0Aas6lAt6 +V9XNK82scS4skEun9lYx/ArXqq/ranUEot7qRfXg57+BGzld4roC8khWSgn12Wavx7g5adllj4 1MqwsyExzdxVu3pn+7RaeigEnCZWf7peIcSaFvckPARkICLLD1mxe/N/FfXsbwE0+zkKwCN7ys6 bIpnIdW06OuuMVM1E5polH5erKWRq2ezT0kCzL2nhha4ku98vWT2DJrRWxXCHwIBB6qm3BD4D7G KaRqnRKRcyRtqxRgF9K/xXxsLi96dkEC0VhyGLfKN6Inrq4oGj3KFfvBQfxRamq7GiR1dmagkGb To3lpLtLpDSlo5V4ZtNpOKIVYfCOU1XgmuixTpwDB1lqi0iBO78bwwvNVL9qTKy4N9AUEa63dkt xp1F3UC64fq4z8ThRciZ3/4qnGHjvtipsuSRVSc9iKIVRpHrX+E0APPpFq8TE/fk/92xF8yX71+ 1swWKgJcl2cgEuf77iA== X-Authority-Analysis: v=2.4 cv=T4q8ifKQ c=1 sm=1 tr=0 ts=6a6f26ae cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=C4zMR0+CEq2lM/mtmjScOA==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=x7bEGLp0ZPQA:10 a=VkNPw1HP01LnGYTKEx00:22 a=Da8U98TiO7q1upZEImrf:22 a=jHxIr1HyPKZ_Q5_91PL3:22 a=VwQbUJbxAAAA:8 a=VfL1AaAevc5-fGJ07oQA:9 a=QEXdDO2ut3YA:10 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-ORIG-GUID: YpMPYLBPdT58jJc-mgAn3Mb6qOwKqn9Z X-Proofpoint-GUID: YpMPYLBPdT58jJc-mgAn3Mb6qOwKqn9Z X-Proofpoint-Virus-Version: vendor=nai engine=6900 definitions=11862 signatures=596817 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=10 suspectscore=0 phishscore=0 malwarescore=0 lowpriorityscore=10 clxscore=1015 spamscore=0 priorityscore=1501 impostorscore=10 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608020095 Two independent fixes for the block device write path. Both issues were found by Sashiko during review of the "block: enable RWF_DONTCACHE for block devices" series [1] and are independent of it. Patch 1 fixes silently lost mmap writes with CONFIG_BUFFER_HEAD=n: def_blk_aops uses filemap_dirty_folio, which does not set the per-block dirty bits in the folio's iomap_folio_state, so writeback finds no dirty blocks and submits no I/O. Patch 2 makes blkdev_write_iter() take i_rwsem shared around the buffered-write fallback for a partial direct I/O write. The fallback currently runs with no lock held and races set_blocksize() changing i_blkbits and the mapping's minimum folio order, which can trip VM_BUG_ON_FOLIO in __filemap_add_folio() on kernels with block sizes above PAGE_SIZE. Both issues are currently unlikely to be hit in practice due to the specific configurations required to trigger them. [1] https://lore.kernel.org/all/20260730-blk-dontcache-v7-0-3e8e6850068d@columbia.edu/ Signed-off-by: Tal Zussman --- Tal Zussman (2): block: use iomap_dirty_folio for block devices block: take i_rwsem for the direct I/O write fallback block/fops.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff change-id: 20260801-blkdev-fixes-771b1c314ebb Best regards, -- Tal Zussman