Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1433509rdb; Wed, 6 Dec 2023 20:58:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFXZP1RChKyaxC3Kie66lzmXjDTzp6KIxt/94zgCk8asxjEQKWZbXS8bILAPMldVwotwOe X-Received: by 2002:a05:6358:3a14:b0:16e:34f4:185b with SMTP id g20-20020a0563583a1400b0016e34f4185bmr2389940rwe.20.1701925080094; Wed, 06 Dec 2023 20:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701925080; cv=none; d=google.com; s=arc-20160816; b=ueS4b0jAbbAgajoNzWW0/Opp4LJhco3rEg1QPVuySObM0HQQy1/RMWK4o+vMuAKrQy UAovgI5H3jw1Scj13M9FeWVkjUfeNmOJBkOwhggWUjqBjV5k4oJLf+ZZZdHFATQAQgSi EObTIMl3fZkSA6W8REUj2O+a1l5xG+4p/ippQoTi5iAfTDJkx3jFYYOhUrY1Pb9lxjYM Ispsi4uACps15/Tnxyir0kPu5vjmFZnX+3kFVZYp/mReccZ3EnjjVufg5Gf1MPfY9Olg WoxPG9hOM0RND3jw8KyJnG5sszFyJ/JNoBhc0JW+Vsu67+QcwED1JsqjebM3Cdaqcing joHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+EKLqq52GK0jw4IGuqvKFvJcNTKuZLtYbF3vm1onl74=; fh=M4BPaMQ5Q3X2+FKbhXoDpy+/1kcj8JGJnMEJ6o+yvT4=; b=Pjm4o9XmbAv6Fvas3ZnoZjeH4ZPqIaFI4Rbz2Vuz/eF/2w45cAXxZWHJZ2daHKo94o XgUZphKTUntpnD1ZS30e5BO6a+DimPf/LMWWc4LsxRNz10KAi+MyDZBLo0HHsWkpBs6h wafpSzHxDrNNxFg7mOp5c4rbx06GqkipoyXMCeyWr22TT/zoCfe+NY4/+tClPBsfo4g7 nN/jpu9JDfT3JS4/eHd/R4oQdV3Cwx7KtdZxK6JoIKWcXMJ0T2N4fLnz1Yi6sF80rwMo 7IeBAS/iSE4uQiC3Czp2sY+aebFgvN0kqfZGhkEJBrp9Rco4ToulhrbWSLayAF983Uj6 AuGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eVxZy36E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id m66-20020a632645000000b005c63ff42dbdsi513328pgm.167.2023.12.06.20.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:58:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eVxZy36E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D2F6280DA99C; Wed, 6 Dec 2023 20:57:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229977AbjLGE5i (ORCPT + 99 others); Wed, 6 Dec 2023 23:57:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbjLGE5h (ORCPT ); Wed, 6 Dec 2023 23:57:37 -0500 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3570DA4; Wed, 6 Dec 2023 20:57:43 -0800 (PST) Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3b9b5bff21dso386704b6e.2; Wed, 06 Dec 2023 20:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701925062; x=1702529862; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+EKLqq52GK0jw4IGuqvKFvJcNTKuZLtYbF3vm1onl74=; b=eVxZy36EKu6joJtHiG/3TnX9lSS4VJNRKtmepZm+2oqHGSMjg2in3NF17ZJ1o4OEC3 +JbnJcn20suENlR68itbfiQGKv/8fLV9AOBHUBM0BlaL3MeBQT4+yCsqKwqa1PydntLk GIdxm55Rtz5q6KT/SgiZzALNPS9KX6QWPn4W3fgeanSCYogqamZJ7b0UP6IvNyP4hcGa UPKduM9iTZtoXbeR8fH7b4xDnvLGBOqfr5E1lsepOazN/9bvYvbqauvcUA1j2Csi8qu+ Xds/9fYGZW4csFodK3+X8lnC9h6/lgCwZrEWNBTEZGPaMSx7J4oh7WL1P5v3dofDNyMO kSGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701925062; x=1702529862; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+EKLqq52GK0jw4IGuqvKFvJcNTKuZLtYbF3vm1onl74=; b=rD6phoUFMRvTm3Xyah5F93yhN3Zc6K1qJBuqni0EvrHXydkYZKofVzrFRRyUmKOIr9 DRj4D6IgeOmkGBKD95LUjjQGqmnjmIj2LHP92hTNnrlkU3fS/GbATUeRQZh1Q/Kn1j+i iGGI9QC4YPi1+9iDEDyIFw5biEy3uyYjO0pm4nmr/Zz3sFpkAO6tufj2u6v4weqeKVD/ eBHyRjJb8y/RLIGTOMUbJYDS40eaFOR5K7g9XNYBhNMRvy2K5AUg/hd5tGorQ+PZu6G1 0WQnvJUd+4yE0Z2/xb4lc1S6OAX7w+p91AX7+Eb6mTAtn07/6ihh9Eclte59+0hnP7wH tmFw== X-Gm-Message-State: AOJu0Yys/FDp9kSUXd9EMXuoh5eE1PZb6ti0zBsfDosmZteGw2MdcMOB 7XYdBD0liC74NsgXtIfx7ucnyxDqS0Q= X-Received: by 2002:a05:6808:289:b0:3b9:e119:270d with SMTP id z9-20020a056808028900b003b9e119270dmr64614oic.4.1701925062397; Wed, 06 Dec 2023 20:57:42 -0800 (PST) Received: from carrot.. (i223-218-132-246.s42.a014.ap.plala.or.jp. [223.218.132.246]) by smtp.gmail.com with ESMTPSA id y20-20020a056a00191400b006ce458995f8sm373594pfi.173.2023.12.06.20.57.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:57:41 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] nilfs2: switch WARN_ONs to warning output in nilfs_sufile_do_free() Date: Thu, 7 Dec 2023 13:57:30 +0900 Message-Id: <20231207045730.5205-1-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 06 Dec 2023 20:57:55 -0800 (PST) nilfs_sufile_do_free(), which is called when log write fails or during GC, uses WARN_ONs to check for abnormal status of metadata. In the former case, these WARN_ONs will not be fired, but in the latter case they don't "never-happen". It is possible to trigger these by intentionally modifying the userland GC library to release segments that are not in the expected state. So, replace them with warning output using the dedicated macro nilfs_warn(). Signed-off-by: Ryusuke Konishi --- Andrew, please add this to the queue for the next merge window. This replaces two potentially triggered WARN_ONs with ones that use a warning output macro. Thanks, Ryusuke Konishi fs/nilfs2/sufile.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/nilfs2/sufile.c b/fs/nilfs2/sufile.c index 58ca7c936393..0a8119456c21 100644 --- a/fs/nilfs2/sufile.c +++ b/fs/nilfs2/sufile.c @@ -471,10 +471,15 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum, kunmap_atomic(kaddr); return; } - WARN_ON(nilfs_segment_usage_error(su)); - WARN_ON(!nilfs_segment_usage_dirty(su)); + if (unlikely(nilfs_segment_usage_error(su))) + nilfs_warn(sufile->i_sb, "free segment %llu marked in error", + (unsigned long long)segnum); sudirty = nilfs_segment_usage_dirty(su); + if (unlikely(!sudirty)) + nilfs_warn(sufile->i_sb, "free unallocated segment %llu", + (unsigned long long)segnum); + nilfs_segment_usage_set_clean(su); kunmap_atomic(kaddr); mark_buffer_dirty(su_bh); -- 2.34.1