Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1264893pxa; Thu, 20 Aug 2020 07:05:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0zG811x70IpeI3fASvIb0MvL9NgRqn0xu4SGBgW4AH6MoPu+12ngg1GavWY0MDA6HgKyn X-Received: by 2002:a17:907:724b:: with SMTP id ds11mr3381919ejc.481.1597932357732; Thu, 20 Aug 2020 07:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597932357; cv=none; d=google.com; s=arc-20160816; b=vEu2peGke3TeRK1UtxktdcObOVD90W66yTJRDBgIMUFwWYTZ4/HYDytY1JOthctExk Qeaw7sAOtQah6qpbUt9r3GxPc8u4ODQ6vt2Fv8DL5cM6PVHCYxL5GEQVYplVz1MdVM2l u+I0jiQXhKfQRgzVDFAntAX1Ywj3X9AiRP2KH/GLdZ0WrjJIa8hhafV5ZBxbhzxU/mj8 paEUitIAPfViV7yc54rlD9Li1MZiMARmyhl3+k5CUYoyMzDGVk8jp99PJ5yMt9mVKBtc hEcOJqqhK6DO9/m2GWhUhiK30UA0t7W/6AerZg89DvFGrufOxHsQnTJElOjGFifgi1R9 iiKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zIDAt6f1fJoFNPLiPy84sl7dLYKyRHJlHf92yLDpDzQ=; b=atM7OobMUfsAcDveQtoKyOWp42CG/3OPO++MzGy/XzUmCZ5G9cT6Fwqi9OVjTJofmA /CiPCWoKMSZC3oDqr/1Qu5blN2bo3SOem8/TnEc11soeHn3xHUpPfxtob20YCzeiqs7z OEVsodQp5tprHKlkyrPaJH8KB0UA1hSYFUcxdkiAYZgYZzPie1RV3Q2PuY8dUNLeILqa l/qJp4gNIIkst5s3ew7kERn1zj3d+0y8AHkIUWAs4P1/hUbEWwuX8HH0rPWtWNnAaxKt UNEEi5W4exKTWZNoFXsHZmeHpFp4y/r61SX/zDVLvPD2kYrFr/G+bNh1Miu0Skn0xitr J82g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HU0SPkfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si1387730edr.11.2020.08.20.07.05.33; Thu, 20 Aug 2020 07:05:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HU0SPkfs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbgHTOAr (ORCPT + 99 others); Thu, 20 Aug 2020 10:00:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:34302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbgHTJ0R (ORCPT ); Thu, 20 Aug 2020 05:26:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B12CD2075E; Thu, 20 Aug 2020 09:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915577; bh=VNURiwepPfOHCYWSBAiSVCnkHz/Eyq1gIpHIveQMb1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HU0SPkfsizh2u0hM1Tm1vAwPdFgWJhieaUtecygOmP4WtFimBVVbwE4aXb5qqdr2L a69lvBU7suEVQT5qdNXhc3GcDyhXvOnwgrep1CwTiAMzxTkEpmeixhUzR21xE6XfJ1 6aQxRydM/7m5vqqPrCTKbFdZ1zEfJ/tWU+gEkCzE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Murphy , Josef Bacik , David Sterba Subject: [PATCH 5.8 033/232] btrfs: dont show full path of bind mounts in subvol= Date: Thu, 20 Aug 2020 11:18:04 +0200 Message-Id: <20200820091614.367868253@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik commit 3ef3959b29c4a5bd65526ab310a1a18ae533172a upstream. Chris Murphy reported a problem where rpm ostree will bind mount a bunch of things for whatever voodoo it's doing. But when it does this /proc/mounts shows something like /dev/sda /mnt/test btrfs rw,relatime,subvolid=256,subvol=/foo 0 0 /dev/sda /mnt/test/baz btrfs rw,relatime,subvolid=256,subvol=/foo/bar 0 0 Despite subvolid=256 being subvol=/foo. This is because we're just spitting out the dentry of the mount point, which in the case of bind mounts is the source path for the mountpoint. Instead we should spit out the path to the actual subvol. Fix this by looking up the name for the subvolid we have mounted. With this fix the same test looks like this /dev/sda /mnt/test btrfs rw,relatime,subvolid=256,subvol=/foo 0 0 /dev/sda /mnt/test/baz btrfs rw,relatime,subvolid=256,subvol=/foo 0 0 Reported-by: Chris Murphy CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/super.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1312,6 +1312,7 @@ static int btrfs_show_options(struct seq { struct btrfs_fs_info *info = btrfs_sb(dentry->d_sb); const char *compress_type; + const char *subvol_name; if (btrfs_test_opt(info, DEGRADED)) seq_puts(seq, ",degraded"); @@ -1398,8 +1399,13 @@ static int btrfs_show_options(struct seq seq_puts(seq, ",ref_verify"); seq_printf(seq, ",subvolid=%llu", BTRFS_I(d_inode(dentry))->root->root_key.objectid); - seq_puts(seq, ",subvol="); - seq_dentry(seq, dentry, " \t\n\\"); + subvol_name = btrfs_get_subvol_name_from_objectid(info, + BTRFS_I(d_inode(dentry))->root->root_key.objectid); + if (!IS_ERR(subvol_name)) { + seq_puts(seq, ",subvol="); + seq_escape(seq, subvol_name, " \t\n\\"); + kfree(subvol_name); + } return 0; }