Message ID | 20231207045730.5205-1-konishi.ryusuke@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4559680vqy; Wed, 6 Dec 2023 20:57:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhwUhYGAl3KzZLN41qNkF+XUB6gWPzil6xMGmHLbom6veOzLp8HduBtsOllbz8lGXxs9Ul X-Received: by 2002:a17:902:bb87:b0:1d0:6ffd:f1fd with SMTP id m7-20020a170902bb8700b001d06ffdf1fdmr1618128pls.83.1701925073551; Wed, 06 Dec 2023 20:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701925073; cv=none; d=google.com; s=arc-20160816; b=QCyHcyx4o5dKdTnMsVLu28ZUE8umVOlrVBkUvB5PGLytnTYvMolTD9bboUD7krklUr dSLG8PQHQkKCIxhNhfdUsjiK3A+ugdPgBfAY05G66WQt8ZC/aJw7EayuXjA3XCEsKnfl qg4sUm9HGIt9vm6MoeRkP3L3HSiimxb/AO89uwbtxduspvxJqtaX80EDf2ckYXhq6Au+ jnOLHwYqRQJ+U49YWTTzME1VIejnjLxZ83WYoIU2+mG7t+isgtBk0m3GgA57ZDCWqnkX XI80QmQYz3LEzgjtFIbkMB9Re8Aal+M0w4qF9US+OvkLaTXznynJkv1yHVpbEQyGRipC N3JQ== 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 Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id a2-20020a170902ecc200b001d0b789d7c4si464908plh.515.2023.12.06.20.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:57:53 -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 904C280DA99E; Wed, 6 Dec 2023 20:57:47 -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 <rfc822;pusanteemu@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <konishi.ryusuke@gmail.com> To: Andrew Morton <akpm@linux-foundation.org> 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: <linux-kernel.vger.kernel.org> 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:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784597786254916639 X-GMAIL-MSGID: 1784597786254916639 |
Series |
nilfs2: switch WARN_ONs to warning output in nilfs_sufile_do_free()
|
|
Commit Message
Ryusuke Konishi
Dec. 7, 2023, 4:57 a.m. UTC
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 <konishi.ryusuke@gmail.com>
---
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);