Message ID | 20231127143036.2425-3-konishi.ryusuke@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3165194vqx; Mon, 27 Nov 2023 06:33:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IG4uqSAOKRHWdfgjfbJaCoBe98ag2zvlErOeklF6G7nJwd9VGiIxaqByyizXcJhxkMQjnRU X-Received: by 2002:a05:6808:6547:b0:3b8:5dbd:3337 with SMTP id fn7-20020a056808654700b003b85dbd3337mr10319424oib.30.1701095582058; Mon, 27 Nov 2023 06:33:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701095582; cv=none; d=google.com; s=arc-20160816; b=LoT8rWcnLvP3m0JSizFmAp1bJq62DnjsWjvY4gEElkTxwRi7e5hggP25AWxIj9CU2i I3wXrb0JAkltLHBWKiDK0/9WQYTop9S5YJO7BjDTjeWugXFO9jC7xBO10JjbqumAYouX BBW6lK1I8pRf+uVI3sAAJ+5ngH+1amUayhydb/Grj1ajGoit/ordcRqlYhc1Gbp75gtS +Cy+1TxWZToFD7Cfs9rTpe2cZ7gL05xIH31fx+CmduGea6wyAmPFjchxYsqConF+08zB Jks8xpSqYW/Zx6C8MbpEsVV8FHpV6fhqnRZ98llS+JlkKCmBlUfQfnxFxGnt9kaH5Gko sovg== 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 Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cb11-20020a056808320b00b003b8515590basi3654120oib.307.2023.11.27.06.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 06:33:02 -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 1A2208090F83; Mon, 27 Nov 2023 06:32:02 -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 <rfc822;toshivichauhan@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <konishi.ryusuke@gmail.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: linux-nilfs@vger.kernel.org, Matthew Wilcox <willy@infradead.org>, 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: <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 (snail.vger.email [0.0.0.0]); Mon, 27 Nov 2023 06:32:02 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783728000870818549 X-GMAIL-MSGID: 1783728000870818549 |
Series |
nilfs2: Folio conversions for directory paths
|
|
Commit Message
Ryusuke Konishi
Nov. 27, 2023, 2:30 p.m. UTC
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 <konishi.ryusuke@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/nilfs2/namei.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Mon, Nov 27, 2023 at 11:30:21PM +0900, Ryusuke Konishi wrote: > 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 <konishi.ryusuke@gmail.com> > Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Thanks for catching this! Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
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);