Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8167951rwl; Sat, 31 Dec 2022 00:28:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+ls17SSTBm905H5yrBrcCGL66ivCzEGZUUH5ghWcMPsslEqkuXZdQvVlgUceISgsU/VK1 X-Received: by 2002:a17:907:9c08:b0:78d:f454:ba4a with SMTP id ld8-20020a1709079c0800b0078df454ba4amr14435070ejc.73.1672475292125; Sat, 31 Dec 2022 00:28:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672475292; cv=none; d=google.com; s=arc-20160816; b=LoF8jK6ROVYBkW29ALymnApCq+ljHWCwt5BISY0z6sRSdr1fb5AO75HA7kNToQivOp K9fx9e9Eyk1bWIZobLdaq12nqxbdyf4doS0UICo/WaekEvzTRpKkk0gDel+eUdYeJQ9d FI1k8ZYZzIXnKJJzvLf+0DcMHTJwGDt8EMV2Nny+oqFYl4jnzTYd1/KFxSSX9lhGymcW CmvnPyzgmckil64rKzA3xuCzlOxc6u/4uDUgvaISaVgSNcqOhN8owBRnDl9EEaSqgszm mD/ZbAAIqKqxtXLlCCZ6fFTAnkYBhCj8xeY5dHjdxz44rnNmGzoFjyMgGVMw+Zhrz+B4 eULA== 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=R3DzRI51PYBUXFaa7iBRSWpK+zXF1njrTHM9hKQ8ASA=; b=DQS4WPzjFwigmHocMNcZpK4W6Cv1nMMPaU9iEh9azMHEo9TYQFEAYGeluJWPUnP2rP UoW7aGbzffdgebFEaWJ4pFFNiWtWCfT9Q3yM7Dc/dQCniTxEz13k9YHQwDAK8yNcjxIJ rWpN6p0RwE99NLgwwo0y7yU0ALGXpgk2+7+jyMGmIiPuk13C8QMg/g+auhqAmVs7B3kI UVvN/a/ZwTI8i964InuGh+uvV4FfAeDowT4qQCj8lPg2DBaqBvw203qIKc/4MGS8NuAi WzBuAmzLmUYjX7dKzKoenkAEeC0rvQqJzesvfX9auAoQjyCUBC++Bi3IXbTu2cRqXwCS IMAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TWi2DOIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa9-20020a170907868900b007c15653692csi20979837ejc.287.2022.12.31.00.27.54; Sat, 31 Dec 2022 00:28:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TWi2DOIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbiLaH5e (ORCPT + 63 others); Sat, 31 Dec 2022 02:57:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231602AbiLaH5a (ORCPT ); Sat, 31 Dec 2022 02:57:30 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FAAED9D; Fri, 30 Dec 2022 23:57:28 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id m8-20020a05600c3b0800b003d96f801c48so14682549wms.0; Fri, 30 Dec 2022 23:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=R3DzRI51PYBUXFaa7iBRSWpK+zXF1njrTHM9hKQ8ASA=; b=TWi2DOINUP9biKc29xu8+VPFZChm3y+eYFuYj2cz3sp6slza4h2+ljvtEd6hBKK8R1 D09H9UubeyVSG/vgLwFehi+d0nfWBITHromhUKcsIA1elW/SbZ94DuBoyjbBB7+Em4Op o6D4+sXDq7OtoHClC4nyOPYlF2ExJDOaUgbcMrplVb4xT3T1ihjT/zDwhZW/4J4m/hb5 bJkQwv10S+07WacGgDxLhD523W6SUpTsBGv5AZ+IcZZa/qjVIuzMAENYOzRrSSiES0Cw sW7cugericU8oZMktIM3WPEV/oV2QDRtzGVFjPfn1E+6cdjMfc7bYMcCVQhbhjRFfdjA h9FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=R3DzRI51PYBUXFaa7iBRSWpK+zXF1njrTHM9hKQ8ASA=; b=DLdgmu9iUxaW7v5Ph5Dklz/b0AHRJfWQLP4NZYL/v2ynYMF6Al/Pxb/kqP2U0c6eG9 h596FY7Ojk7+ySGPV36Z7066LY3XPCk6K6QH027MgeknBm821gCU8m3bKixS8lNcFzuw vQYa6bPXzng+0uoYSp8ZoGmYduTe9qRTCZa1u2tepyjZ/wIHRbLu7ZBzNeJUGeazY6hU i/JTF8GMAFasTZWnbHQTK3sJpaJsJytuOxy2kIwR9Sqql06cfuKX6XFQ3avk7IRrbmkw +NCs1hFkMUqRiV/iNHb5a8cCVi2u56VhcYkHfEyIwB7hd0Q27c5K93QoW+wrL2NYI/Oi 3cIA== X-Gm-Message-State: AFqh2kq7Tu4BVqYwHG+fr51ZiiF+fVMrEqH1VpOy/Vq1qNjhjNGJwS7i LQ12pv3maNEu6QpkWFlE312thEKBOvU= X-Received: by 2002:a05:600c:3d05:b0:3d3:5c21:dd94 with SMTP id bh5-20020a05600c3d0500b003d35c21dd94mr25123341wmb.9.1672473447131; Fri, 30 Dec 2022 23:57:27 -0800 (PST) Received: from localhost.localdomain (host-79-56-217-20.retail.telecomitalia.it. [79.56.217.20]) by smtp.gmail.com with ESMTPSA id l42-20020a05600c1d2a00b003d23928b654sm39389232wms.11.2022.12.30.23.57.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 23:57:26 -0800 (PST) From: "Fabio M. De Francesco" To: Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: "Fabio M. De Francesco" , Al Viro , Ira Weiny Subject: [PATCH 3/4] fs/sysv: Use dir_put_page() in sysv_rename() Date: Sat, 31 Dec 2022 08:57:16 +0100 Message-Id: <20221231075717.10258-4-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221231075717.10258-1-fmdefrancesco@gmail.com> References: <20221231075717.10258-1-fmdefrancesco@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_NONE,SPF_HELO_NONE,SPF_PASS 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 Use the dir_put_page() helper in sysv_rename() instead of open-coding two kunmap() + put_page(). Cc: Al Viro Suggested-by: Ira Weiny Signed-off-by: Fabio M. De Francesco --- fs/sysv/dir.c | 2 +- fs/sysv/namei.c | 9 +++------ fs/sysv/sysv.h | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index 0a8b5828c390..a37747e9e9a3 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c @@ -28,7 +28,7 @@ const struct file_operations sysv_dir_operations = { .fsync = generic_file_fsync, }; -static inline void dir_put_page(struct page *page) +inline void dir_put_page(struct page *page) { kunmap(page); put_page(page); diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index b2e6abc06a2d..981c1d76f342 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c @@ -250,13 +250,10 @@ static int sysv_rename(struct user_namespace *mnt_userns, struct inode *old_dir, return 0; out_dir: - if (dir_de) { - kunmap(dir_page); - put_page(dir_page); - } + if (dir_de) + dir_put_page(dir_page); out_old: - kunmap(old_page); - put_page(old_page); + dir_put_page(old_page); out: return err; } diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h index 99ddf033da4f..b250ac1dd348 100644 --- a/fs/sysv/sysv.h +++ b/fs/sysv/sysv.h @@ -148,6 +148,7 @@ extern void sysv_destroy_icache(void); /* dir.c */ +extern void dir_put_page(struct page *page); extern struct sysv_dir_entry *sysv_find_entry(struct dentry *, struct page **); extern int sysv_add_link(struct dentry *, struct inode *); extern int sysv_delete_entry(struct sysv_dir_entry *, struct page *); -- 2.39.0