From: Anand Jain <Anand.Jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/2] btrfs: we are not yet ready if device is missing
Date: Tue, 24 Jun 2014 20:51:43 +0800 [thread overview]
Message-ID: <1403614303-4210-2-git-send-email-Anand.Jain@oracle.com> (raw)
In-Reply-To: <1403614303-4210-1-git-send-email-Anand.Jain@oracle.com>
reproducer:
mkfs.btrfs -f -draid1 -mraid1 /dev/sdf /dev/sdd
modprobe -r btrfs && modprobe btrfs
mount -o degraded /dev/sdd /btrfs <-- calls add_missing_dev() to add missing btrfs_device
umount /btrfs
btrfs dev ready /dev/sdd
echo $?
0
mount /dev/sdd /btrfs
mount: wrong fs type, bad option, bad superblock on /dev/sdd,
missing codepage or helper program, or other error
fix this by checking if the device name is present in the BTRFS_IOC_DEVICES_READY
ioctl
Signed-off-by: Anand Jain <Anand.Jain@oracle.com>
---
fs/btrfs/super.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index b9efe58..74ef9bf 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -1857,6 +1857,7 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
struct btrfs_fs_devices *fs_devices;
int ret = -ENOTTY;
void __user *argp = (void __user *)arg;
+ struct btrfs_device *dev;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -1882,6 +1883,14 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
kfree(vol);
if (ret)
break;
+
+ list_for_each_entry(dev, &fs_devices->devices, dev_list) {
+ if (dev->name)
+ continue;
+
+ return !0;
+ }
+
ret = !(fs_devices->num_devices == fs_devices->total_devices);
break;
case BTRFS_IOC_GET_FSLIST:
--
2.0.0.257.g75cc6c6
next prev parent reply other threads:[~2014-06-24 12:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-24 12:51 [PATCH 1/2] btrfs: device list could grow infinite Anand Jain
2014-06-24 12:51 ` Anand Jain [this message]
2014-06-30 8:31 ` Anand Jain
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=1403614303-4210-2-git-send-email-Anand.Jain@oracle.com \
--to=anand.jain@oracle.com \
--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;
as well as URLs for NNTP newsgroup(s).