Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3100362rdh; Mon, 27 Nov 2023 06:33:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5F+uKElx9eNZrXhefAo4ZsXSTrAMZqlY+KJv+kJVXwzJaoVS2fECQ2602DVx+jk+E7ZWY X-Received: by 2002:aca:2117:0:b0:3ae:156f:d312 with SMTP id 23-20020aca2117000000b003ae156fd312mr14799900oiz.34.1701095583030; Mon, 27 Nov 2023 06:33:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701095583; cv=none; d=google.com; s=arc-20160816; b=EGYZPxVEGQ9yPjMM9vrJUeTJ5Nb7ROqfsdrrF4giw1gTLfE8jBXuAf6YUipZMoTDIz oNWDAInfu9vY2tqBhMwtBjiZZ9lCIZG5v3CTtEooEgmKsGZdYE/MEkoD55P6GkWZ/ZTk LUpvr+xmiIGXDaQCJ3gxT9cO++2o0Uz5Zl4Fo6f4hE4mfLiTC8geTPcX0nDSSsF0+ohp mNELjE9qryoUtDqfDrMUYAjX23tyDrU31lNyyAHf4T9J9euZo0NB9uL53DMMwdg/kPSC N+EQyVXPVIVWnSTdhjW2S3gXPLkol9pcsrQaV1k5Y11SxHam0MwIbeJtzTRPfgWJzIzk EYmA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=79oq+dAh3gxJRpbXVK4oY+eeQB5JyiO6FF7VLXAwv3Y=; fh=c4gLbwT9pvttlQWxFI2VesWIZ95B4IQ3bBh75IOono4=; b=Rf3wXPXxJQy+O2LwyBU7r5IZi7ONi5c+/6/Lh/WbVlaGNgdYgUZJLdYmcvnNM5IU1W yA8eyrUw5tCje3Z/WqwrVKXLTjaXJU9iRf4r0SOxKyIvU7ovshb6cjGBkT2+ROJVgN6R y0zQHIwBEVUUeD7k4m3TN0yQF43ImD0IWWW5I63A4HdchfTxiXKQsQ9LWT5SjAqVrTGH m75h38sztcQKbwTsHkNhXlpl2Uy4CnuJQghi/pj8Vos3ZVjVTnI7crKBklzNusoBauYk NslRpGTjXkMAsiYKDVseCg5AOqcj7cd6qnUVYmnXwEaOxpeZBtyEpVTM2u5GFcjyDuM8 DXYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gGQfITpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id gt7-20020a0568082e8700b003ae3e56566dsi3972978oib.209.2023.11.27.06.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:33:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=gGQfITpu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id EEF98809FCAF; Mon, 27 Nov 2023 06:32:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233767AbjK0Obo (ORCPT + 99 others); Mon, 27 Nov 2023 09:31:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233640AbjK0ObS (ORCPT ); Mon, 27 Nov 2023 09:31:18 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36CFB10FB; Mon, 27 Nov 2023 06:30:49 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1cfa8f7c356so16970345ad.2; Mon, 27 Nov 2023 06:30:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701095448; x=1701700248; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=79oq+dAh3gxJRpbXVK4oY+eeQB5JyiO6FF7VLXAwv3Y=; b=gGQfITpu/0IEPQBSVWUfVKLM+qaUMf7s6Ux6aq8lIXab74oai3ZVJT2nUU1uXWIEB5 Xb06vD9km71cQqzGE6OU+W5cOuLfMOU/B3X81ES7bYg4rlzV45uEGqMgeE83ShUVJABL evvEsO4/+B23bdFsUCoAzNwY6EdTd7Gl9lK5uIMQOhm3EFwQRQb35dWnwp6i5ej1+5HE EOhOcW6Da4wYF2bCqsv9svv7RA/f9pChmPgm7GndIBqsrZlJnq0xkduUAdl1vWaNexQw Gcs9+m7RJDFXBCGJpNPCnXK/lcpJdzG1ZEG5EfdKS8WQTjfE7idC/LRugik2oDmgNmoP gnVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701095448; x=1701700248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=79oq+dAh3gxJRpbXVK4oY+eeQB5JyiO6FF7VLXAwv3Y=; b=R88hVyIIRcO1RKNvrabvKjN/JgFcKQgYSI7JTiWXdHlrWKJIO2ETdd+oAtaIjCBj6T QL+az+Wte0W2yxCnE6nMGs7yk3F63OVH9gTD5BXyWbdupFLSVwQCyfrSsV2XWEea2xJN D0PpMeWQUgbgWPnlWWo+2WqUZ9ecyOHhZ8vDWXdL7V2UFiFtJY4KcEYrcq58/QHNDzY8 Y/NXe2BmOkxUUmjV3flsBspdFb9Y4Yu7DZUUOHNqxJkMPwPmBtSP+YB6Cx5Yv3P6Lt9H E1FYptpkO3WvlsRTzSQ+m+8jvZ6rRytkFAljK7JhWr2QN1IE1TppmXGJ+Hi9dyOUFByr 9HjA== X-Gm-Message-State: AOJu0YyMvf/z3GneU2pKRsFlI9jBmhu/MXztXcx84yvf2b3WhcHS46q2 3Nyodr85UtK8/b8heRJIzjLhtlYsLT4= X-Received: by 2002:a17:902:f541:b0:1cf:d648:31e3 with SMTP id h1-20020a170902f54100b001cfd64831e3mr2215302plf.65.1701095448328; Mon, 27 Nov 2023 06:30:48 -0800 (PST) Received: from carrot.. (i60-34-119-11.s42.a014.ap.plala.or.jp. [60.34.119.11]) by smtp.gmail.com with ESMTPSA id a5-20020a170902ee8500b001cf51972586sm8302784pld.292.2023.11.27.06.30.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:30:47 -0800 (PST) From: Ryusuke Konishi To: Andrew Morton Cc: linux-nilfs@vger.kernel.org, Matthew Wilcox , linux-kernel@vger.kernel.org Subject: [PATCH 02/17] nilfs2: eliminate staggered calls to kunmap in nilfs_rename Date: Mon, 27 Nov 2023 23:30:21 +0900 Message-Id: <20231127143036.2425-3-konishi.ryusuke@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231127143036.2425-1-konishi.ryusuke@gmail.com> References: <20231127143036.2425-1-konishi.ryusuke@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:32:05 -0800 (PST) In nilfs_rename(), calls to nilfs_put_page() to release pages obtained with nilfs_find_entry() or nilfs_dotdot() are alternated in the normal path. When replacing the kernel memory mapping method from kmap to kmap_local_{page,folio}, this violates the constraint on the calling order of kunmap_local(). Swap the order of nilfs_put_page calls where the kmap sections of multiple pages overlap so that they are nested, allowing direct replacement of nilfs_put_page() -> unmap_and_put_page(). Without this reordering, that replacement will cause a kernel WARNING in kunmap_local_indexed() on architectures with high memory mapping. Signed-off-by: Ryusuke Konishi Cc: Matthew Wilcox (Oracle) --- fs/nilfs2/namei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 99255694cbe9..d179db8074c2 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c @@ -411,13 +411,14 @@ static int nilfs_rename(struct mnt_idmap *idmap, inode_set_ctime_current(old_inode); nilfs_delete_entry(old_de, old_page); - nilfs_put_page(old_page); if (dir_de) { nilfs_set_link(old_inode, dir_de, dir_page, new_dir); nilfs_put_page(dir_page); drop_nlink(old_dir); } + nilfs_put_page(old_page); + nilfs_mark_inode_dirty(old_dir); nilfs_mark_inode_dirty(old_inode); -- 2.34.1