Devices opened through replace/add would have FMODE_WRITE | FMODE_EXCL,
as compared with devices opened through the mount which will have
FMODE_READ | FMODE_WRITE | FMODE_EXCL. So maintain consistency.
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
fs/btrfs/volumes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 765c2bd2d8d9..7008b5d104d4 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2323,7 +2323,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
u64 tmp;
int seeding_dev = 0;
int ret = 0;
- fmode_t flag = FMODE_WRITE | FMODE_EXCL;
+ fmode_t flag = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
if (sb_rdonly(sb) && !fs_info->fs_devices->seeding)
return -EROFS;
@@ -2526,7 +2526,7 @@ int btrfs_init_dev_replace_tgtdev(struct btrfs_fs_info *fs_info,
struct rcu_string *name;
u64 devid = BTRFS_DEV_REPLACE_DEVID;
int ret = 0;
- fmode_t flags = FMODE_WRITE | FMODE_EXCL;
+ fmode_t flags = FMODE_READ | FMODE_WRITE | FMODE_EXCL;
*device_out = NULL;
if (fs_info->fs_devices->seeding) {
--
2.13.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html