Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2611853rda; Wed, 25 Oct 2023 07:40:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE47q6ZP9XZiB/t6C5ULZ8lttFVt2g1Pw7uPVd+zvs1b6Sr0T7iAElvOqWoQRKcNl8eb+wa X-Received: by 2002:a25:4289:0:b0:d9a:4f14:5bf9 with SMTP id p131-20020a254289000000b00d9a4f145bf9mr13166231yba.26.1698244814447; Wed, 25 Oct 2023 07:40:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698244814; cv=none; d=google.com; s=arc-20160816; b=Vv+EJ0P/KxK9ll5/By+5QPx8H/F+s3uNyEOYNHPLFhGe/hCrR8TDAVU0GA0xU+tJkN shPnTkkvj3ie1uZ50dEedNDIJtZB4svIbD4e2rmfS/D/S5FWZLHcIUgKUlBSIkMky6Ha 6h1ZwySH32UPl7UZ86Pu8vMois5kYm3v5DAaXnPRb9dyKLA7yQkMEDePLTmdwiY8V0oM LfwYDzgjeY5MtWDOTAzwSY0AFdmNL41xZthL3Uh4R+CqYYBFddGT+d4r4hpOonMux+Wj vKbBqMQIPBT7oLRhcekP6hbt+MKESQmDccTEYSOTehp39J1mTR61VYZYLfJqGSmmKFJ8 OKtA== 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=oOOGhallOPxnWGST34MdPR6LpOdkhm6q6XmykKHjQ0c=; fh=frgPBLWOZvp32JiMJOLt6aKy7B3S1iDiMKfksagzb84=; b=y16JZQXdYmoMNIaSkGo+2dnh/pblfL1Maxi+rde71S0ZI+DmuuXLqywoK2EEAThjq6 YVLbJtm0OnAhSO51CyDq7tmT0xHed365zLkCOfZa9qG8z1JJX6gwU/brqoSsbnqCt5tL g165T4eh5NqmLfD7hjq3lK2HKx7LHTvAl2RmfOC2XtcsZYqwU6JsaHWKi8E/NO1wpc13 qACG9HF9YUo4B8ZkXupV1U+IOM5jdqP845sEAGwCbl4vuCNo2QfQR+x+dZG0P6b7Rh6e I/rBKRUQQARzBWem5x9wVEEAO7Dny/E7nY4TitzgGsxRbAikkFzOAA9iJPjRBggpZ6eY 60IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gT2LfIBM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id x203-20020a25ced4000000b00d9a52441a9dsi11431309ybe.370.2023.10.25.07.40.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:40:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gT2LfIBM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id B363C8116E75; Wed, 25 Oct 2023 07:40:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344740AbjJYODx (ORCPT + 99 others); Wed, 25 Oct 2023 10:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235054AbjJYODt (ORCPT ); Wed, 25 Oct 2023 10:03:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1900518D for ; Wed, 25 Oct 2023 07:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698242534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oOOGhallOPxnWGST34MdPR6LpOdkhm6q6XmykKHjQ0c=; b=gT2LfIBMmQ8sCCKPzUxLcI7wq6s2aIyE98U06NzNmSIBPseLsePeYNdg0v+gQLgIfTPJrB /1l4qyt0AHF8g42FLc/sqvnLyp8/2gdWLk02P+24+3DCkyTCA+TMMuuWnwhrc6PHOpY4Iw YPsKfm28BeQ4F8Gu4THGbG0qUtFTkh8= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-412-qAzJUC4LNAWxidPLCC6QjQ-1; Wed, 25 Oct 2023 10:02:12 -0400 X-MC-Unique: qAzJUC4LNAWxidPLCC6QjQ-1 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9c797b497e8so308368766b.0 for ; Wed, 25 Oct 2023 07:02:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698242531; x=1698847331; 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=oOOGhallOPxnWGST34MdPR6LpOdkhm6q6XmykKHjQ0c=; b=ZNez/9vhFGXzwwJW9k/jEvi+XSTkBzRNjrteYh9npLR6rG4zPKjDo8mcRQb8Xfk7FX Cmtu70W/Jm+A1Z6BMBs9QTOGYEs39rkM8P9FSV/i9KwCUPq8B0PcATAQztPTSSfdKnNH ZGL2K7PdLlhrnlIkZEXh9prUQh+r+icS+Qpphmyni+sNQzUfgxnfX6lNlV6gJITf9luw 1DSGbpLmrbjzHTwibQh6EP6NsaXqNGdNP0w/Pb3yuCMewfvvuW2hrBpNxM2ZA4FW0CqR dKwzw89dWUes+FC83uQbD/bQA+HP2WX6GdrJzedC+GPnpFyNFpweZsYo0/BjrCSsosFl wcWg== X-Gm-Message-State: AOJu0Yy6WFiUYkicLwXPi87hDmi/oXBkGAeywyKaMHDI4kBnFnFzoycW nwgEW1iyraXcsWH0vzr5cslU6gwV0EdBP9gc4/K/KXvhKOqL3Hmy8EQOkuQAd9FDgAYpgNe4BHS O9U3hYgn/ECZ+8FuhcLLcQKhx X-Received: by 2002:a17:907:7214:b0:9c5:64f2:eaba with SMTP id dr20-20020a170907721400b009c564f2eabamr12173163ejc.53.1698242531652; Wed, 25 Oct 2023 07:02:11 -0700 (PDT) X-Received: by 2002:a17:907:7214:b0:9c5:64f2:eaba with SMTP id dr20-20020a170907721400b009c564f2eabamr12173147ejc.53.1698242531456; Wed, 25 Oct 2023 07:02:11 -0700 (PDT) Received: from maszat.piliscsaba.szeredi.hu (92-249-235-200.pool.digikabel.hu. [92.249.235.200]) by smtp.gmail.com with ESMTPSA id vl9-20020a170907b60900b00989828a42e8sm9857073ejc.154.2023.10.25.07.02.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 07:02:10 -0700 (PDT) From: Miklos Szeredi To: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , Matthew House , Florian Weimer , Arnd Bergmann Subject: [PATCH v4 3/6] namespace: extract show_path() helper Date: Wed, 25 Oct 2023 16:02:01 +0200 Message-ID: <20231025140205.3586473-4-mszeredi@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231025140205.3586473-1-mszeredi@redhat.com> References: <20231025140205.3586473-1-mszeredi@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 25 Oct 2023 07:40:07 -0700 (PDT) To be used by the statmount(2) syscall as well. Signed-off-by: Miklos Szeredi --- fs/internal.h | 2 ++ fs/namespace.c | 9 +++++++++ fs/proc_namespace.c | 10 +++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/internal.h b/fs/internal.h index d64ae03998cc..0c4f4cf2ff5a 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -83,6 +83,8 @@ int path_mount(const char *dev_name, struct path *path, const char *type_page, unsigned long flags, void *data_page); int path_umount(struct path *path, int flags); +int show_path(struct seq_file *m, struct dentry *root); + /* * fs_struct.c */ diff --git a/fs/namespace.c b/fs/namespace.c index 0eab47ffc76c..7a33ea391a02 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -4672,6 +4672,15 @@ SYSCALL_DEFINE5(mount_setattr, int, dfd, const char __user *, path, return err; } +int show_path(struct seq_file *m, struct dentry *root) +{ + if (root->d_sb->s_op->show_path) + return root->d_sb->s_op->show_path(m, root); + + seq_dentry(m, root, " \t\n\\"); + return 0; +} + static void __init init_mount_tree(void) { struct vfsmount *mnt; diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c index 73d2274d5f59..0a808951b7d3 100644 --- a/fs/proc_namespace.c +++ b/fs/proc_namespace.c @@ -142,13 +142,9 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt) seq_printf(m, "%i %i %u:%u ", r->mnt_id, r->mnt_parent->mnt_id, MAJOR(sb->s_dev), MINOR(sb->s_dev)); - if (sb->s_op->show_path) { - err = sb->s_op->show_path(m, mnt->mnt_root); - if (err) - goto out; - } else { - seq_dentry(m, mnt->mnt_root, " \t\n\\"); - } + err = show_path(m, mnt->mnt_root); + if (err) + goto out; seq_putc(m, ' '); /* mountpoints outside of chroot jail will give SEQ_SKIP on this */ -- 2.41.0