Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp156431rwd; Mon, 12 Jun 2023 11:27:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SvCKmqe2NgBgD26Sn3QcnRSN5tN+vdgqX7tKGVyLF05ayDFKNwbraLrM95LSpH53Fi92O X-Received: by 2002:a05:6a00:23c2:b0:661:fc6e:79eb with SMTP id g2-20020a056a0023c200b00661fc6e79ebmr14516158pfc.18.1686594439884; Mon, 12 Jun 2023 11:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686594439; cv=none; d=google.com; s=arc-20160816; b=fxr1yNGOYrND05FLsJtEtltN4Dln/DtgInKHmVDQRmAXrOgD6PaWr0ZhrM6ub+Nb1F XzrdekAkBl4CRK8qBUImKqi+9oGt/6uOymOzb6UogYtRdOwGWWFhN6j6Y+aqxuIb/CZ9 cJyegn+f/GiN2+zQKwYRf1GZakrbzZot9M8EIbya5vn4NOog71g0Znz8iMXRvRgYwTZT R9PtX48/RgE8OpMqUJCqsaNVYBiEDEFMGiGqLxJIksxzENJsCneF4L0OSBNb6FynSXgH oQ0dqWbyIygrKdcZ1q6tU3eb10Ar7W803vF56fomKrxGiVuMiN7VaWInW4ZHHBkTZAuT 9r5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=t5DZgHucTuBubeLhV3T9WqifJUJkPozlNW7FILd0G0A=; b=OEskAgFuYFsN+HKxVmfhppZongveKNwDx4RokbJY29V2u9tC3sQ2jQCxWNo0cm2tSc yy34NiLALQaMCekFuDgl3Rk1WTA5DTz/VEqVy29HUTckDMO+hApXSlK0fOpm4bLHNxV1 3vCn8v1GjxoB3fnweyRaRH7WoqnOPcZv9gS+xV/+HXK5hscNRqa+8a+Ic7OcPPF3m4NK Aa4SxfHRfRXt951Bxgd/NtBnSrwiDaVwEP6d+5jygx/Bc++vPAjEM3VmvmhtiIsfDTaA dxMmdjGC1vzBHizRpnZWxdMMDgVJCtlKRFXMHXsOmUvKScmvgt8Os5ZecyqQx1fX8oL3 HpDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q5V0lsqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 130-20020a621888000000b00665b701f036si430301pfy.161.2023.06.12.11.27.05; Mon, 12 Jun 2023 11:27:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q5V0lsqv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237391AbjFLSQe (ORCPT + 99 others); Mon, 12 Jun 2023 14:16:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbjFLSQb (ORCPT ); Mon, 12 Jun 2023 14:16:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67971E64 for ; Mon, 12 Jun 2023 11:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686593749; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t5DZgHucTuBubeLhV3T9WqifJUJkPozlNW7FILd0G0A=; b=Q5V0lsqvph9E2I/xPyyO59CJeiUJXHVmDINk8z03+USExLKvs8SjP5u/dBSnPbKofjlexA R/YUWLIVmGLWaope5i8IfplL+uOi3HFOkiMrwKPlYs57vyIlzEkWkfOrfRq6BDdcPVxH0+ +wkYDNqdKfxE0Pgdyf+eBPjcKNLIAEY= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-543-MXtKb2JBMxGFY0Z4GxAtwA-1; Mon, 12 Jun 2023 14:15:48 -0400 X-MC-Unique: MXtKb2JBMxGFY0Z4GxAtwA-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-30e4d85e1ffso6992809f8f.0 for ; Mon, 12 Jun 2023 11:15:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686593746; x=1689185746; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t5DZgHucTuBubeLhV3T9WqifJUJkPozlNW7FILd0G0A=; b=R1Rdo/acnCjYLZed1NUWeRMUzp1R8bqWSqIceQcaMHEI+YZMG+/e7Xx3rr7+8uYlQ5 ysOvMQwMByDujb2AExZw0F/b3vyDt5JyaD2GE0/pyNYUzRY1wAiUTIcA9/vsNjJOJ4kw 2TmCbBu8ee9a00XYjWqdcfi+YOLFVUq10+IilOgqjWo3rnussDsQdA0w31Nvra/cJSV5 YkUiA/YzacTlmzQkLZIanMqkMmA1ajL7G7qqkcxREEVH730j8Y/xDaav6oSSAZMRRabV 6Bjli3DJjnBMnXdog0b7qdgUuPJ1eyHLqCDKpssqNnrnrvlnsHKtzfauPUj2GtJUIWeh 2qxQ== X-Gm-Message-State: AC+VfDzlSHjh9+tyKAl5k4XWmUfDZwBFu0UCZg0doKlxjuh5VpjY027S pqVEAeYb247cItKLqMa2am9d86dZXgkvqrS12r4x/1Vx7HMNYhxnqGvzStptltuOMcD8Fi+W5wu f+iYDB62qzfPUfn2gnq6530Lq X-Received: by 2002:a5d:6b8c:0:b0:30a:c35d:25d3 with SMTP id n12-20020a5d6b8c000000b0030ac35d25d3mr6431407wrx.52.1686593746407; Mon, 12 Jun 2023 11:15:46 -0700 (PDT) X-Received: by 2002:a5d:6b8c:0:b0:30a:c35d:25d3 with SMTP id n12-20020a5d6b8c000000b0030ac35d25d3mr6431395wrx.52.1686593746063; Mon, 12 Jun 2023 11:15:46 -0700 (PDT) Received: from ?IPV6:2003:cb:c74e:1600:4f67:25b2:3e8c:2a4e? (p200300cbc74e16004f6725b23e8c2a4e.dip0.t-ipconnect.de. [2003:cb:c74e:1600:4f67:25b2:3e8c:2a4e]) by smtp.gmail.com with ESMTPSA id a10-20020a5d4d4a000000b0030fc079b7f3sm4262655wru.73.2023.06.12.11.15.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jun 2023 11:15:45 -0700 (PDT) Message-ID: Date: Mon, 12 Jun 2023 20:15:44 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] block: Fix dio_bio_alloc() to set BIO_PAGE_PINNED Content-Language: en-US To: David Howells , Jens Axboe , kernel test robot Cc: Christoph Hellwig , Andrew Morton , Al Viro , Matthew Wilcox , Jan Kara , Jeff Layton , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , Christian Brauner , Lorenzo Stoakes , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, oe-lkp@lists.linux.dev, lkp@intel.com, linux-kernel@vger.kernel.org References: <431929.1686588681@warthog.procyon.org.uk> From: David Hildenbrand Organization: Red Hat In-Reply-To: <431929.1686588681@warthog.procyon.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.06.23 18:51, David Howells wrote: > > Fix dio_bio_alloc() to set BIO_PAGE_PINNED, not BIO_PAGE_REFFED, so that > the bio code unpins the pinned pages rather than putting a ref on them. > > The issue was causing: > > WARNING: CPU: 6 PID: 2220 at mm/gup.c:76 try_get_folio > > This can be caused by creating a file on a loopback UDF filesystem, opening > it O_DIRECT and making two writes to it from the same source buffer. > > Fixes: 1ccf164ec866 ("block: Use iov_iter_extract_pages() and page pinning in direct-io.c") > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-lkp/202306120931.a9606b88-oliver.sang@intel.com > Signed-off-by: David Howells > cc: Christoph Hellwig > cc: David Hildenbrand > cc: Andrew Morton > cc: Jens Axboe > cc: Al Viro > cc: Matthew Wilcox > cc: Jan Kara > cc: Jeff Layton > cc: Jason Gunthorpe > cc: Logan Gunthorpe > cc: Hillf Danton > cc: Christian Brauner > cc: Linus Torvalds > cc: linux-fsdevel@vger.kernel.org > cc: linux-block@vger.kernel.org > cc: linux-kernel@vger.kernel.org > cc: linux-mm@kvack.org > --- > fs/direct-io.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/direct-io.c b/fs/direct-io.c > index 14049204cac8..04e810826ee8 100644 > --- a/fs/direct-io.c > +++ b/fs/direct-io.c > @@ -415,7 +415,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio, > else > bio->bi_end_io = dio_bio_end_io; > /* for now require references for all pages */ Does the comment still hold? > - bio_set_flag(bio, BIO_PAGE_REFFED); > + if (dio->need_unpin) > + bio_set_flag(bio, BIO_PAGE_PINNED); > sdio->bio = bio; > sdio->logical_offset_in_bio = sdio->cur_page_fs_offset; > } > -- Cheers, David / dhildenb