Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: "Misono, Tomohiro" <misono.tomohiro@jp.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: <dsterba@suse.cz>, Anand Jain <anand.jain@oracle.com>
Subject: [PATCH 1/2] btrfs: fix the bug of device scan/ready for mounted, filesystem
Date: Wed, 17 Jan 2018 17:37:39 +0900	[thread overview]
Message-ID: <923e5500-d6d8-b4b5-eb0b-30b80760a3f1@jp.fujitsu.com> (raw)
In-Reply-To: <7fba2dc9-44a9-4317-b9fd-263b2a687e9a@jp.fujitsu.com>

commit ae3acc5fc0bf ("btrfs: cleanup btrfs_mount() using
btrfs_mount_root()") introduces a bug that "btrfs device scan/ready" for
mounted filesystem fails.

This is because fs_info->bdev_holder has been changed to hold
btrfs_root_fs_type instead of btrfs_fs_type by this commit, but ioctl
for device scan/ready still uses btrfs_fs_type to call
btrfs_scan_one_device(). This leads to failiure of blkdev_get_by_path()
for mounted filesystem because of different holder type.

Fix this by specifying btrfs_root_fs_type for btrfs_scan_one_device() in
the path of device ready/scan ioctl.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
---
 fs/btrfs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 9438d32c4267..6ff13948b655 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2231,11 +2231,11 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
 	switch (cmd) {
 	case BTRFS_IOC_SCAN_DEV:
 		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
-					    &btrfs_fs_type, &fs_devices);
+					    &btrfs_root_fs_type, &fs_devices);
 		break;
 	case BTRFS_IOC_DEVICES_READY:
 		ret = btrfs_scan_one_device(vol->name, FMODE_READ,
-					    &btrfs_fs_type, &fs_devices);
+					    &btrfs_root_fs_type, &fs_devices);
 		if (ret)
 			break;
 		ret = !(fs_devices->num_devices == fs_devices->total_devices);
-- 
2.14.3


  reply	other threads:[~2018-01-17  8:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-17  8:36 [PATCH 0/2] btrfs: additional fix for mount cleanup Misono, Tomohiro
2018-01-17  8:37 ` Misono, Tomohiro [this message]
2018-01-18  6:57   ` [PATCH 1/2] btrfs: fix the bug of device scan/ready for mounted, filesystem Anand Jain
2018-01-18 15:09   ` David Sterba
2018-01-17  8:38 ` [PATCH 2/2] btrfs: remove unused arg from parse_subvol_options() Misono, Tomohiro
2018-01-18 15:15   ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=923e5500-d6d8-b4b5-eb0b-30b80760a3f1@jp.fujitsu.com \
    --to=misono.tomohiro@jp.fujitsu.com \
    --cc=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox