From mboxrd@z Thu Jan 1 00:00:00 1970 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 C9C1F1F4CB3 for ; Fri, 3 Oct 2025 13:42:42 +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=1759498964; cv=none; b=jhcaT1MqGh/lzFkIrNAuc2B9PMLZPXLuS3fA3NsG9iSCH7QvyQAl7CV/gVEONxZiE74jfaFA7CZ9RJBm2OAQ2Hsz5tsYJsZuEZs7sI8YsbUKRPwhvzR44apnmESanAhTkqQNfQTHJOfWlxwnXZJJyFtooq6mYQexVmiuImj0mdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759498964; c=relaxed/simple; bh=kcXsA5D2l6jq1dNJXhJGlHhKOe+Grlq1+qB7Sse2dPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C1Kq5rEKxFBVjxa2ytkg9TWr43kdzwvD4/eo8XIUtN9XxmwFggFiwjejZ975pGqbt03b5ZFDkTfGo7G4ffv7agS4+k6WY/W35QL5Un1VhLi4CRMiramqcbXJ8VhKiJ+DvF2XNkuugE1q3fjvu9fOU4sz81twhs0DUmh2+NQ/rxk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine 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=A60Kg6rQ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="A60Kg6rQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759498961; 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=+uBUs752o9ejjaxLycOGdkkyFonqI7ieDhyDaEpM9qA=; b=A60Kg6rQQam1qLDbC6pI4YvFnvuPsQh5+qDdhcV7W1PNfVfZflxorHoPvy/dXEww9kCHEI OUmt9iCzXsbE2H2FoYDWJy5n29PSI2qCU5usW6kliUnqEC/1/b06xMlkcxccbv2X3baYOi bN8sCu/ezUr1toNP9Yti0cgo27Gc73c= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-4PEntGNLOpijA2AKBOui0A-1; Fri, 03 Oct 2025 09:42:38 -0400 X-MC-Unique: 4PEntGNLOpijA2AKBOui0A-1 X-Mimecast-MFC-AGG-ID: 4PEntGNLOpijA2AKBOui0A_1759498956 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 16EAC1800378; Fri, 3 Oct 2025 13:42:36 +0000 (UTC) Received: from bfoster.redhat.com (unknown [10.22.64.54]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8D5FC19560B1; Fri, 3 Oct 2025 13:42:34 +0000 (UTC) From: Brian Foster To: linux-fsdevel@vger.kernel.org Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org, hch@infradead.org, djwong@kernel.org, willy@infradead.org, brauner@kernel.org Subject: [PATCH v5 2/7] iomap: remove pos+len BUG_ON() to after folio lookup Date: Fri, 3 Oct 2025 09:46:36 -0400 Message-ID: <20251003134642.604736-3-bfoster@redhat.com> In-Reply-To: <20251003134642.604736-1-bfoster@redhat.com> References: <20251003134642.604736-1-bfoster@redhat.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 The bug checks at the top of iomap_write_begin() assume the pos/len reflect exactly the next range to process. This may no longer be the case once the get folio path is able to process a folio batch from the filesystem. On top of that, len is already trimmed to within the iomap/srcmap by iomap_length(), so these checks aren't terribly useful. Remove the unnecessary BUG_ON() checks. Signed-off-by: Brian Foster Reviewed-by: Christoph Hellwig Reviewed-by: "Darrick J. Wong" --- fs/iomap/buffered-io.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 8b847a1e27f1..211644774bb8 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -815,15 +815,12 @@ static int iomap_write_begin(struct iomap_iter *iter, size_t *poffset, u64 *plen) { const struct iomap *srcmap = iomap_iter_srcmap(iter); - loff_t pos = iter->pos; + loff_t pos; u64 len = min_t(u64, SIZE_MAX, iomap_length(iter)); struct folio *folio; int status = 0; len = min_not_zero(len, *plen); - BUG_ON(pos + len > iter->iomap.offset + iter->iomap.length); - if (srcmap != &iter->iomap) - BUG_ON(pos + len > srcmap->offset + srcmap->length); if (fatal_signal_pending(current)) return -EINTR; -- 2.51.0