Re: [PATCH] btrfs: Fix a lockdep warning when running xfstest.

2015-07-08 Thread Liu Bo
On Thu, Oct 30, 2014 at 04:52:31PM +0800, Qu Wenruo wrote:
 The following lockdep warning is triggered during xfstests:
 
 [ 1702.980872] =
 [ 1702.981181] [ INFO: possible irq lock inversion dependency detected ]
 [ 1702.981482] 3.18.0-rc1 #27 Not tainted
 [ 1702.981781] -
 [ 1702.982095] kswapd0/77 just changed the state of lock:
 [ 1702.982415]  (delayed_node-mutex){+.+.-.}, at: [a03b0b51] 
 __btrfs_release_delayed_node+0x41/0x1f0 [btrfs]
 [ 1702.982794] but this lock took another, RECLAIM_FS-unsafe lock in the past:
 [ 1702.983160]  (fs_info-dev_replace.lock){+.+.+.}
 
 and interrupts could create inverse lock ordering between them.
 
 [ 1702.984675]
 other info that might help us debug this:
 [ 1702.985524] Chain exists of:
   delayed_node-mutex -- found-groups_sem -- fs_info-dev_replace.lock
 
 [ 1702.986799]  Possible interrupt unsafe locking scenario:
 
 [ 1702.987681]CPU0CPU1
 [ 1702.988137]
 [ 1702.988598]   lock(fs_info-dev_replace.lock);
 [ 1702.989069]local_irq_disable();
 [ 1702.989534]lock(delayed_node-mutex);
 [ 1702.990038]lock(found-groups_sem);
 [ 1702.990494]   Interrupt
 [ 1702.990938] lock(delayed_node-mutex);
 [ 1702.991407]
  *** DEADLOCK ***
 
 It is because the btrfs_kobj_{add/rm}_device() will call memory
 allocation with GFP_KERNEL,
 which may flush fs page cache to free space, waiting for it self to do
 the commit, causing the deadlock.

I've seen the same one recently, but I'm not sure I understand this
commig log correctly, do you mean that memory allocation forces kswapd
thread to deadlock?  Can you elaborate upon this deadlock?

Thanks,

-liubo
 
 To solve the problem, move btrfs_kobj_{add/rm}_device() out of the
 dev_replace lock range, also involing split the
 btrfs_rm_dev_replace_srcdev() function into remove and free parts.
 
 Now only btrfs_rm_dev_replace_remove_srcdev() is called in dev_replace
 lock range, and kobj_{add/rm} and btrfs_rm_dev_replace_free_srcdev() are
 called out of the lock range.
 
 Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com
 ---
  fs/btrfs/dev-replace.c | 11 ++-
  fs/btrfs/volumes.c | 10 --
  fs/btrfs/volumes.h |  6 --
  3 files changed, 18 insertions(+), 9 deletions(-)
 
 diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
 index 6f662b3..6e3e885 100644
 --- a/fs/btrfs/dev-replace.c
 +++ b/fs/btrfs/dev-replace.c
 @@ -571,15 +571,11 @@ static int btrfs_dev_replace_finishing(struct 
 btrfs_fs_info *fs_info,
   list_add(tgt_device-dev_alloc_list, fs_info-fs_devices-alloc_list);
   fs_info-fs_devices-rw_devices++;
  
 - /* replace the sysfs entry */
 - btrfs_kobj_rm_device(fs_info, src_device);
 - btrfs_kobj_add_device(fs_info, tgt_device);
 -
   btrfs_dev_replace_unlock(dev_replace);
  
   btrfs_rm_dev_replace_blocked(fs_info);
  
 - btrfs_rm_dev_replace_srcdev(fs_info, src_device);
 + btrfs_rm_dev_replace_remove_srcdev(fs_info, src_device);
  
   btrfs_rm_dev_replace_unblocked(fs_info);
  
 @@ -594,6 +590,11 @@ static int btrfs_dev_replace_finishing(struct 
 btrfs_fs_info *fs_info,
   mutex_unlock(root-fs_info-fs_devices-device_list_mutex);
   mutex_unlock(uuid_mutex);
  
 + /* replace the sysfs entry */
 + btrfs_kobj_rm_device(fs_info, src_device);
 + btrfs_kobj_add_device(fs_info, tgt_device);
 + btrfs_rm_dev_replace_free_srcdev(fs_info, src_device);
 +
   /* write back the superblocks */
   trans = btrfs_start_transaction(root, 0);
   if (!IS_ERR(trans))
 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
 index d47289c..0192051 100644
 --- a/fs/btrfs/volumes.c
 +++ b/fs/btrfs/volumes.c
 @@ -1800,8 +1800,8 @@ error_undo:
   goto error_brelse;
  }
  
 -void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info,
 -  struct btrfs_device *srcdev)
 +void btrfs_rm_dev_replace_remove_srcdev(struct btrfs_fs_info *fs_info,
 + struct btrfs_device *srcdev)
  {
   struct btrfs_fs_devices *fs_devices;
  
 @@ -1829,6 +1829,12 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info 
 *fs_info,
  
   if (srcdev-bdev)
   fs_devices-open_devices--;
 +}
 +
 +void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
 +   struct btrfs_device *srcdev)
 +{
 + struct btrfs_fs_devices *fs_devices = srcdev-fs_devices;
  
   call_rcu(srcdev-rcu, free_device);
  
 diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
 index 08980fa..4cc00e6 100644
 --- a/fs/btrfs/volumes.h
 +++ b/fs/btrfs/volumes.h
 @@ -448,8 +448,10 @@ void btrfs_init_devices_late(struct btrfs_fs_info 
 *fs_info);
  int btrfs_init_dev_stats(struct btrfs_fs_info 

[PATCH 6/6] Btrfs: sysfs: support seed devices in the sysfs layout

2015-07-08 Thread Anand Jain
This adds an enhancement to show the seed fsid and its devices
on the btrfs sysfs.

The way sprouting handles fs_devices:
  clone seed fs_devices and add to the fs_uuids
  mem copy seed fs_devices and assign to fs_devices-seed (move dev_list)
  evacuate seed fs_devices contents to hold sprout fs devices contents

  So to be inline with this fs_devices changes during seeding,
  represent seed fsid under the sprout fsid, this is achieved
  by using the kobject_move()
  The end result will be,
/sys/fs/btrfs/sprout-fsid/seed/level-1-seed-fsid/seed/(if)level-2-seed-fsid

Signed-off-by: Anand Jain anand.j...@oracle.com
---
 fs/btrfs/dev-replace.c |   7 ++-
 fs/btrfs/disk-io.c |   6 +-
 fs/btrfs/sysfs.c   | 150 +++--
 fs/btrfs/sysfs.h   |  12 ++--
 fs/btrfs/volumes.c |  26 -
 fs/btrfs/volumes.h |   1 +
 6 files changed, 160 insertions(+), 42 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 31e0145..d0c9562 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -376,7 +376,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
WARN_ON(!tgt_device);
dev_replace-tgtdev = tgt_device;
 
-   ret = btrfs_sysfs_add_device_link(tgt_device-fs_devices, tgt_device);
+   ret = btrfs_sysfs_add_device_link(tgt_device-fs_devices, tgt_device, 
0);
if (ret)
btrfs_error(root-fs_info, ret, kobj add dev failed);
 
@@ -587,7 +587,10 @@ static int btrfs_dev_replace_finishing(struct 
btrfs_fs_info *fs_info,
mutex_unlock(uuid_mutex);
 
/* replace the sysfs entry */
-   btrfs_sysfs_rm_device_link(fs_info-fs_devices, src_device);
+   btrfs_sysfs_rm_device_link(fs_info-fs_devices, src_device, 0);
+   if (src_device-fs_devices-seeding 
+   !src_device-fs_devices-num_devices)
+   btrfs_sysfs_remove_fsid(src_device-fs_devices);
btrfs_rm_dev_replace_free_srcdev(fs_info, src_device);
 
/* write back the superblocks */
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4eaa554..b3c9870 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2876,13 +2876,13 @@ retry_root_backup:
 
btrfs_close_extra_devices(fs_devices, 1);
 
-   ret = btrfs_sysfs_add_fsid(fs_devices, NULL);
-   if (ret) {
+   ret = btrfs_sysfs_add_fsid(fs_devices, NULL, 1);
+   if (ret  ret != -EEXIST) {
pr_err(BTRFS: failed to init sysfs fsid interface: %d\n, ret);
goto fail_block_groups;
}
 
-   ret = btrfs_sysfs_add_device(fs_devices);
+   ret = btrfs_sysfs_add_device(fs_devices, 1);
if (ret) {
pr_err(BTRFS: failed to init sysfs device interface: %d\n, 
ret);
goto fail_fsdev_sysfs;
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index e0ac859..3a45462 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -517,6 +517,11 @@ static int addrm_unknown_feature_attrs(struct 
btrfs_fs_info *fs_info, bool add)
 
 static void __btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
 {
+   if (fs_devs-seed) {
+   __btrfs_sysfs_remove_fsid(fs_devs-seed);
+   btrfs_sysfs_rm_seed_dir(fs_devs);
+   }
+
if (fs_devs-device_dir_kobj) {
kobject_del(fs_devs-device_dir_kobj);
kobject_put(fs_devs-device_dir_kobj);
@@ -557,7 +562,7 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info 
*fs_info)
addrm_unknown_feature_attrs(fs_info, false);
sysfs_remove_group(fs_info-fs_devices-fsid_kobj, 
btrfs_feature_attr_group);
sysfs_remove_files(fs_info-fs_devices-fsid_kobj, btrfs_attrs);
-   btrfs_sysfs_rm_device_link(fs_info-fs_devices, NULL);
+   btrfs_sysfs_rm_device_link(fs_info-fs_devices, NULL, 1);
 }
 
 const char * const btrfs_feature_set_names[3] = {
@@ -638,7 +643,7 @@ static void init_feature_attrs(void)
 /* when one_device is NULL, it removes all device links */
 
 int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices,
-   struct btrfs_device *one_device)
+   struct btrfs_device *one_device, int follow_seed)
 {
struct hd_struct *disk;
struct kobject *disk_kobj;
@@ -668,27 +673,38 @@ int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices 
*fs_devices,
disk_kobj-name);
}
 
+   if (follow_seed  fs_devices-seed)
+   btrfs_sysfs_rm_device_link(fs_devices-seed, NULL, follow_seed);
+
return 0;
 }
 
-int btrfs_sysfs_add_device(struct btrfs_fs_devices *fs_devs)
+int btrfs_sysfs_add_device(struct btrfs_fs_devices *fs_devs, int follow_seed)
 {
-   if (!fs_devs-device_dir_kobj)
-   fs_devs-device_dir_kobj = kobject_create_and_add(devices,
-   fs_devs-fsid_kobj);
+   while (fs_devs) {
+   if 

[PATCH 0/6] sysfs-part2 Add seed device representation on the sysfs

2015-07-08 Thread Anand Jain
This patch adds the support to show seed device on the btrfs sysfs.
This is a revamped version of the previously single patch 6/6, and plus
incorporates David suggestion to add seed fsid under the 'seed' kobject.

Since this adds new patches and to bring in seed kobject it needed
quite a lot of revamp I am resetting the patch set version to 1.

Anand Jain (6):
  Btrfs: rename btrfs_sysfs_add_one to btrfs_sysfs_add_mounted
  Btrfs: rename btrfs_sysfs_remove_one to btrfs_sysfs_remove_mounted
  Btrfs: rename btrfs_kobj_add_device to btrfs_sysfs_add_device_link
  Btrfs: rename btrfs_kobj_rm_device to btrfs_sysfs_rm_device_link
  Btrfs: rename super_kobj to fsid_kobj
  Btrfs: sysfs: support seed devices in the sysfs layout

 fs/btrfs/ctree.h   |   4 +-
 fs/btrfs/dev-replace.c |   7 +-
 fs/btrfs/disk-io.c |  12 ++--
 fs/btrfs/sysfs.c   | 190 +++--
 fs/btrfs/sysfs.h   |  16 +++--
 fs/btrfs/volumes.c |  26 +++
 fs/btrfs/volumes.h |   3 +-
 7 files changed, 188 insertions(+), 70 deletions(-)

-- 
2.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] Btrfs: rename btrfs_kobj_add_device to btrfs_sysfs_add_device_link

2015-07-08 Thread Anand Jain
Signed-off-by: Anand Jain anand.j...@oracle.com
---
 fs/btrfs/dev-replace.c | 2 +-
 fs/btrfs/sysfs.c   | 4 ++--
 fs/btrfs/sysfs.h   | 2 +-
 fs/btrfs/volumes.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 862fbc2..f7c390b 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -376,7 +376,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
WARN_ON(!tgt_device);
dev_replace-tgtdev = tgt_device;
 
-   ret = btrfs_kobj_add_device(tgt_device-fs_devices, tgt_device);
+   ret = btrfs_sysfs_add_device_link(tgt_device-fs_devices, tgt_device);
if (ret)
btrfs_error(root-fs_info, ret, kobj add dev failed);
 
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 095a302..df67f6b 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -683,7 +683,7 @@ int btrfs_sysfs_add_device(struct btrfs_fs_devices *fs_devs)
return 0;
 }
 
-int btrfs_kobj_add_device(struct btrfs_fs_devices *fs_devices,
+int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device)
 {
int error = 0;
@@ -744,7 +744,7 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 
btrfs_set_fs_info_ptr(fs_info);
 
-   error = btrfs_kobj_add_device(fs_devs, NULL);
+   error = btrfs_sysfs_add_device_link(fs_devs, NULL);
if (error)
return error;
 
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index 6392527..6529680 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -82,7 +82,7 @@ char *btrfs_printable_features(enum btrfs_feature_set set, 
u64 flags);
 extern const char * const btrfs_feature_set_names[3];
 extern struct kobj_type space_info_ktype;
 extern struct kobj_type btrfs_raid_ktype;
-int btrfs_kobj_add_device(struct btrfs_fs_devices *fs_devices,
+int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device);
 int btrfs_kobj_rm_device(struct btrfs_fs_devices *fs_devices,
 struct btrfs_device *one_device);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 8396699..cc1c8de 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2295,7 +2295,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char 
*device_path)
tmp + 1);
 
/* add sysfs device entry */
-   btrfs_kobj_add_device(root-fs_info-fs_devices, device);
+   btrfs_sysfs_add_device_link(root-fs_info-fs_devices, device);
 
/*
 * we've got more storage, clear any full flags on the space
-- 
2.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] Btrfs: rename btrfs_kobj_rm_device to btrfs_sysfs_rm_device_link

2015-07-08 Thread Anand Jain
Signed-off-by: Anand Jain anand.j...@oracle.com
---
 fs/btrfs/dev-replace.c | 2 +-
 fs/btrfs/sysfs.c   | 6 +++---
 fs/btrfs/sysfs.h   | 2 +-
 fs/btrfs/volumes.c | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index f7c390b..31e0145 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -587,7 +587,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info 
*fs_info,
mutex_unlock(uuid_mutex);
 
/* replace the sysfs entry */
-   btrfs_kobj_rm_device(fs_info-fs_devices, src_device);
+   btrfs_sysfs_rm_device_link(fs_info-fs_devices, src_device);
btrfs_rm_dev_replace_free_srcdev(fs_info, src_device);
 
/* write back the superblocks */
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index df67f6b..52319d1 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -557,7 +557,7 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info 
*fs_info)
addrm_unknown_feature_attrs(fs_info, false);
sysfs_remove_group(fs_info-fs_devices-super_kobj, 
btrfs_feature_attr_group);
sysfs_remove_files(fs_info-fs_devices-super_kobj, btrfs_attrs);
-   btrfs_kobj_rm_device(fs_info-fs_devices, NULL);
+   btrfs_sysfs_rm_device_link(fs_info-fs_devices, NULL);
 }
 
 const char * const btrfs_feature_set_names[3] = {
@@ -637,7 +637,7 @@ static void init_feature_attrs(void)
 
 /* when one_device is NULL, it removes all device links */
 
-int btrfs_kobj_rm_device(struct btrfs_fs_devices *fs_devices,
+int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device)
 {
struct hd_struct *disk;
@@ -750,7 +750,7 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 
error = sysfs_create_files(super_kobj, btrfs_attrs);
if (error) {
-   btrfs_kobj_rm_device(fs_devs, NULL);
+   btrfs_sysfs_rm_device_link(fs_devs, NULL);
return error;
}
 
diff --git a/fs/btrfs/sysfs.h b/fs/btrfs/sysfs.h
index 6529680..9c09522 100644
--- a/fs/btrfs/sysfs.h
+++ b/fs/btrfs/sysfs.h
@@ -84,7 +84,7 @@ extern struct kobj_type space_info_ktype;
 extern struct kobj_type btrfs_raid_ktype;
 int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices,
struct btrfs_device *one_device);
-int btrfs_kobj_rm_device(struct btrfs_fs_devices *fs_devices,
+int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices,
 struct btrfs_device *one_device);
 int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs,
struct kobject *parent);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index cc1c8de..6483da1 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1787,7 +1787,7 @@ int btrfs_rm_device(struct btrfs_root *root, char 
*device_path)
if (device-bdev) {
device-fs_devices-open_devices--;
/* remove sysfs entry */
-   btrfs_kobj_rm_device(root-fs_info-fs_devices, device);
+   btrfs_sysfs_rm_device_link(root-fs_info-fs_devices, device);
}
 
call_rcu(device-rcu, free_device);
@@ -1957,7 +1957,7 @@ void btrfs_destroy_dev_replace_tgtdev(struct 
btrfs_fs_info *fs_info,
WARN_ON(!tgtdev);
mutex_lock(fs_info-fs_devices-device_list_mutex);
 
-   btrfs_kobj_rm_device(fs_info-fs_devices, tgtdev);
+   btrfs_sysfs_rm_device_link(fs_info-fs_devices, tgtdev);
 
if (tgtdev-bdev) {
btrfs_scratch_superblock(tgtdev);
@@ -2374,7 +2374,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char 
*device_path)
 error_trans:
btrfs_end_transaction(trans, root);
rcu_string_free(device-name);
-   btrfs_kobj_rm_device(root-fs_info-fs_devices, device);
+   btrfs_sysfs_rm_device_link(root-fs_info-fs_devices, device);
kfree(device);
 error:
blkdev_put(bdev, FMODE_EXCL);
-- 
2.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] Btrfs: rename btrfs_sysfs_add_one to btrfs_sysfs_add_mounted

2015-07-08 Thread Anand Jain
Signed-off-by: Anand Jain anand.j...@oracle.com
---
 fs/btrfs/ctree.h   | 2 +-
 fs/btrfs/disk-io.c | 2 +-
 fs/btrfs/sysfs.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 80a9aef..b6b2226 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -4007,7 +4007,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
 /* sysfs.c */
 int btrfs_init_sysfs(void);
 void btrfs_exit_sysfs(void);
-int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info);
+int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info);
 void btrfs_sysfs_remove_one(struct btrfs_fs_info *fs_info);
 
 /* xattr.c */
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b977fc8..552dcbe 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2888,7 +2888,7 @@ retry_root_backup:
goto fail_fsdev_sysfs;
}
 
-   ret = btrfs_sysfs_add_one(fs_info);
+   ret = btrfs_sysfs_add_mounted(fs_info);
if (ret) {
pr_err(BTRFS: failed to init sysfs interface: %d\n, ret);
goto fail_fsdev_sysfs;
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 603b0cc..cabf840 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -736,7 +736,7 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs,
return error;
 }
 
-int btrfs_sysfs_add_one(struct btrfs_fs_info *fs_info)
+int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 {
int error;
struct btrfs_fs_devices *fs_devs = fs_info-fs_devices;
-- 
2.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] Btrfs: rename btrfs_sysfs_remove_one to btrfs_sysfs_remove_mounted

2015-07-08 Thread Anand Jain
Signed-off-by: Anand Jain anand.j...@oracle.com
---
 fs/btrfs/ctree.h   | 2 +-
 fs/btrfs/disk-io.c | 4 ++--
 fs/btrfs/sysfs.c   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b6b2226..eed1127 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -4008,7 +4008,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
 int btrfs_init_sysfs(void);
 void btrfs_exit_sysfs(void);
 int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info);
-void btrfs_sysfs_remove_one(struct btrfs_fs_info *fs_info);
+void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info);
 
 /* xattr.c */
 ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 552dcbe..4eaa554 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3067,7 +3067,7 @@ fail_cleaner:
filemap_write_and_wait(fs_info-btree_inode-i_mapping);
 
 fail_sysfs:
-   btrfs_sysfs_remove_one(fs_info);
+   btrfs_sysfs_remove_mounted(fs_info);
 
 fail_fsdev_sysfs:
btrfs_sysfs_remove_fsid(fs_info-fs_devices);
@@ -3748,7 +3748,7 @@ void close_ctree(struct btrfs_root *root)
   percpu_counter_sum(fs_info-delalloc_bytes));
}
 
-   btrfs_sysfs_remove_one(fs_info);
+   btrfs_sysfs_remove_mounted(fs_info);
btrfs_sysfs_remove_fsid(fs_info-fs_devices);
 
btrfs_free_fs_roots(fs_info);
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index cabf840..095a302 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -545,7 +545,7 @@ void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices 
*fs_devs)
}
 }
 
-void btrfs_sysfs_remove_one(struct btrfs_fs_info *fs_info)
+void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
 {
btrfs_reset_fs_info_ptr(fs_info);
 
@@ -776,7 +776,7 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 
return 0;
 failure:
-   btrfs_sysfs_remove_one(fs_info);
+   btrfs_sysfs_remove_mounted(fs_info);
return error;
 }
 
-- 
2.4.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] Btrfs: rename super_kobj to fsid_kobj

2015-07-08 Thread Anand Jain
Signed-off-by: Anand Jain anand.j...@oracle.com
---
 fs/btrfs/sysfs.c   | 36 ++--
 fs/btrfs/volumes.c |  2 +-
 fs/btrfs/volumes.h |  2 +-
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 52319d1..e0ac859 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -437,24 +437,24 @@ static const struct attribute *btrfs_attrs[] = {
NULL,
 };
 
-static void btrfs_release_super_kobj(struct kobject *kobj)
+static void btrfs_release_fsid_kobj(struct kobject *kobj)
 {
struct btrfs_fs_devices *fs_devs = to_fs_devs(kobj);
 
-   memset(fs_devs-super_kobj, 0, sizeof(struct kobject));
+   memset(fs_devs-fsid_kobj, 0, sizeof(struct kobject));
complete(fs_devs-kobj_unregister);
 }
 
 static struct kobj_type btrfs_ktype = {
.sysfs_ops  = kobj_sysfs_ops,
-   .release= btrfs_release_super_kobj,
+   .release= btrfs_release_fsid_kobj,
 };
 
 static inline struct btrfs_fs_devices *to_fs_devs(struct kobject *kobj)
 {
if (kobj-ktype != btrfs_ktype)
return NULL;
-   return container_of(kobj, struct btrfs_fs_devices, super_kobj);
+   return container_of(kobj, struct btrfs_fs_devices, fsid_kobj);
 }
 
 static inline struct btrfs_fs_info *to_fs_info(struct kobject *kobj)
@@ -502,12 +502,12 @@ static int addrm_unknown_feature_attrs(struct 
btrfs_fs_info *fs_info, bool add)
attrs[0] = fa-kobj_attr.attr;
if (add) {
int ret;
-   ret = 
sysfs_merge_group(fs_info-fs_devices-super_kobj,
+   ret = 
sysfs_merge_group(fs_info-fs_devices-fsid_kobj,
agroup);
if (ret)
return ret;
} else
-   
sysfs_unmerge_group(fs_info-fs_devices-super_kobj,
+   
sysfs_unmerge_group(fs_info-fs_devices-fsid_kobj,
agroup);
}
 
@@ -523,9 +523,9 @@ static void __btrfs_sysfs_remove_fsid(struct 
btrfs_fs_devices *fs_devs)
fs_devs-device_dir_kobj = NULL;
}
 
-   if (fs_devs-super_kobj.state_initialized) {
-   kobject_del(fs_devs-super_kobj);
-   kobject_put(fs_devs-super_kobj);
+   if (fs_devs-fsid_kobj.state_initialized) {
+   kobject_del(fs_devs-fsid_kobj);
+   kobject_put(fs_devs-fsid_kobj);
wait_for_completion(fs_devs-kobj_unregister);
}
 }
@@ -555,8 +555,8 @@ void btrfs_sysfs_remove_mounted(struct btrfs_fs_info 
*fs_info)
kobject_put(fs_info-space_info_kobj);
}
addrm_unknown_feature_attrs(fs_info, false);
-   sysfs_remove_group(fs_info-fs_devices-super_kobj, 
btrfs_feature_attr_group);
-   sysfs_remove_files(fs_info-fs_devices-super_kobj, btrfs_attrs);
+   sysfs_remove_group(fs_info-fs_devices-fsid_kobj, 
btrfs_feature_attr_group);
+   sysfs_remove_files(fs_info-fs_devices-fsid_kobj, btrfs_attrs);
btrfs_sysfs_rm_device_link(fs_info-fs_devices, NULL);
 }
 
@@ -675,7 +675,7 @@ int btrfs_sysfs_add_device(struct btrfs_fs_devices *fs_devs)
 {
if (!fs_devs-device_dir_kobj)
fs_devs-device_dir_kobj = kobject_create_and_add(devices,
-   fs_devs-super_kobj);
+   fs_devs-fsid_kobj);
 
if (!fs_devs-device_dir_kobj)
return -ENOMEM;
@@ -730,8 +730,8 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs,
int error;
 
init_completion(fs_devs-kobj_unregister);
-   fs_devs-super_kobj.kset = btrfs_kset;
-   error = kobject_init_and_add(fs_devs-super_kobj,
+   fs_devs-fsid_kobj.kset = btrfs_kset;
+   error = kobject_init_and_add(fs_devs-fsid_kobj,
btrfs_ktype, parent, %pU, fs_devs-fsid);
return error;
 }
@@ -740,7 +740,7 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
 {
int error;
struct btrfs_fs_devices *fs_devs = fs_info-fs_devices;
-   struct kobject *super_kobj = fs_devs-super_kobj;
+   struct kobject *fsid_kobj = fs_devs-fsid_kobj;
 
btrfs_set_fs_info_ptr(fs_info);
 
@@ -748,13 +748,13 @@ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info)
if (error)
return error;
 
-   error = sysfs_create_files(super_kobj, btrfs_attrs);
+   error = sysfs_create_files(fsid_kobj, btrfs_attrs);
if (error) {
btrfs_sysfs_rm_device_link(fs_devs, NULL);
return error;
}
 
-   error = sysfs_create_group(super_kobj,
+   error = sysfs_create_group(fsid_kobj,
   

[BUG] BTRFS: error in btrfs_run_delayed_refs:2821: errno=-5 IO failure

2015-07-08 Thread Chris Murphy
The short version: btrfs convert and subsequent balance will eat an
ext4 file system. I've reproduced this 6 for 6 times with both kernel
4.1 and 4.2rc1, but I get different back traces for the two kernels.

Kernel 4.1.0
Btrfs-progs 4.1

New ext4 file system populated with several thousand files (Fedora 22
installation) and a 1.5GB ISO.

Conversion succeeds with no user space or kernel errors. Btrfs check
comes up clean. Deletion of ext2_saved subvolume happens without
error, as does defragment. After this btrfs check is still clean. Then
major problems on btrfs balance and the file system is totally broken
afterward.


balance failure following ext4 to btrfs conversion, BTRFS: error in
btrfs_run_delayed_refs:2821: errno=-5 IO failure
https://bugzilla.kernel.org/show_bug.cgi?id=101191



-- 
Chris Murphy
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Error while balance after convert from ext4

2015-07-08 Thread Chris Murphy
I've reproduced this bug with a brand new ext4 system, converted with
btrfs-progs 4.1 and a 4.1 kernel. The conversion is OK. And btrfs
check is ok after conversion, after removing the ext2_saved snapshot,
and after defrag. The implosion happens on balance and the fs goes
read only.

https://bugzilla.kernel.org/show_bug.cgi?id=101191

I will double post this as a new thread, since I've found a different
bug with the identical procedure and 4.2rc1.

Chris Murphy
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Documentation: filesystems: btrfs: Fixed typos and whitespace

2015-07-08 Thread Daniel Grimshaw
I am a high school student trying to become familiar with Linux kernel 
development. The btrfs documentation in Documentation/filesystems had a few 
typos and errors in whitespace. This patch corrects both of these.

Signed-off-by: Daniel Grimshaw grims...@linux.vnet.ibm.com

---
diff --git a/Documentation/filesystems/btrfs.txt 
b/Documentation/filesystems/btrfs.txt
index d11cc2f..57d9d54 100644
--- a/Documentation/filesystems/btrfs.txt
+++ b/Documentation/filesystems/btrfs.txt
@@ -61,7 +61,7 @@ Options with (*) are default options and will not show in the 
mount options.
 
 check_int enables the integrity checker module, which examines all
 block write requests to ensure on-disk consistency, at a large
-memory and CPU cost. 
+memory and CPU cost.
 
 check_int_data includes extent data in the integrity checks, and
 implies the check_int option.
@@ -113,7 +113,7 @@ Options with (*) are default options and will not show in 
the mount options.
 Disable/enable debugging option to be more verbose in some ENOSPC 
conditions.
 
   fatal_errors=action
-Action to take when encountering a fatal error:
+Action to take when encountering a fatal error:
   bug - BUG() on a fatal error.  This is the default.
   panic - panic() on a fatal error.
 
@@ -132,10 +132,10 @@ Options with (*) are default options and will not show in 
the mount options.
 
   max_inline=bytes
 Specify the maximum amount of space, in bytes, that can be inlined in
-a metadata B-tree leaf.  The value is specified in bytes, optionally
+a metadata B-tree leaf.  The value is specified in bytes, optionally
 with a K, M, or G suffix, case insensitive.  In practice, this value
 is limited by the root sector size, with some space unavailable due
-to leaf headers.  For a 4k sectorsize, max inline data is ~3900 bytes.
+to leaf headers.  For a 4k sector size, max inline data is ~3900 bytes.
 
   metadata_ratio=value
 Specify that 1 metadata chunk should be allocated after every value
@@ -161,7 +161,7 @@ Options with (*) are default options and will not show in 
the mount options.
 
   datasum(*)
   nodatasum
-Enable/disable data checksumming for newly created files.
+Enable/disable data check-summing for newly created files.
 Datasum implies datacow.
 
   treelog(*)
@@ -170,7 +170,7 @@ Options with (*) are default options and will not show in 
the mount options.
 
   recovery
 Enable autorecovery attempts if a bad tree root is found at mount time.
-Currently this scans a list of several previous tree roots and tries to
+Currently this scans a list of several previous tree roots and tries to
 use the first readable.
 
   rescan_uuid_tree
@@ -194,7 +194,7 @@ Options with (*) are default options and will not show in 
the mount options.
   ssd_spread
 Options to control ssd allocation schemes.  By default, BTRFS will
 enable or disable ssd allocation heuristics depending on whether a
-rotational or nonrotational disk is in use.  The ssd and nossd options
+rotational or non-rotational disk is in use.  The ssd and nossd options
 can override this autodetection.
 
 The ssd_spread mount option attempts to allocate into big chunks
@@ -216,13 +216,13 @@ Options with (*) are default options and will not show in 
the mount options.
 This allows mounting of subvolumes which are not in the root of the mounted
 filesystem.
 You can use btrfs subvolume show  to see the object ID for a subvolume.
-   
+
   thread_pool=number
 The number of worker threads to allocate.  The default number is equal
 to the number of CPUs + 2, or 8, whichever is smaller.
 
   user_subvol_rm_allowed
-Allow subvolumes to be deleted by a non-root user. Use with caution.
+Allow subvolumes to be deleted by a non-root user. Use with caution.
 
 MAILING LIST
 

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] btrfs: Fix a lockdep warning when running xfstest.

2015-07-08 Thread Qu Wenruo



Liu Bo wrote on 2015/07/08 17:03 +0800:

On Thu, Oct 30, 2014 at 04:52:31PM +0800, Qu Wenruo wrote:

The following lockdep warning is triggered during xfstests:

[ 1702.980872] =
[ 1702.981181] [ INFO: possible irq lock inversion dependency detected ]
[ 1702.981482] 3.18.0-rc1 #27 Not tainted
[ 1702.981781] -
[ 1702.982095] kswapd0/77 just changed the state of lock:
[ 1702.982415]  (delayed_node-mutex){+.+.-.}, at: [a03b0b51] 
__btrfs_release_delayed_node+0x41/0x1f0 [btrfs]
[ 1702.982794] but this lock took another, RECLAIM_FS-unsafe lock in the past:
[ 1702.983160]  (fs_info-dev_replace.lock){+.+.+.}

and interrupts could create inverse lock ordering between them.

[ 1702.984675]
other info that might help us debug this:
[ 1702.985524] Chain exists of:
   delayed_node-mutex -- found-groups_sem -- fs_info-dev_replace.lock

[ 1702.986799]  Possible interrupt unsafe locking scenario:

[ 1702.987681]CPU0CPU1
[ 1702.988137]
[ 1702.988598]   lock(fs_info-dev_replace.lock);
[ 1702.989069]local_irq_disable();
[ 1702.989534]lock(delayed_node-mutex);
[ 1702.990038]lock(found-groups_sem);
[ 1702.990494]   Interrupt
[ 1702.990938] lock(delayed_node-mutex);
[ 1702.991407]
  *** DEADLOCK ***

It is because the btrfs_kobj_{add/rm}_device() will call memory
allocation with GFP_KERNEL,
which may flush fs page cache to free space, waiting for it self to do
the commit, causing the deadlock.


I've seen the same one recently, but I'm not sure I understand this
commig log correctly, do you mean that memory allocation forces kswapd
thread to deadlock?

Yes IIRC.


Can you elaborate upon this deadlock?


I'll check it later and try to explain, but the patch is somewhat old,
it may takes some time to recall.
But Miao Xie is the one behind the fix and may have a good explain.

Added his Cc.

Thanks,
Qu


Thanks,

-liubo


To solve the problem, move btrfs_kobj_{add/rm}_device() out of the
dev_replace lock range, also involing split the
btrfs_rm_dev_replace_srcdev() function into remove and free parts.

Now only btrfs_rm_dev_replace_remove_srcdev() is called in dev_replace
lock range, and kobj_{add/rm} and btrfs_rm_dev_replace_free_srcdev() are
called out of the lock range.

Signed-off-by: Qu Wenruo quwen...@cn.fujitsu.com
---
  fs/btrfs/dev-replace.c | 11 ++-
  fs/btrfs/volumes.c | 10 --
  fs/btrfs/volumes.h |  6 --
  3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index 6f662b3..6e3e885 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -571,15 +571,11 @@ static int btrfs_dev_replace_finishing(struct 
btrfs_fs_info *fs_info,
list_add(tgt_device-dev_alloc_list, fs_info-fs_devices-alloc_list);
fs_info-fs_devices-rw_devices++;

-   /* replace the sysfs entry */
-   btrfs_kobj_rm_device(fs_info, src_device);
-   btrfs_kobj_add_device(fs_info, tgt_device);
-
btrfs_dev_replace_unlock(dev_replace);

btrfs_rm_dev_replace_blocked(fs_info);

-   btrfs_rm_dev_replace_srcdev(fs_info, src_device);
+   btrfs_rm_dev_replace_remove_srcdev(fs_info, src_device);

btrfs_rm_dev_replace_unblocked(fs_info);

@@ -594,6 +590,11 @@ static int btrfs_dev_replace_finishing(struct 
btrfs_fs_info *fs_info,
mutex_unlock(root-fs_info-fs_devices-device_list_mutex);
mutex_unlock(uuid_mutex);

+   /* replace the sysfs entry */
+   btrfs_kobj_rm_device(fs_info, src_device);
+   btrfs_kobj_add_device(fs_info, tgt_device);
+   btrfs_rm_dev_replace_free_srcdev(fs_info, src_device);
+
/* write back the superblocks */
trans = btrfs_start_transaction(root, 0);
if (!IS_ERR(trans))
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index d47289c..0192051 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1800,8 +1800,8 @@ error_undo:
goto error_brelse;
  }

-void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info *fs_info,
-struct btrfs_device *srcdev)
+void btrfs_rm_dev_replace_remove_srcdev(struct btrfs_fs_info *fs_info,
+   struct btrfs_device *srcdev)
  {
struct btrfs_fs_devices *fs_devices;

@@ -1829,6 +1829,12 @@ void btrfs_rm_dev_replace_srcdev(struct btrfs_fs_info 
*fs_info,

if (srcdev-bdev)
fs_devices-open_devices--;
+}
+
+void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info,
+ struct btrfs_device *srcdev)
+{
+   struct btrfs_fs_devices *fs_devices = srcdev-fs_devices;

call_rcu(srcdev-rcu, free_device);

diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 08980fa..4cc00e6 

Re: Documentation: filesystems: btrfs: Fixed typos and whitespace

2015-07-08 Thread Jonathan Corbet
On Wed, 08 Jul 2015 08:22:20 -0700
Daniel Grimshaw grims...@linux.vnet.ibm.com wrote:

 I am a high school student trying to become familiar with Linux kernel
 development.

That's great!

 The btrfs documentation in Documentation/filesystems had a
 few typos and errors in whitespace. This patch corrects both of these.

So I went to apply this patch to the docs tree, but it fails to apply due
to whitespace problems of its own; something has corrupted your patch on
its way out to the mailing list.

Can I ask you to fix up your email client so that it doesn't do this?
Please have a look at Documentation/email-clients.txt for some hints; in
particular, there are things that can be done to bludgeon Thunderbird
(which you appear to be using) into a more cooperative state of mind.
Once you've done that, send the patch to yourself and try to apply the
result; after that works, please resubmit your patch here.

One comment, though: checksum (or checksumming) is pretty standard
usage and shouldn't really be fixed.

Thanks,

jon
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Documentation: filesystems: btrfs: Fixed typos and whitespace

2015-07-08 Thread Daniel Grimshaw
I am a high school student trying to become familiar with
Linux kernel development. The btrfs documentation in
Documentation/filesystems had a few typos and errors in
whitespace. This patch corrects both of these.

This is a resend of an earlier patch with corrected patchfile.

Signed-off-by: Daniel Grimshaw grims...@linux.vnet.ibm.com
---
 Documentation/filesystems/btrfs.txt |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Documentation/filesystems/btrfs.txt 
b/Documentation/filesystems/btrfs.txt
index d11cc2f..c772b47 100644
--- a/Documentation/filesystems/btrfs.txt
+++ b/Documentation/filesystems/btrfs.txt
@@ -61,7 +61,7 @@ Options with (*) are default options and will not show in the 
mount options.
 
check_int enables the integrity checker module, which examines all
block write requests to ensure on-disk consistency, at a large
-   memory and CPU cost.  
+   memory and CPU cost.
 
check_int_data includes extent data in the integrity checks, and
implies the check_int option.
@@ -113,7 +113,7 @@ Options with (*) are default options and will not show in 
the mount options.
Disable/enable debugging option to be more verbose in some ENOSPC 
conditions.
 
   fatal_errors=action
-   Action to take when encountering a fatal error: 
+   Action to take when encountering a fatal error:
  bug - BUG() on a fatal error.  This is the default.
  panic - panic() on a fatal error.
 
@@ -132,10 +132,10 @@ Options with (*) are default options and will not show in 
the mount options.
 
   max_inline=bytes
Specify the maximum amount of space, in bytes, that can be inlined in
-   a metadata B-tree leaf.  The value is specified in bytes, optionally 
+   a metadata B-tree leaf.  The value is specified in bytes, optionally
with a K, M, or G suffix, case insensitive.  In practice, this value
is limited by the root sector size, with some space unavailable due
-   to leaf headers.  For a 4k sectorsize, max inline data is ~3900 bytes.
+   to leaf headers.  For a 4k sector size, max inline data is ~3900 bytes.
 
   metadata_ratio=value
Specify that 1 metadata chunk should be allocated after every value
@@ -170,7 +170,7 @@ Options with (*) are default options and will not show in 
the mount options.
 
   recovery
Enable autorecovery attempts if a bad tree root is found at mount time.
-   Currently this scans a list of several previous tree roots and tries to 
+   Currently this scans a list of several previous tree roots and tries to
use the first readable.
 
   rescan_uuid_tree
@@ -194,7 +194,7 @@ Options with (*) are default options and will not show in 
the mount options.
   ssd_spread
Options to control ssd allocation schemes.  By default, BTRFS will
enable or disable ssd allocation heuristics depending on whether a
-   rotational or nonrotational disk is in use.  The ssd and nossd options
+   rotational or non-rotational disk is in use.  The ssd and nossd options
can override this autodetection.
 
The ssd_spread mount option attempts to allocate into big chunks
@@ -216,13 +216,13 @@ Options with (*) are default options and will not show in 
the mount options.
This allows mounting of subvolumes which are not in the root of the 
mounted
filesystem.
You can use btrfs subvolume show  to see the object ID for a 
subvolume.
-   
+
   thread_pool=number
The number of worker threads to allocate.  The default number is equal
to the number of CPUs + 2, or 8, whichever is smaller.
 
   user_subvol_rm_allowed
-   Allow subvolumes to be deleted by a non-root user. Use with caution. 
+   Allow subvolumes to be deleted by a non-root user. Use with caution.
 
 MAILING LIST
 
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] BTRFS: error in btrfs_run_delayed_refs:2821: errno=-5 IO failure

2015-07-08 Thread Николай Овчинников
Looks like my case.
I also have some files over 1Gb ans skip defrag before balance.


2015-07-08 23:02 GMT+03:00 Noah Massey noah.mas...@gmail.com:
 On Wed, Jul 8, 2015 at 10:01 AM, Chris Murphy li...@colorremedies.com wrote:
 The short version: btrfs convert and subsequent balance will eat an
 ext4 file system. I've reproduced this 6 for 6 times with both kernel
 4.1 and 4.2rc1, but I get different back traces for the two kernels.

 Kernel 4.1.0
 Btrfs-progs 4.1

 New ext4 file system populated with several thousand files (Fedora 22
 installation) and a 1.5GB ISO.


 Standard disclaimer: Not a developer, just a user.
 The 1.5 GB ISO on a fresh ext4 system made me think of
 http://thread.gmane.org/gmane.comp.file-systems.btrfs/36955
 (ext4 extents over 1 GB causing ENOSPC).

 Did the btrfs filesystem balance specify a -t 900G or similar?

 Or has that issue been fixed?
 --
 To unsubscribe from this list: send the line unsubscribe linux-btrfs in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: size 2.73TiB used 240.97GiB after balance

2015-07-08 Thread Donald Pearson
Basically I wouldn't trust the drive that's already showing signs of
failure to survive a dd.  It isn't completely full, so the recover is
less load.  That's just the way I see it.  But I see your point of
trying to get drive images now to hedge against failures.

Unfortunately those errors are over my head so hopefully someone else
has insights.

Also the posessive think's at the end of those outputs made me chuckle.



On Wed, Jul 8, 2015 at 4:29 PM, Hendrik Friedel hend...@friedels.name wrote:
 Hello Donald,

 thanks for your reply. I appreciate your help.

 I would use recover to get the data if at all possible, then you can

 experiment with try to fix the degraded condition live.  If you have
 any chance of getting data from the pool, you reduce that chance every
 time you make a change.


 Ok, you assume that btrfs recover is the most likely way of recovering data.
 But if mounting degraded, scrubbing, btrfsck, ... are more successful, your
 proposal is more risky, isn't it? With a dd-image I can always go back to
 todays status.

 If btrfs did the balance like you said, it wouldn't be raid5.  What
 you just described is raid4 where only one drive holds parity data.  I
 can't say that I actually know for a fact that btrfs doesn't do this,
 but I'd be shocked and some dev would need to eat their underware if
 the balance job didn't distribute the parity also.


 Ok, I was not aware of the difference between raid45.

 So, I did try a btrs-recover:
 warning devid 3 not found already
 Check tree block failed, want=8300102483968, have=65536
 Check tree block failed, want=8300102483968, have=65536
 Check tree block failed, want=8300102483968, have=65536
 read block failed check_tree_block
 Couldn't setup extent tree
 [it is still running]

 btrfs-find-root gives me:
 http://paste.ubuntu.com/11844005/
 http://paste.ubuntu.com/11844009/
 (on the two disks)


 btrfs-show-super:
 http://paste.ubuntu.com/11844016/

 Greetings,
 Hendrik





 ---
 Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
 https://www.avast.com/antivirus

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Error while balance after convert from ext4

2015-07-08 Thread Николай Овчинников
What about btrfsck and btrfs-image errors?

2015-07-08 16:56 GMT+03:00 Chris Murphy li...@colorremedies.com:
 I've reproduced this bug with a brand new ext4 system, converted with
 btrfs-progs 4.1 and a 4.1 kernel. The conversion is OK. And btrfs
 check is ok after conversion, after removing the ext2_saved snapshot,
 and after defrag. The implosion happens on balance and the fs goes
 read only.

 https://bugzilla.kernel.org/show_bug.cgi?id=101191

 I will double post this as a new thread, since I've found a different
 bug with the identical procedure and 4.2rc1.

 Chris Murphy
 --
 To unsubscribe from this list: send the line unsubscribe linux-btrfs in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] BTRFS: error in btrfs_run_delayed_refs:2821: errno=-5 IO failure

2015-07-08 Thread Noah Massey
On Wed, Jul 8, 2015 at 10:01 AM, Chris Murphy li...@colorremedies.com wrote:
 The short version: btrfs convert and subsequent balance will eat an
 ext4 file system. I've reproduced this 6 for 6 times with both kernel
 4.1 and 4.2rc1, but I get different back traces for the two kernels.

 Kernel 4.1.0
 Btrfs-progs 4.1

 New ext4 file system populated with several thousand files (Fedora 22
 installation) and a 1.5GB ISO.


Standard disclaimer: Not a developer, just a user.
The 1.5 GB ISO on a fresh ext4 system made me think of
http://thread.gmane.org/gmane.comp.file-systems.btrfs/36955
(ext4 extents over 1 GB causing ENOSPC).

Did the btrfs filesystem balance specify a -t 900G or similar?

Or has that issue been fixed?
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: size 2.73TiB used 240.97GiB after balance

2015-07-08 Thread Hendrik Friedel

Hello Donald,

thanks for your reply. I appreciate your help.

 I would use recover to get the data if at all possible, then you can

experiment with try to fix the degraded condition live.  If you have
any chance of getting data from the pool, you reduce that chance every
time you make a change.


Ok, you assume that btrfs recover is the most likely way of recovering 
data. But if mounting degraded, scrubbing, btrfsck, ... are more 
successful, your proposal is more risky, isn't it? With a dd-image I can 
always go back to todays status.



If btrfs did the balance like you said, it wouldn't be raid5.  What
you just described is raid4 where only one drive holds parity data.  I
can't say that I actually know for a fact that btrfs doesn't do this,
but I'd be shocked and some dev would need to eat their underware if
the balance job didn't distribute the parity also.


Ok, I was not aware of the difference between raid45.

So, I did try a btrs-recover:
warning devid 3 not found already
Check tree block failed, want=8300102483968, have=65536
Check tree block failed, want=8300102483968, have=65536
Check tree block failed, want=8300102483968, have=65536
read block failed check_tree_block
Couldn't setup extent tree
[it is still running]

btrfs-find-root gives me:
http://paste.ubuntu.com/11844005/
http://paste.ubuntu.com/11844009/
(on the two disks)


btrfs-show-super:
http://paste.ubuntu.com/11844016/

Greetings,
Hendrik




---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BUG] ext4 to btrfs convert, balance results in kernel BUG at fs/btrfs/extent-tree.c:8078!

2015-07-08 Thread Chris Murphy
This is similar to previously reported ext4-btrfs convert success,
but then failure on subsequent balance. But this is a different kernel
version and totally different call traces, so I've filed it with a
separate bug report and email thread.

Kernel 4.2.0rc1
Btrfs-progs 4.1

New ext4 file system populated with several thousand files (Fedora 22
installation) and a 1.5GB ISO.

Conversion succeeds with no user space or kernel errors. Btrfs check
comes up clean. Deletion of ext2_saved subvolume happens without
error, as does defragment. After this btrfs check is still clean. Then
major problems on btrfs balance with multiple back traces and the file
system is broken, with multiple call traces in sequence ending with
kernel BUG.


balance fail following successful ext4 to btrfs conversion, BUG at
fs/btrfs/extent-tree.c:8078!
https://bugzilla.kernel.org/show_bug.cgi?id=101181



-- 
Chris Murphy
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs partition converted from ext4 becomes read-only minutes after booting: WARNING: CPU: 2 PID: 2777 at ../fs/btrfs/super.c:260 __btrfs_abort_transaction+0x4b/0x120

2015-07-08 Thread Chris Murphy
On Thu, Jun 25, 2015 at 8:08 PM, Qu Wenruo quwen...@cn.fujitsu.com wrote:

 A quite code search leads me to inline extent.

 So, if you still have the original ext* image,
 would you please try revert to ext* and then convert it to btrfs again?

 But this time, please convert with --no-inline option, and see if this
 remove the problem.

Using -n at convert time does not make a difference for the
btrfs-convert bugs I've opened:
https://bugzilla.kernel.org/show_bug.cgi?id=101191
https://bugzilla.kernel.org/show_bug.cgi?id=101181
https://bugzilla.kernel.org/show_bug.cgi?id=101221
https://bugzilla.kernel.org/show_bug.cgi?id=101231

The last one I just discovered happens much sooner, is easier to
reproduce than the other two. It's a scrub right after a successful
btrfs-convert that btrfs check says is OK. But the scrub ends with two
separate oopses and multiple call traces and a spectacularly hard
kernic panic (ssh and even the console dies).

So I think btrfs-convert has a bug, but then the kernel code is not
gracefully handling it at all either and crashes badly with a scrub;
and less badly with balance. However, the file system is still OK
despite scrub crash. With balance failure, the file system is too
badly damaged and btrfs check and btrfs-image fail.



-- 
Chris Murphy
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[BUG] kernel BUG at fs/btrfs/scrub.c:1956!, when scrubbing freshly converted ext4

2015-07-08 Thread Chris Murphy
OK yet another btrfs-convert bug. This one is easier to reproduce than
the others, does not damage the file system (still mounts OK) but the
oops is a hard panic. ssh and even the virt-manager console dies
instantly, but virsh console captured a lot of call traces and are
attached to the bug report.

Happens with 4.1 and 4.2rc1 kernels. The convert was done with btrfs-progs 4.1.

The reproduce steps are easy:

1. ext4 with a bunch of files (Fedora 22 installation) plus a ~1.5GB ISO
2. btrfs-convert using defaults goes OK no error, btrfs check has no complaints
3. mount
4. btrfs scrub
hard panic

https://bugzilla.kernel.org/show_bug.cgi?id=101231


-- 
Chris Murphy
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


btrfs subvolume tree (btrfs-progs feature request)

2015-07-08 Thread james harvey
Request for new btrfs subvolume subcommand:

tree path
   Display a depth indented listing of subvolumes present in the
filesystem path.

---or---

list ... --tree ...
   ...
   -tree
  display subvolumes in a depth indented listing.

Would (I think):
* Display each top-level subvolume
* Recursively display each subvolume under its parent (using top level
ID against ID)

In the format:
/
├── a
│   ├── 1
├── b
│   ├── 1
│   └── 2
└── c
/other
└── d

The actual program tree does not work for this application.  It
shows all directories and files, not just the subvolumes.  It has a
-d option that only shows directories, which is better, but it still
shows directories that are not subvolumes.

btrfs subvolume list / can show 10 lines, with tree -d on a
freshly installed system can show over 240,000 lines.

I think it's more likely for btrfs-progs to be able to implement this,
than asking tree to make btrfs-specific code.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


btrfs subvolume clone or fork (btrfs-progs feature request)

2015-07-08 Thread james harvey
Request for new btrfs subvolume subcommand:

clone or fork [-i qgroupid] source [dest]name
   Create a subvolume name in dest, which is a clone or fork of source.
   If dest is not given, subvolume name will be created in the
current directory.
   Options
   -i qgroupid
  Add the newly created subvolume to a qgroup.  This option can be
given multiple times.

Would (I think):
* btrfs subvolume create dest-subvolume
* cp -ax --reflink=always source-subvolume/* dest-subvolume/


Particularly useful to avoid Invalid cross-device link when using cp
-ax, when source and dest are seen as different devices.

Such as if there is a top-level subvolume mounted as /, with others
mounted elsewhere.  Required workaround is to mount with subvolid=0 to
/mnt, cp -ax --reflink=always /mnt/...source /mnt/...dest
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


btrfs subvolume clone or fork (btrfs-progs feature request)

2015-07-08 Thread james harvey

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Error while balance after convert from ext4

2015-07-08 Thread Duncan
Николай Овчинников posted
on Wed, 08 Jul 2015 22:38:20 +0300 as excerpted:

[Rearranged to standard quote, reply-in-context, format.  It makes 
replying and following replies on mailing lists FAR easier.]

 2015-07-08 16:56 GMT+03:00 Chris Murphy li...@colorremedies.com:
 I've reproduced this bug with a brand new ext4 system, converted with
 btrfs-progs 4.1 and a 4.1 kernel. The conversion is OK. And btrfs check
 is ok after conversion, after removing the ext2_saved snapshot, and
 after defrag. The implosion happens on balance and the fs goes read
 only.

 What about btrfsck and btrfs-image errors?

C Murphy mentioned btrfs check (saying it was fine after conversion).  
Btrfsck is now the check subcommand under the primary btrfs tool, with 
the standalone btrfsck deprecated and to be removed after a few 
transition releases.

But he didn't cover btrfs-image.  Valid point/question there.

-- 
Duncan - List replies preferred.   No HTML msgs.
Every nonfree program has a lord, a master --
and if you use the program, he is your master.  Richard Stallman

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Error while balance after convert from ext4

2015-07-08 Thread Николай Овчинников
2015-07-09 2:32 GMT+03:00 Duncan 1i5t5.dun...@cox.net:
 Николай Овчинников posted
 on Wed, 08 Jul 2015 22:38:20 +0300 as excerpted:

 2015-07-08 16:56 GMT+03:00 Chris Murphy li...@colorremedies.com:
 I've reproduced this bug with a brand new ext4 system, converted with
 btrfs-progs 4.1 and a 4.1 kernel. The conversion is OK. And btrfs check
 is ok after conversion, after removing the ext2_saved snapshot, and
 after defrag. The implosion happens on balance and the fs goes read
 only.

 What about btrfsck and btrfs-image errors?

 C Murphy mentioned btrfs check (saying it was fine after conversion).
 Btrfsck is now the check subcommand under the primary btrfs tool, with
 the standalone btrfsck deprecated and to be removed after a few
 transition releases.

 But he didn't cover btrfs-image.  Valid point/question there.


btrfs check have same error

root@ovchin-eee:/home/ovchin/btrfs-progs# gdb ./btrfs
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as x86_64-linux-gnu.
Type show configuration for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type help.
Type apropos word to search for commands related to word...
Reading symbols from ./btrfs...done.
(gdb) run check /dev/sda7
Starting program: /home/ovchin/btrfs-progs/btrfs check /dev/sda7
[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1.
Checking filesystem on /dev/sda7
UUID: 489fb2ac-7f1a-46da-9fb8-964e483c8081
checking extents

Program received signal SIGABRT, Aborted.
0x76fc6107 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56  ../nptl/sysdeps/unix/sysv/linux/raise.c: Нет такого файла или каталога.
(gdb) bt
#0  0x76fc6107 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x76fc74e8 in __GI_abort () at abort.c:89
#2  0x0042cd25 in add_tree_backref
(extent_cache=0x7fffe530, bytenr=7707766784,
parent=0, root=4, found_ref=1) at cmds-check.c:4421
#3  0x004309a2 in add_root_to_pending (buf=0x6dcd00,
extent_cache=0x7fffe530,
pending=0x7fffe510, seen=0x7fffe520, nodes=0x7fffe4f0,
objectid=4)
at cmds-check.c:5961
#4  0x00434abb in deal_root_from_list (list=0x7fffe200,
root=0x6eaa10,
bits=0x6f1170, bits_nr=1024, pending=0x7fffe510, seen=0x7fffe520,
reada=0x7fffe500, nodes=0x7fffe4f0, extent_cache=0x7fffe530,
chunk_cache=0x7fffe590, dev_cache=0x7fffe5a0,
block_group_cache=0x7fffe570,
dev_extent_cache=0x7fffe540) at cmds-check.c:7803
#5  0x00434f95 in check_chunks_and_extents (root=0x6eaa10) at
cmds-check.c:7973
#6  0x004381a0 in cmd_check (argc=1, argv=0x7fffe810) at
cmds-check.c:9402
#7  0x00409dec in main (argc=2, argv=0x7fffe810) at btrfs.c:245
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Error while balance after convert from ext4

2015-07-08 Thread Chris Murphy
I've filed a bug for the btrfs check and btrfs-image crashing/failure
I'm getting. They may be unrelated but I filed them as one bug here.
https://bugzilla.kernel.org/show_bug.cgi?id=101221



Chris Murphy
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [BUG] BTRFS: error in btrfs_run_delayed_refs:2821: errno=-5 IO failure

2015-07-08 Thread Duncan
Noah Massey posted on Wed, 08 Jul 2015 16:02:04 -0400 as excerpted:

 Standard disclaimer: Not a developer, just a user.

Same here. =:^)

 The 1.5 GB ISO on a fresh ext4 system made me think of
 http://thread.gmane.org/gmane.comp.file-systems.btrfs/36955 (ext4
 extents over 1 GB causing ENOSPC).
 
 Did the btrfs filesystem balance specify a -t 900G or similar?
 
 Or has that issue been fixed?

Don't know about bug fixed, but that balance command syntax is definitely 
very deprecated, and there's no -t option documented for btrfs balance 
start, the current version.

Did you mean btrfs filesystem defrag?  It has a -t option that looks like 
it might have been what you were after.  However, until very recently (I 
think it's in integration but don't know if it's in an actual release 
yet), there was an integer overflow bug with the -t option, such that if 
given a value above 3G, (I believe the cutoff is actually 4G, so 
something like 3999M would work), it would behave as if -t0 had been 
given. =:^(  

But the effective high value is typically 1G anyway, so the workaround is 
simple enough, just use -t 1G or -t 2G.  That's what the patch 
effectively does anyway, reduce anything higher to 1G or 2G, IDR which.

So if you meant btrfs filesystem defrag -t, a 2G value would be 
preferable to a 900G value, with the latter very likely not working as 
intended.

-- 
Duncan - List replies preferred.   No HTML msgs.
Every nonfree program has a lord, a master --
and if you use the program, he is your master.  Richard Stallman

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Error while balance after convert from ext4

2015-07-08 Thread Chris Murphy
On Wed, Jul 8, 2015 at 1:38 PM, Николай Овчинников nik.ovc...@gmail.com wrote:
 What about btrfsck and btrfs-image errors?

btrfs check and btrfs-image both crash, which I consider as a separate
bug. And the crash doesn't produce useful info so I think it's a case
where I need to include either some gdb or valgrind info but I suck at
both and don't really know what to include in such a bug report.

The gist right now is that ext4 to btrfs conversion appears to be
broken, using defaults. I vaguely recall within the last, month (?), a
dev suggested using -n option to disable inlining of small files and
maybe that helped someone. I didn't test that.

-- 
Chris Murphy
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: size 2.73TiB used 240.97GiB after balance

2015-07-08 Thread Hendrik Friedel

Hello,

yes, I will check the cables, thanks for the hint.
Before trying to recover the data, I would like to save the status quo. 
I have two new drives? Is it advisable to dd-copy the data on the new 
drives and then to try to recover?


I am asking, because I suppose that dd will also copy the UUID, which 
might confuse BTRFS (two drives with same UUID attached)?


And then I have a technical question on btrfs balance when converting to 
raid5 (from raid1): does the balance create the parity information on 
the newly-added (empty) drive, so that the data on the two original 
disks is not touched at all?


Regards,
Hendrik


On 07.07.2015 15:14, Donald Pearson wrote:

That's what it looks like.  You may want to try reseating cables, etc.

Instead of mounting and file copy, btrfs restore might be worth a shot
to recover what you can.

On Tue, Jul 7, 2015 at 12:42 AM, Hendrik Friedel hend...@friedels.name wrote:

Hello,

while mounting works with the recovery option, the system locks after
reading.
dmesg shows:
[  684.258246] ata6.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[  684.258249] ata6.00: irq_stat 0x4001
[  684.258252] ata6.00: failed command: DATA SET MANAGEMENT
[  684.258255] ata6.00: cmd 06/01:01:00:00:00/00:00:00:00:00/a0 tag 26 dma
512 out
[  684.258255]  res 51/04:01:01:00:00/00:00:00:00:00/a0 Emask 0x1
(device error)
[  684.258256] ata6.00: status: { DRDY ERR }
[  684.258258] ata6.00: error: { ABRT }
[  684.258266] sd 5:0:0:0: [sdd] tag#26 FAILED Result: hostbyte=DID_OK
driverbyte=DRIVER_SENSE
[  684.258268] sd 5:0:0:0: [sdd] tag#26 Sense Key : Illegal Request
[current] [descriptor]
[  684.258270] sd 5:0:0:0: [sdd] tag#26 Add. Sense: Unaligned write command
[  684.258272] sd 5:0:0:0: [sdd] tag#26 CDB: Write same(16) 93 08 00 00 00
00 00 01 d3 80 00 00 00 80 00 00


So, also this drive is failing?!

Regards,
Hendrik


On 07.07.2015 00:59, Donald Pearson wrote:


Anything in dmesg?

On Mon, Jul 6, 2015 at 5:07 PM, hend...@friedels.name
hend...@friedels.name wrote:


Hallo,

It seems, that mounting works, but the System locks completely soon after
I
backing up.


Greetings,

Hendrik


-- Originalnachricht--

Von: Donald Pearson

Datum: Mo., 6. Juli 2015 23:49

An: Hendrik Friedel;

Cc: Omar Sandoval;Hugo Mills;Btrfs BTRFS;

Betreff:Re: size 2.73TiB used 240.97GiB after balance


If you can mount it RO, first thing to do is back up any data that
youcare
about.According to the bug that Omar posted you should not try a
devicereplace and you should not try a scrub with a missing device.You
may
be able to just do a device delete missing, then separately doa device
add
of a new drive, or rebalance back in to raid1.On Mon, Jul 6, 2015 at 4:12
PM, Hendrik Friedel  wrote: Hello, oh dear, I fear I am in trouble:
recovery-mounted, I tried to save some data, but the system hung. So I
re-booted and sdc is now physically disconnected. Label: none  uuid:
b4a6cce6-dc9c-4a13-80a4-ed6bc5b40bb8 Total devices 3 FS bytes
used
4.67TiB devid1 size 2.73TiB used 2.67TiB path /dev/sdc
devid2 size 2.73TiB used 2.67TiB path /dev/sdb *** Some
devices
missing I try to mount the rest again: mount -o recovery,ro /dev/sdb
/mnt/__Complete_Disk mount: wrong fs type, bad option, bad superblock on
/dev/sdb,missing codepage or helper program, or other error
In some cases useful info is found in syslog - trydmesg | tail
or
so root@homeserver:~# dmesg | tail [  447.059275] BTRFS info (device
sdc): enabling auto recovery [  447.059280] BTRFS info (device sdc):
disk
space caching is enabled [  447.086844] BTRFS: failed to read chunk tree
on
sdc [  447.110588] BTRFS: open_ctree failed [  474.496778] BTRFS info
(device sdc): enabling auto recovery [  474.496781] BTRFS info (device
sdc): disk space caching is enabled [  474.519005] BTRFS: failed to read
chunk tree on sdc [  474.540627] BTRFS: open_ctree failed mount -o
degraded,ro /dev/sdb /mnt/__Complete_Disk Does work now though. So,
how
can I remove the reference to the failed disk and check the data for
consistency (scrub I suppose, but is it safe?)? Regards, Hendrik
On
06.07.2015 22:52, Omar Sandoval wrote: On 07/06/2015 01:01 PM, Donald
Pearson wrote: Based on my experience Hugo's advice is critical,
get
the bad drive out of the pool when in raid56 and do not try to replace
or
delete it while it's still attached and recognized. If you add a
new device, mount degraded and rebalance.  If you don't, mount
degraded
then device delete missing. Watch out, replacing a missing device
in
RAID 5/6 currently doesn't work and will cause a kernel BUG(). See my
patch series here:
http://www.spinics.net/lists/linux-btrfs/msg44874.html -- Hendrik
Friedel Auf dem Brink 12 28844 Weyhe Tel. 04203 8394854 Mobil 0178
1874363 --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren
geprüft. https://www.avast.com/antivirus




--
Hendrik Friedel
Auf dem Brink 12
28844 Weyhe
Tel. 04203 8394854
Mobil 0178 1874363

---
Diese 

Re: size 2.73TiB used 240.97GiB after balance

2015-07-08 Thread Donald Pearson
I wouldn't use dd.

I would use recover to get the data if at all possible, then you can
experiment with try to fix the degraded condition live.  If you have
any chance of getting data from the pool, you reduce that chance every
time you make a change.

If btrfs did the balance like you said, it wouldn't be raid5.  What
you just described is raid4 where only one drive holds parity data.  I
can't say that I actually know for a fact that btrfs doesn't do this,
but I'd be shocked and some dev would need to eat their underware if
the balance job didn't distribute the parity also.

On Wed, Jul 8, 2015 at 1:56 PM, Hendrik Friedel hend...@friedels.name wrote:
 Hello,

 yes, I will check the cables, thanks for the hint.
 Before trying to recover the data, I would like to save the status quo. I
 have two new drives? Is it advisable to dd-copy the data on the new drives
 and then to try to recover?

 I am asking, because I suppose that dd will also copy the UUID, which might
 confuse BTRFS (two drives with same UUID attached)?

 And then I have a technical question on btrfs balance when converting to
 raid5 (from raid1): does the balance create the parity information on the
 newly-added (empty) drive, so that the data on the two original disks is not
 touched at all?

 Regards,
 Hendrik



 On 07.07.2015 15:14, Donald Pearson wrote:

 That's what it looks like.  You may want to try reseating cables, etc.

 Instead of mounting and file copy, btrfs restore might be worth a shot
 to recover what you can.

 On Tue, Jul 7, 2015 at 12:42 AM, Hendrik Friedel hend...@friedels.name
 wrote:

 Hello,

 while mounting works with the recovery option, the system locks after
 reading.
 dmesg shows:
 [  684.258246] ata6.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
 [  684.258249] ata6.00: irq_stat 0x4001
 [  684.258252] ata6.00: failed command: DATA SET MANAGEMENT
 [  684.258255] ata6.00: cmd 06/01:01:00:00:00/00:00:00:00:00/a0 tag 26
 dma
 512 out
 [  684.258255]  res 51/04:01:01:00:00/00:00:00:00:00/a0 Emask 0x1
 (device error)
 [  684.258256] ata6.00: status: { DRDY ERR }
 [  684.258258] ata6.00: error: { ABRT }
 [  684.258266] sd 5:0:0:0: [sdd] tag#26 FAILED Result: hostbyte=DID_OK
 driverbyte=DRIVER_SENSE
 [  684.258268] sd 5:0:0:0: [sdd] tag#26 Sense Key : Illegal Request
 [current] [descriptor]
 [  684.258270] sd 5:0:0:0: [sdd] tag#26 Add. Sense: Unaligned write
 command
 [  684.258272] sd 5:0:0:0: [sdd] tag#26 CDB: Write same(16) 93 08 00 00
 00
 00 00 01 d3 80 00 00 00 80 00 00


 So, also this drive is failing?!

 Regards,
 Hendrik


 On 07.07.2015 00:59, Donald Pearson wrote:


 Anything in dmesg?

 On Mon, Jul 6, 2015 at 5:07 PM, hend...@friedels.name
 hend...@friedels.name wrote:


 Hallo,

 It seems, that mounting works, but the System locks completely soon
 after
 I
 backing up.


 Greetings,

 Hendrik


 -- Originalnachricht--

 Von: Donald Pearson

 Datum: Mo., 6. Juli 2015 23:49

 An: Hendrik Friedel;

 Cc: Omar Sandoval;Hugo Mills;Btrfs BTRFS;

 Betreff:Re: size 2.73TiB used 240.97GiB after balance


 If you can mount it RO, first thing to do is back up any data that
 youcare
 about.According to the bug that Omar posted you should not try a
 devicereplace and you should not try a scrub with a missing device.You
 may
 be able to just do a device delete missing, then separately doa device
 add
 of a new drive, or rebalance back in to raid1.On Mon, Jul 6, 2015 at
 4:12
 PM, Hendrik Friedel  wrote: Hello, oh dear, I fear I am in trouble:
 recovery-mounted, I tried to save some data, but the system hung. So I
 re-booted and sdc is now physically disconnected. Label: none  uuid:
 b4a6cce6-dc9c-4a13-80a4-ed6bc5b40bb8 Total devices 3 FS bytes
 used
 4.67TiB devid1 size 2.73TiB used 2.67TiB path /dev/sdc
 devid2 size 2.73TiB used 2.67TiB path /dev/sdb *** Some
 devices
 missing I try to mount the rest again: mount -o recovery,ro /dev/sdb
 /mnt/__Complete_Disk mount: wrong fs type, bad option, bad superblock
 on
 /dev/sdb,missing codepage or helper program, or other error
 In some cases useful info is found in syslog - trydmesg | tail
 or
 so root@homeserver:~# dmesg | tail [  447.059275] BTRFS info (device
 sdc): enabling auto recovery [  447.059280] BTRFS info (device sdc):
 disk
 space caching is enabled [  447.086844] BTRFS: failed to read chunk
 tree
 on
 sdc [  447.110588] BTRFS: open_ctree failed [  474.496778] BTRFS info
 (device sdc): enabling auto recovery [  474.496781] BTRFS info (device
 sdc): disk space caching is enabled [  474.519005] BTRFS: failed to
 read
 chunk tree on sdc [  474.540627] BTRFS: open_ctree failed mount -o
 degraded,ro /dev/sdb /mnt/__Complete_Disk Does work now though. So,
 how
 can I remove the reference to the failed disk and check the data for
 consistency (scrub I suppose, but is it safe?)? Regards,
 Hendrik
 On
 06.07.2015 22:52, Omar Sandoval wrote: On 07/06/2015 01:01 PM,
 Donald
 Pearson wrote: Based on