From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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 458DA23EAAE for ; Mon, 8 Dec 2025 17:21:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765214486; cv=none; b=hT7Bz2QJADVkMlQ3aPGIZ9NG8Z/XhbQZaOxLDe1k/p16vujEISQYzTmFjd4Ih5ki+SAAsvI/D9BvR0d3nFSWDJvpZB6HsiBO3XFNS8h7KbyWs0FVwJtoac64r7Z88dXf84R0HB8EI52KrW6VQ2wuVD7LAwh/FctX1n/7SjuwhAU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765214486; c=relaxed/simple; bh=58IBorTfmU4uDxhBSWnSUuJZWpGW4TpbGkMXG7s3Rek=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l7PEGqqKTVL0SSNyHZ9lNMjLetXK/34JYW/5H1atnkIFlakguoKlRMq9dOlgEwUiDU+1rZ5tLAcjeWSbmX1p8F8A8qjmAIXntQQQ0lwZx1GhHBi7elP6k0xGjrtFrpHlT692JHZh5WsSRZHgvOtZJVfyuBuVbj42vyMh9Ko2HGs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com; spf=pass smtp.mailfrom=cloudflare.com; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b=fuGLiDgd; arc=none smtp.client-ip=209.85.160.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="fuGLiDgd" Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-3e80c483a13so3943373fac.2 for ; Mon, 08 Dec 2025 09:21:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google09082023; t=1765214484; x=1765819284; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GhPMrWpz1eQdpSXVpfBQ716e8Gxsn6bVq0Q9mSHX8u0=; b=fuGLiDgdjPC56vVL+jOuQUDVJzZyus8tjlUZoyrAem9qmmZAG9wbUD2I1Sa+gtmPo6 4XOoNlb4yWx5wZCccVSxnNDvoHKzCkAk9Vm71SifT9FS+dS7+Qjd8wmmwzDqTJ71wy4O KoVgzTUjZhraXV57VA5r7Y4fkLvzWoz0izf++kGG7F+R3OVobOKHRtk6F7gmUZwsl34n LLR8//d0dAweIWMt+XjxkpVssMsju28iU7gSX0K3DTNthxmtKfdwPiHY0qLaG+7R3eT9 Gjxxi2HUM2Q1xizEb/Xk1f4uW+0EBI70Xz2LADrYU/vdOZEpaW69Z74vjSaEYz6Y2Hov dzsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765214484; x=1765819284; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GhPMrWpz1eQdpSXVpfBQ716e8Gxsn6bVq0Q9mSHX8u0=; b=JiveYY38QrVkqs+7yuhMpszqNHqfv7i2hujWJxIqNrikYJNkNdGONCcSyE7O9+fXWU uQfE0RexKZ6G9PCdz4WqVGl/UY4ViuI9uozCNgntKFUrcTPoIQkC76hQdqI/vSu+ldKe zEYei1PqxEJl/GSjfYxxsyizzKG2mawZWLBHa2WbO42dSk2fQVVa3ribkwl/xnfJxk0c q4NfU4VzeOyhCBsOdT1IOo4tDkGxuUzV0zgTj1nOCI8ZqieVlvlT0pR965j6ne73lFHt XZ6QeVnfct0sZnaa/S1LqoWcTOOhrHJbW1ZBcK4gTrlGF+CUZLnlm9PomnQ+tuOf6eK6 KNbQ== X-Forwarded-Encrypted: i=1; AJvYcCUc1riLf3oAi9dG6cLGWpzxaETa3oKdyCMiGe8AfllPSJ+UTpDRWicD/NskSgRFWVvZcY53vrk8Y4iXbcM=@vger.kernel.org X-Gm-Message-State: AOJu0YwimEoz6zXs257EFTtpoVQq9aTXlDkn2fjU49ym4vev3ZczH9aR uYrjOiSgxi9+zx8M2msOx7jwzzGCD4o6ah+6VTwMX1oknxVbqvFJAKgsdQPTvZLIXHY= X-Gm-Gg: ASbGncvI1fko6majCMFjr1qNJtAPYiRIHz7q1mI8FxbWzo4LbfKWD0Xx+f1UyhL2bN5 U6kUgQvpz5R6Xyd4RFwht5wee9b3uQ1ETaKf542mEY2HIA9zV7jIdP/rjsiawvMZkbNlCiH5wJW 4QztyKlUqlBCzRKec3VSEkqxlMkCi1/WTqRc2RSkm3MHp0oCmjer4jMF3T+ayi0Qa4+naOj3sO5 /zSitqFycXpwzoBp+ZRcwEP9QL2eQqgj8DJZ9W/Qno/8ht8aiywmXcaZDZc/zACsr1v+AsR7y/j ypGGhqMmeyxRKJv55azGKM456Z2oBb2RjObKF2Snf9RbF06iCM/s2gq35gPWZ1TsQaYjINjJjHl X2cConbS3uYso33pjlLKW0W/RFAaU2lQvLgUaAjnC/wzlB0NcAPkf+ocD7RS7UL49g4wYHPc= X-Google-Smtp-Source: AGHT+IECgGHbNEhUfjt57ooHzsGKSD3RZhEl51RBJQ/aq3BU3oY5jPZpKWy80c6MtcCdkgMJ57fipw== X-Received: by 2002:a05:6870:c191:b0:3ec:3d84:3c51 with SMTP id 586e51a60fabf-3f544194db0mr2994393fac.49.1765214483639; Mon, 08 Dec 2025 09:21:23 -0800 (PST) Received: from 861G6M3 ([2a09:bac1:76a0:540::22d:109]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-3f50b5ed5a7sm8916428fac.22.2025.12.08.09.21.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Dec 2025 09:21:22 -0800 (PST) Date: Mon, 8 Dec 2025 11:21:17 -0600 From: Chris Arges To: Dominique Martinet Cc: Christian Schoenebeck , Matthew Wilcox , David Howells , ericvh@kernel.org, lucho@ionkov.net, v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-team@cloudflare.com Subject: Re: kernel BUG when mounting large block xfs backed by 9p (folio ref count bug) Message-ID: References: <5945634.DvuYhMxLoT@weasel> <2245723.irdbgypaU6@weasel> 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=us-ascii Content-Disposition: inline In-Reply-To: On 2025-12-07 22:49:31, Dominique Martinet wrote: > Chris, > > I'm not sure why but I can't reproduce with your .config either :/ > If you can still reproduce this reliably, could you try with the > following diff applied (which is basically the same as what Christian > suggested a couple of days ago with also ubuf, whatever that is) > ------------ > diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c > index 10c2dd486438..f7ee1f864b03 100644 > --- a/net/9p/trans_virtio.c > +++ b/net/9p/trans_virtio.c > @@ -318,7 +318,7 @@ static int p9_get_mapped_pages(struct virtio_chan *chan, > if (!iov_iter_count(data)) > return 0; > > - if (!iov_iter_is_kvec(data)) { > + if (user_backed_iter(data)) { > int n; > /* > * We allow only p9_max_pages pinned. We wait for the > ----------- > Dominique, I can still reproduce this easily. If I apply this patch, I no longer get the crash. If this patch ends up being applied feel free to add: Tested-By: Chris Arges Happy to test other iterations as well. --chris > > > Willy, > > Matthew Wilcox wrote on Sun, Dec 07, 2025 at 07:18:02AM +0000: > > In readahead, we allocate a folio, lock it and add it to the page cache. > > We then submit it to the filesystem for read. It cannot be truncated > > from the page cache until the filesystem unlocks it (generally by calling > > folio_end_read() but some filesystems explicitly call folio_unlock() > > instead). So you don't need to take an extra reference to it. > > Thanks. > > My main problem with this all is that trans_virtio adds the buffers to > the virtio virtqueue but does nothing to take it off if > wait_event_killable() in virtio_request() gets killed, but looking at it > even in the code path that gets a ref the code will happily drop the ref > even before the flush is over so I guess there's no reason to actively > try to pin kernel pages... > > I'd sleep better if there was a way to remove (detach?) the buffer from > the virtqueue but I can't see how to do that without breaking something > else, so I guess we'll have to live with that behavior unless someone > knows better. > > -- > Dominique Martinet | Asmadeus