Message ID | 20240129094924.1221977-2-dhowells@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-42491-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp458618dyb; Mon, 29 Jan 2024 01:50:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMOBzjIfIaH9ootbQ1Fqe/Fw3iP4k6FihwBXY0YDmPCtOOYyKjPoKJEKavMPbUzCeVpSUv X-Received: by 2002:a05:6820:1623:b0:59a:1237:b38e with SMTP id bb35-20020a056820162300b0059a1237b38emr4719395oob.11.1706521854586; Mon, 29 Jan 2024 01:50:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706521854; cv=pass; d=google.com; s=arc-20160816; b=OAScqhwMRNVLO5DMTlZDxYY7p9AnMHEOQ4EbdZaXi9eTJey3t80xITkhd6JwP3o9vW Q3zxJjbtHzDEZC4fLXUEiT67gC49+dMQCv0l1GTDWV1crOCZ2u9R0XHzy0BcRYBOUkBD uMRWLk69gCWkv7QR78hxs4xyn6lHLa50ZEyvCYKw4YOePrgEOGZh4Li/FZL/LT+BuKPn WcHF9/sG1tHV2agalBKWbfCC1+BlAoVX2iRfHGTRTicTQPryQdasO6CB/w6Jpi5k+wL5 p1bGbU9v65dFj4T/U5+ALckopTVYSRh6iLj+Xa8YPf85WY1DMV0FV87U3F8chJmfqjc4 1s6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=pRcl53v/D7LNYmHWLVDHFLzWMRLsRvElPDySPluG9Xk=; fh=1TQT9GTYkY1H/S74nsticeItY4eCWUE4eV0tV1Mcrxw=; b=YGsR/WnEnWtBn7tjw5Se4YTSzpWFMFYuNSSRShWVgzZtLl5k1gbBx2wAZUwcJRrN/Y smwZK83fzyTMMkDLMzfv0PG7gUxbsOLCgMnRYlPAmNQTJFeaAy2UGD9z2BLOgBKXMkzv nkgyKUsa7wZLfQAHoXeJyhipACQ6F3QG4Wgr/g95CHPKXoW+tGGo4GzAfK6+OsPWs7HB b57zVk/X1R5H8HloaALBdApyINqBHqLGabt8Y+V6ttC4TabgsnqwzVjaPTJZ24S/O7XH KO3slb+UK4KZo/9BZ/0dy4Pnx2MzSN4VKdmWCrI3EyeEBS1JjkgNK8gLKL5druF9hje6 nxAQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b5t+25jJ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-42491-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42491-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id v64-20020a638943000000b005cf58870685si5368356pgd.226.2024.01.29.01.50.54 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 01:50:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-42491-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=b5t+25jJ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-42491-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-42491-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5520828454C for <ouuuleilei@gmail.com>; Mon, 29 Jan 2024 09:50:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4667D5821B; Mon, 29 Jan 2024 09:49:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="b5t+25jJ" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 F39CC57861 for <linux-kernel@vger.kernel.org>; Mon, 29 Jan 2024 09:49:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706521781; cv=none; b=sqEZDmJWoeWXZs4NVCg1wt0EB6q682wV/EIfxuHhHnNS+sGP57hEOvDGCKASHSPEkbsjcK/Q+VI1EOZgG21TMslITZTuhcCd6nWqEzLDYDlmMTZ359imbOMJEl1ZudkdbMfD4UkUwQHEiBEInrt3B9Ye5MZO+srY42sqJFXgqDM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706521781; c=relaxed/simple; bh=3SKQ1UY5AtuT9Hi3kMvGeBfzklACbNG9lR2rVyYGSFM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F1p+QEjVVcDp+gFGxL/3zTkD7CP0yVkFnW7YiY3wsjU+CixnTkTo/rGiM3hyee1bBFwKm6Yz2bjIRqiBR6I+kcY3mhpoGtlye6hKrKI7Elhd+sThVsHJeR1QXw+S7cSI+uDPZRy9R09VH0mjNRpZ664+Sze/G0xixf+Ds/DG2Bw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=b5t+25jJ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706521778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pRcl53v/D7LNYmHWLVDHFLzWMRLsRvElPDySPluG9Xk=; b=b5t+25jJ0H3K6bQL820FznLgeMt53BwfyX8155cl+l0sA/o1vm7CUdLr3OjS+674bDblhV QtsY11EmnMQu3Z+ofObwJIZfx8yhxdA7SHk3sWxGsBASVB3jXjBeaghbWq/r2F53Rq8TEZ uApBKBA8gbcanYL/q0Az+eylFbwTOhM= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-581-2MqNdY6VNp-CfaPkR9IzXg-1; Mon, 29 Jan 2024 04:49:32 -0500 X-MC-Unique: 2MqNdY6VNp-CfaPkR9IzXg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0F563C2B606; Mon, 29 Jan 2024 09:49:31 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EF73492BC7; Mon, 29 Jan 2024 09:49:29 +0000 (UTC) From: David Howells <dhowells@redhat.com> To: Christian Brauner <christian@brauner.io> Cc: David Howells <dhowells@redhat.com>, Eric Van Hensbergen <ericvh@kernel.org>, Dominique Martinet <asmadeus@codewreck.org>, Jeff Layton <jlayton@kernel.org>, Matthew Wilcox <willy@infradead.org>, netfs@lists.linux.dev, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Marc Dionne <marc.dionne@auristor.com> Subject: [PATCH 1/2] netfs: Fix i_dio_count leak on DIO read past i_size Date: Mon, 29 Jan 2024 09:49:18 +0000 Message-ID: <20240129094924.1221977-2-dhowells@redhat.com> In-Reply-To: <20240129094924.1221977-1-dhowells@redhat.com> References: <20240129094924.1221977-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789417860288733283 X-GMAIL-MSGID: 1789417860288733283 |
Series |
netfs: Miscellaneous fixes
|
|
Commit Message
David Howells
Jan. 29, 2024, 9:49 a.m. UTC
From: Marc Dionne <marc.dionne@auristor.com> If netfs_begin_read gets a NETFS_DIO_READ request that begins past i_size, it won't perform any i/o and just return 0. This will leak an increment to i_dio_count that is done at the top of the function. This can cause subsequent buffered read requests to block indefinitely, waiting for a non existing dio operation to complete. Add a inode_dio_end() for the NETFS_DIO_READ case, before returning. Signed-off-by: Marc Dionne <marc.dionne@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-afs@lists.infradead.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/io.c | 2 ++ 1 file changed, 2 insertions(+)
Comments
On Mon, 2024-01-29 at 09:49 +0000, David Howells wrote: > From: Marc Dionne <marc.dionne@auristor.com> > > If netfs_begin_read gets a NETFS_DIO_READ request that begins > past i_size, it won't perform any i/o and just return 0. This > will leak an increment to i_dio_count that is done at the top > of the function. > > This can cause subsequent buffered read requests to block > indefinitely, waiting for a non existing dio operation to complete. > > Add a inode_dio_end() for the NETFS_DIO_READ case, before returning. > > Signed-off-by: Marc Dionne <marc.dionne@auristor.com> > Signed-off-by: David Howells <dhowells@redhat.com> > cc: Jeff Layton <jlayton@kernel.org> > cc: linux-afs@lists.infradead.org > cc: netfs@lists.linux.dev > cc: linux-fsdevel@vger.kernel.org > --- > fs/netfs/io.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/netfs/io.c b/fs/netfs/io.c > index e8ff1e61ce79..4261ad6c55b6 100644 > --- a/fs/netfs/io.c > +++ b/fs/netfs/io.c > @@ -748,6 +748,8 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync) > > if (!rreq->submitted) { > netfs_put_request(rreq, false, netfs_rreq_trace_put_no_submit); > + if (rreq->origin == NETFS_DIO_READ) > + inode_dio_end(rreq->inode); > ret = 0; > goto out; > } > > Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff --git a/fs/netfs/io.c b/fs/netfs/io.c index e8ff1e61ce79..4261ad6c55b6 100644 --- a/fs/netfs/io.c +++ b/fs/netfs/io.c @@ -748,6 +748,8 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync) if (!rreq->submitted) { netfs_put_request(rreq, false, netfs_rreq_trace_put_no_submit); + if (rreq->origin == NETFS_DIO_READ) + inode_dio_end(rreq->inode); ret = 0; goto out; }