From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-133.mta0.migadu.com [91.218.175.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAE373B6356 for ; Tue, 13 Oct 2026 08:40:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791880807; cv=none; b=Tnvi7jguJi0kOenHW2+iOeZwfyxYiff4hd0+DUyWO4n2BaCDRlf8isT2Ah2wdBGhXLP/zPFjzx4qrk16ZdvOLuEI2BSvJjoxRwNGVKsJizsUTsHFNeUwV6eeWb1IA+sgS5N+nZzC/0KHJI73SLShbn28xB+P+maMZfUFXUc+Ht4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791880807; c=relaxed/simple; bh=O2VyeBUpyQZ7N4gxSQ/4x9ZYwCTMTmWwc5NCJmvVYgw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=FsgdopLmojZkDPAw6VTFgVNjvpW1y48w4+dh+nO2Cmbcoevs7694B5gqO5/Eceuyzue93BOtnWtMwQE6lYguDWtS9AVpL14oN1Pzxhti3dZWuebbHUNu/83uEbq3pp825JE6ztdC/0i5cvsj15pdnikbHhBhPynaOILDQxSCXso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=DvAgELRx; arc=none smtp.client-ip=91.218.175.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DvAgELRx" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=O2VyeBUpyQZ7N4gxSQ/4x9ZYwCTMTmWwc5NCJmvVYgw=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1791880803; v=1; x=1792485603; b=DvAgELRxVhrmYuvDH1Kc13AqY31vCbo5CtVXdfVZ0Kh88eJ7kVBo7TNu6RIHh0hM4fviV5M2 B8QrA74hNBxEpiYdfnSRb8BQJ+ARiNHkm3iWbIpj22u1q3b+gGJc6p6swEKeJnBgdypDjKKjtln o6Qu9/hAGAZb19fC0vESFEXs= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id 8b2403653d9a654d; Tue, 13 Oct 2026 08:40:02 +0000 X-Mizu-Trace-ID: 8b2403653d9a654d X-Migadu-Flow: FLOW_OUT Message-ID: <82978d5c-3e08-48e9-bf0a-7913e1cd0507@linux.dev> Date: Tue, 13 Oct 2026 09:40:01 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 5/9] block: fail a short atomic pin in bio_iov_iter_get_pages() To: Tal Zussman , Jens Axboe , Christoph Hellwig , Johannes Thumshirn , Luis Chamberlain , Hannes Reinecke , "Matthew Wilcox (Oracle)" , Christian Brauner , "Darrick J. Wong" , Keith Busch , "Martin K. Petersen" Cc: Shin'ichiro Kawasaki , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Sashiko References: <20261009-blkdev-fixes-v6-0-307939c387df@columbia.edu> <20261009-blkdev-fixes-v6-5-307939c387df@columbia.edu> Content-Language: en-US From: John Garry In-Reply-To: <20261009-blkdev-fixes-v6-5-307939c387df@columbia.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/9/26 17:50, Tal Zussman wrote: > On a partial page pin, __blkdev_direct_IO_simple() and > __blkdev_direct_IO_async() submit what was pinned with REQ_ATOMIC set > and leave the rest to the buffered fallback, tearing an IOCB_ATOMIC > write. > > This can be triggered deterministically. A 16K pwritev2(RWF_ATOMIC) > whose last page is PROT_NONE, on a scsi_debug device with atomic_wr=1, > completes short with only three of the four pages written, violating > RWF_ATOMIC semantics. > > Make bio_iov_iter_get_pages() release the pins and return -EINVAL when > a REQ_ATOMIC bio doesn't cover the whole iterator, since an atomic > write is submitted as a single bio and a short one would be torn. That > covers iomap as well, where a partially unmapped buffer could trip the > WARN_ON_ONCE() in iomap_dio_bio_iter_one(). The async block device path > currently sets REQ_ATOMIC after pinning, so set it before, and move > REQ_NOWAIT along with it. > > Fixes: caf336f81b3a ("block: Add fops atomic write support") > Reported-by: Sashiko > Link:https://sashiko.dev/#/patchset/20260802-blkdev-fixes-v1-0- > a82fc549fd74%40columbia.edu?part=2 > Assisted-by:Claude:claude-fable-5 > Reviewed-by: John Garry > Reviewed-by: Hannes Reinecke > Signed-off-by: Tal Zussman I think that you can now remove the REQ_ATOMIC check after the iomap_dio_bio_iter_one() -> bio_iov_iter_get_pages() call also; however, considering the trees, it's better to wait until 7.4-rc1 is released. Thanks, John