Received: by 2002:ab2:6486:0:b0:1ef:eae8:a797 with SMTP id de6csp172123lqb; Fri, 15 Mar 2024 21:54:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVS/7t8RYqyU/TZicIfE3wba/GMjFqKJPq28JAf9/703pbqCLREgq3Y2H3dfjAwecY/rOxTqTiijyn7OlLECeQZwnOd4bO+IpUeUba9kA== X-Google-Smtp-Source: AGHT+IEQhkKJi8vanbBU+SIsJvqaeFl1e9VsiMsGOY9HLUoXK0jnK9YC5eaaqkrRSUKaxxntoVo1 X-Received: by 2002:a17:902:db0a:b0:1dd:ae8d:8574 with SMTP id m10-20020a170902db0a00b001ddae8d8574mr9097549plx.63.1710564874651; Fri, 15 Mar 2024 21:54:34 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e17-20020a170902ef5100b001defe59a1c4si1337776plx.395.2024.03.15.21.54.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 21:54:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-105076-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=casper.20170209 header.b=ELsTsi58; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-105076-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105076-linux.lists.archive=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 019A6B214D3 for ; Sat, 16 Mar 2024 04:54:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A59256AB8; Sat, 16 Mar 2024 04:54:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ELsTsi58" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 DB9EC5C83; Sat, 16 Mar 2024 04:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710564862; cv=none; b=gSUUEb/+E8k0XDrREiAY4v9nfYu/JgX7N7qr3bCOnLEKnM3RDD9jDoYotDeiTCn0BhbiKUhUbrvR4atrLuQKtUn19cSQCoqyjpwniOwkcb7qkol+6rUtArFOmbZeEt7xZC8dKEtubqiMMk/6VhMJaKaV2hfedBRBRldXI5fz9s8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710564862; c=relaxed/simple; bh=CTsbWJOvMkHNA1a9M4r6D5hlnI1m51V5yGT3CTImS10=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DSp2b5tZUy7twgFTuTagUL2ZRZz2/UBv8Zg1byJhd1qoZEjKGvosveEtE6X6XANf0TYG00SMrNGgGfNl8ACQK7b7wxjKQ2ieJ00uIdoold07I/HOijdsNlx5wrEoQOQv/jFY+Zy4xe9eTIVP0Cp6vm0/ZV6cLF/99Ft5FgNPXqo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=ELsTsi58; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=aqwB40EDkNKO/7P+bqgQOH7uayQrqvlFGFa8SadIFBU=; b=ELsTsi58TRxFPpdXxeuBrUzpae MLVlMvlljPXkKFz/R1/7sPtIOTVdYcXMirYM62G6RF2moFGZRnlRjBFQ51Hwy6BB9O3pHsTBfGGSg FMDEpFEcM5Dq+JOd+I62953F1P0rJ9YFddW+4/HMMSwmOWNl1iJ/gQu5mO0H3HyxrdskTYnWmuffw d1ChfETm+kSitX+4v4poQKxD88NVCRqQuLH9dBC/QiYN5UBQwmz40dGsY6S4j5tY76wWOOjiTddkP UlzqC8DNgVdwcNXIXoqgZlnYnwjA7HxqfYM67Ti0dSmb1gtuDwXLBtRScPVwNkKvl2bwDLdN0waZj C3op9s7w==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rlM3e-0000000BnqB-26fL; Sat, 16 Mar 2024 04:54:10 +0000 Date: Sat, 16 Mar 2024 04:54:10 +0000 From: Matthew Wilcox To: cheung wall Cc: Alexander Viro , Christian Brauner , Jan Kara , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: WARNING in mark_buffer_dirty Message-ID: References: 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: This might be an iomap bug, so adding Christoph & Darrick. On Sat, Mar 16, 2024 at 12:29:36PM +0800, cheung wall wrote: > HEAD commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a (tag: v6.7) > WARNING: CPU: 0 PID: 2920 at fs/buffer.c:1176 > mark_buffer_dirty+0x232/0x290 This is WARN_ON_ONCE(!buffer_uptodate(bh)), so we're trying to mark a buffer dirty when that buffer is not uptodate. > RIP: 0010:mark_buffer_dirty+0x232/0x290 > fs/buffer.c:1176 > Call Trace: > > __block_commit_write+0xe9/0x200 > fs/buffer.c:2191 .. but line 2190 and 91 are: set_buffer_uptodate(bh); mark_buffer_dirty(bh); and the folio is locked. So how do we clear the uptodate flag on the buffer without the folio locked? > block_write_end+0xb1/0x1f0 > fs/buffer.c:2267 > iomap_write_end+0x461/0x8c0 > fs/iomap/buffered-io.c:857 > iomap_write_iter > fs/iomap/buffered-io.c:938 > [inline] > iomap_file_buffered_write+0x4eb/0x800 > fs/iomap/buffered-io.c:987 > blkdev_buffered_write > block/fops.c:646 > [inline] > blkdev_write_iter+0x4ae/0xa40 > block/fops.c:696 > call_write_iter