Naohiro Aota | 30 Sep 16:40 2014
Picon

[PATCH] btrfs-progs: do not reclaim extent buffer

We should kill free_some_buffers() to stop reclaiming extent buffers or
we will hit a problem described below.

As of commit 53ee1bccf99cd5b474fe1aa857b7dd176e3a1407, we are not
counting a reference for tree->lru anymore. However free_some_buffers()
is still left and is reclaiming extent buffers whose  <at> refs == 1. This
cause extent buffers to be reclaimed unintentionally. Thus the following
steps could happen:

1. A buffer at address A is reclaimed by free_some_buffers()
   (address A is also free()ed)
2. Some code call alloc_extent_buffer()
3. Address A is assigned to newly allocated buffer
4. You see a buffer pointed by A suddenly changed its content

This problem is also pointed out here and it has a reproducer:
https://www.mail-archive.com/linux-btrfs <at> vger.kernel.org/msg36703.html

This commit drop free_some_buffers() and related variables, and also it
modify extent_io_tree_cleanup() to catch non-free'ed buffers properly.

Signed-off-by: Naohiro Aota <naota <at> elisp.net>
---
 extent_io.c | 37 +++----------------------------------
 1 file changed, 3 insertions(+), 34 deletions(-)

diff --git a/extent_io.c b/extent_io.c
index 1df377d..425af8a 100644
--- a/extent_io.c
+++ b/extent_io.c
(Continue reading)

Qu Wenruo | 30 Sep 10:52 2014

[PATCH] btrfs-progs: Check the csum tree node before go through the csum tree

[BUG]
Some fsfuzzed btrfs image will cause btrfsck segfault.

[REPRODUCER]
Run btrfsck on a csum tree block corrupted image.

[REASON]
check_csums() function call btrfs_search_slot() on csum_tree but doesn't
check whether the csum_tree contains a valid extent_buffer, which causes
the segfault.

[FIX]
Check the csum_root->node before any search.

Signed-off-by: Qu Wenruo <quwenruo <at> cn.fujitsu.com>
---
 cmds-check.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmds-check.c b/cmds-check.c
index 9471709..537376a 100644
--- a/cmds-check.c
+++ b/cmds-check.c
 <at>  <at>  -3905,6 +3905,10  <at>  <at>  static int check_csums(struct btrfs_root *root)
 	unsigned long leaf_offset;

 	root = root->fs_info->csum_root;
+	if (!extent_buffer_uptodate(root->node)) {
+		fprintf(stderr, "No valid csum tree found\n");
+		return -ENOENT;
(Continue reading)

Qu Wenruo | 30 Sep 04:39 2014

[PATCH] btrfs-progs: Don't return any fs_info that contain NULL tree_root or fs_root.

[BUG]
btrfsck will segfault if it fails to open the fs tree or tree root.

[REPRODUCER]
Execute btrfsck on a highly damaged btrfs image.
fsfuzz can be used to make a junk btrfs image.

[REASON]
Current open_ctree() in btrfs-progs support OPEN_CTREE_PARTIAL flag to
allow return fs_info even some of the trees is missing.

However it is too loose and even allows fs_info containing no tree to be
returned.

And when it happens, fs_info->fs_root is NULL,
close_ctree(fs_info->fs_root) will cause the access to NULL pointer and
segfault.

[FIX]
This patch will add checks for fs_info->tree_root and fs_info->fs_root
before return fs_info.

Signed-off-by: Qu Wenruo <quwenruo <at> cn.fujitsu.com>
---
 disk-io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/disk-io.c b/disk-io.c
index 26a532e..21a3083 100644
--- a/disk-io.c
(Continue reading)

Josef Bacik | 29 Sep 18:39 2014

[PATCH] btrfs-progs: add root to dirty list when fixing bad keys

A user reported a WARN_ON() when trying to run btrfsck --repair on his fs with
bad key ordering.  This was because the root that was broken wasn't part of the
transaction yet.  We do this open coded thing in a few other places in fsck, so
just make it a helper function and make sure all the places that need to call it
do call it.  With this patch he was able to run repair without it dying.
Thanks,

Signed-off-by: Josef Bacik <jbacik <at> fb.com>
---
 cmds-check.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index d479361..4c01330 100644
--- a/cmds-check.c
+++ b/cmds-check.c
 <at>  <at>  -243,6 +243,17  <at>  <at>  struct bad_item {

 static void reset_cached_block_groups(struct btrfs_fs_info *fs_info);

+static void record_root_in_trans(struct btrfs_trans_handle *trans,
+				 struct btrfs_root *root)
+{
+	if (root->last_trans != trans->transid) {
+		root->track_dirty = 1;
+		root->last_trans = trans->transid;
+		root->commit_root = root->node;
+		extent_buffer_get(root->node);
+	}
+}
(Continue reading)

Anand Jain | 29 Sep 07:09 2014
Picon

[PATCH RFC] btrfs: introduce procfs interface for the device list

From: Anand Jain <Anand.Jain <at> oracle.com>

(added RFC prefix to the patch header)
(as of now just an experimental interface)

This patch introduces profs interface /proc/fs/btrfs/devlist,
which as of now exports all the members of kernel fs_devices.

The current /sys/fs/btrfs interface works when the fs is
mounted, and is on the file directory hierarchy and also has
the sysfs limitation max output of U64 per file.

Here btrfs procfs uses seq_file to export all the members of
fs_devices. Also shows the contents when device is not mounted,
but have registered with btrfs kernel (useful as an alternative
to buggy ready ioctl)

An attempt is made to follow the some standard file format
output such as ini. So that a simple warper python script will
provide end user useful interfaces.

Further planning to add few more members to the interface such as
group profile info. The long term idea is to make procfs
interface a onestop btrfs application interface for the device and
fs info from the kernel, where a simple python script can make
use of it.

Signed-off-by: Anand Jain <anand.jain <at> oracle.com>
---
 fs/btrfs/Makefile  |  2 +-
(Continue reading)

Anand Jain | 29 Sep 07:03 2014
Picon

[PATCH] btrfs: introduce procfs interface for the device list

(as of now just an experimental interface)

This patch introduces profs interface /proc/fs/btrfs/devlist,
which as of now exports all the members of kernel fs_devices.

The current /sys/fs/btrfs interface works when the fs is
mounted, and is on the file directory hierarchy and also has
the sysfs limitation max output of U64 per file.

Here btrfs procfs uses seq_file to export all the members of
fs_devices. Also shows the contents when device is not mounted,
but have registered with btrfs kernel (useful as an alternative
to buggy ready ioctl)

An attempt is made to follow the some standard file format
output such as ini. So that a simple warper python script will
provide end user useful interfaces.

Further planning to add few more members to the interface such as
group profile info. The long term idea is to make procfs
interface a onestop btrfs application interface for the device and
fs info from the kernel, where a simple python script can make
use of it.

Signed-off-by: Anand Jain <anand.jain <at> oracle.com>
---
 fs/btrfs/Makefile  |  2 +-
 fs/btrfs/ctree.h   |  4 +++
 fs/btrfs/procfs.c  | 45 ++++++++++++++++++++++++++
 fs/btrfs/super.c   |  4 +++
(Continue reading)

Tomasz Chmielewski | 29 Sep 14:00 2014

3.17.0-rc6 system freeze

System froze under 3.17.0-rc6 with btrfs. It had to be hard rebooted.

Sep 29 05:50:21 bkp010 kernel: [559018.459704] NMI watchdog: BUG: soft 
lockup - CPU#6 stuck for 22s! [kworker/u16:24:16872]
Sep 29 05:50:21 bkp010 kernel: [559018.459705] NMI watchdog: BUG: soft 
lockup - CPU#2 stuck for 22s! [kworker/u16:8:17271]
Sep 29 05:50:21 bkp010 kernel: [559018.459707] NMI watchdog: BUG: soft 
lockup - CPU#0 stuck for 22s! [kworker/u16:11:17272]
Sep 29 05:50:21 bkp010 kernel: [559018.459709] Modules linked in:
Sep 29 05:50:21 bkp010 kernel: [559018.459710] Modules linked in:
Sep 29 05:50:21 bkp010 kernel: [559018.459711]  ipt_MASQUERADE
Sep 29 05:50:21 bkp010 kernel: [559018.459711]  ipt_MASQUERADE
Sep 29 05:50:21 bkp010 kernel: [559018.459712]  iptable_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459712]  iptable_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459713]  nf_conntrack_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459713]  nf_conntrack_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_defrag_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_defrag_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459714]  nf_nat_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459715]  nf_nat_ipv4
Sep 29 05:50:21 bkp010 kernel: [559018.459715]  nf_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459716]  nf_nat
Sep 29 05:50:21 bkp010 kernel: [559018.459716]  nf_conntrack
Sep 29 05:50:21 bkp010 kernel: [559018.459717]  nf_conntrack
Sep 29 05:50:21 bkp010 kernel: [559018.459717]  ip_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459718]  ip_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459718]  x_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459719]  x_tables
Sep 29 05:50:21 bkp010 kernel: [559018.459719]  cpufreq_ondemand
Sep 29 05:50:21 bkp010 kernel: [559018.459720]  cpufreq_ondemand
(Continue reading)

roy.qing.li | 29 Sep 11:34 2014
Picon

[PATCH][v2] btrfs: fix a overflowing boundary writing in csum_tree_block

From: Li RongQing <roy.qing.li <at> gmail.com>

It is impossible that csum_size is larger than sizeof(long), but the codes
still add the handler for this condition, like allocate new memory, for
extension. If it becomes true someday, copying csum_size size memory to local
32bit variable found and val will overflow these two variables.

Fix it by returning the max 4 byte checksum, and print the csum_size

Signed-off-by: Li RongQing <roy.qing.li <at> gmail.com>
---
 fs/btrfs/disk-io.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index a1d36e6..d9b52ac 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
 <at>  <at>  -295,14 +295,17  <at>  <at>  static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,
 		if (memcmp_extent_buffer(buf, result, 0, csum_size)) {
 			u32 val;
 			u32 found = 0;
+
+			csum_size = min_t(u16, csum_size, sizeof(u32));
 			memcpy(&found, result, csum_size);

 			read_extent_buffer(buf, &val, 0, csum_size);
 			printk_ratelimited(KERN_INFO
 				"BTRFS: %s checksum verify failed on %llu wanted %X found %X "
-				"level %d\n",
(Continue reading)

Daniel Holth | 29 Sep 03:11 2014
Picon

bad areas cause btrfs segfault

I've got a couple of directories that cause a btrfs segfault. First
one happened at the end of July and I just renamed it to get it out of
my way (can't delete it without crashing); the second one just
happened and I'll be discarding the filesystem.

This "crash when touched" behavior is frustrating because it makes it
iffy to back up everything else. Usually about the second attempt to
touch the bad directory requires a reboot.

Instead, I would prefer that the filesystem not crash the whole system
when it encounters a corrupted area.

I've tried "btrfs scrub" and "btrfs check" but they don't find
anything wrong. I guess the next step would be "btrfs restore", but I
think I have a good enough backup made with a normal copy skipping the
two corrupted directories.

Here's my info.

$   uname -a
Linux cardamom 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC
2014 x86_64 x86_64 x86_64 GNU/Linux

$   btrfs --version
Btrfs v3.12

$   btrfs fi show
Btrfs v3.12

$   btrfs fi df /home # Replace /home with the mount point of your
(Continue reading)

nick | 28 Sep 03:47 2014
Picon

Help Out

Hello Fellow Developers,
I am wondering where I can start helping out with the btrfs code base and user space tools.
If someone has any ideas that would be very helpful as I would like to help but don't known
where to get started.
Regards Nick 
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Marc MERLIN | 27 Sep 22:19 2014

3.16.3 btrfs receive dies with rename o4736059-335172-0 -> merlin/RC/OSD failed. Directory not empty machine

Hi Filipe and others,

After I moved directories around, and since then my hourly 
btrfs backup is failing.

Does this output help?

Is there a patch you'd like me to try, or should I just work around the
problem by deleting all these directories and recreating in 2 steps to
get around the bug?

Thanks,
Marc

grep OSD in btrfs receive -v -v -v output gives:
truncate merlin/RC/OSD/old/config.xml size=109
utimes merlin/RC/OSD/old/config.xml
utimes merlin/RC/OSD
truncate merlin/RC/OSD/config.xml size=274
utimes merlin/RC/OSD/config.xml
link o4736027-335149-0/octocopter1.osd -> merlin/RC/OSD/octocopter1.osd
unlink merlin/RC/OSD/octocopter1.osd
utimes merlin/RC/OSD
rename o4736027-335149-0 -> o4736059-335172-0/OSD-Copter 789
chown o4736059-335172-0/OSD-Copter 789 - uid=500, gid=500
chmod o4736059-335172-0/OSD-Copter 789 - mode=0755
utimes o4736059-335172-0/OSD-Copter 789
rename o4736031-335150-0 -> o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg
utimes o4736059-335172-0/OSD-Copter 789
truncate o4736059-335172-0/OSD-Copter 789/ArduCam_logo.jpg size=18721
(Continue reading)


Gmane