btrfs: update device path inode time instead of bd_inode
authorJosef Bacik <josef@toxicpanda.com>
Thu, 14 Oct 2021 17:11:01 +0000 (13:11 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 09:39:22 +0000 (10:39 +0100)
commit2ec78af152e95acfc8a27f3251b543fe545599c3
tree2badff7b8e114fe06cfefd8c376ea1766dc82ee7
parent9febc9d8d2b4f367c364ccf3b4a4a2335291cff2
btrfs: update device path inode time instead of bd_inode

commit 54fde91f52f515e0b1514f0f0fa146e87a672227 upstream.

Christoph pointed out that I'm updating bdev->bd_inode for the device
time when we remove block devices from a btrfs file system, however this
isn't actually exposed to anything.  The inode we want to update is the
one that's associated with the path to the device, usually on devtmpfs,
so that blkid notices the difference.

We still don't want to do the blkdev_open, so use kern_path() to get the
path to the given device and do the update time on that inode.

Fixes: 8f96a5bfa150 ("btrfs: update the bdev time directly when closing")
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/volumes.c