[PATCH] btrfs-progs: Fix partitioned loop devices resolve.

2015-11-09 Thread Florian Margaine
When using partitions on a loop device, the device's name can be e.g. /dev/loop0p1 or similar, and no relevant entry exists in the /sys filesystem, so the current resolve_loop_device function fails. Instead of using string functions to extract the device name and reading this file, this patch

[PATCH] Btrfs: fix race leading to incorrect item deletion when dropping extents

2015-11-09 Thread fdmanana
From: Filipe Manana While running a stress test I got the following warning triggered: [191627.672810] [ cut here ] [191627.673949] WARNING: CPU: 8 PID: 8447 at fs/btrfs/file.c:779 __btrfs_drop_extents+0x391/0xa50 [btrfs]() (...)

[PATCH] Btrfs: fix race leading to BUG_ON when running delalloc for nodatacow

2015-11-09 Thread fdmanana
From: Filipe Manana If we are using the NO_HOLES feature, we have a tiny time window when running delalloc for a nodatacow inode where we can race with a concurrent link or xattr add operation leading to a BUG_ON. This happens because at run_delalloc_nocow() we end up casting

Re: [PATCH 00/15] btrfs: Hot spare and Auto replace

2015-11-09 Thread Austin S Hemmelgarn
On 2015-11-09 05:56, Anand Jain wrote: These set of patches provides btrfs hot spare and auto replace support for you review and comments. It's absolutely awesome to see that someone picked up this project, it's something that's very useful and helps BTRFS to compete with many established

Re: Btrfs progs pre-release 4.3-rc1

2015-11-09 Thread Austin S Hemmelgarn
On 2015-11-07 08:58, Chris Murphy wrote: On Mon, Nov 2, 2015 at 4:14 PM, David Sterba wrote: Hi, the kernel 4.3 was released yesterday, the btrfs-progs will follow at the end of this week. I've tagged an rc1 from current devel branch. There are a lots of small invisible

Re: [PATCH] btrfs-progs: Fix partitioned loop devices resolve.

2015-11-09 Thread Karel Zak
On Mon, Nov 09, 2015 at 02:06:26PM +0100, Florian Margaine wrote: > Instead of using string functions to extract the device name and reading > this file, this patch uses the loop device API through ioctl to get the > correct backing file. #define LO_NAME_SIZE64 struct loop_info64 {

Re: Process is blocked for more than 120 seconds

2015-11-09 Thread Austin S Hemmelgarn
On 2015-11-07 07:22, Dmitry Katsubo wrote: Hi everyone, I have noticed the following in the log. The system continues to run, but I am not sure for how long it will be stable. Should I start worrying? Thanks in advance for the opinion. This just means that a process was stuck in the D state

Re: mkfs.btrfs doesn't detect SSD

2015-11-09 Thread Austin S Hemmelgarn
On 2015-11-07 10:30, Christoph Anton Mitterer wrote: Hmm in fact it seems to be the kernel who wrongly, detects the type: /sys/block/sdb/queue/rotational = 1 or more like the USB/SATA bridge simply reports it wrong. Anyway, is there a way to override? Or will setting

Re: btrfs-progs send | receive error: no such file or directory

2015-11-09 Thread Austin S Hemmelgarn
On 2015-11-08 16:28, Glen H wrote: Hi, I really enjoy the features of btrfs but send|receive is failing me so my backups are not working. I'm using "btrbk" to backup my drives (all local) and one of the three subvolumes errors out. When I run this command from the terminal it errors out:

Re: [PATCH] btrfs-progs: Fix partitioned loop devices resolve.

2015-11-09 Thread Florian Margaine
On 11/09/2015 03:12 PM, Karel Zak wrote: > On Mon, Nov 09, 2015 at 02:06:26PM +0100, Florian Margaine wrote: >> Instead of using string functions to extract the device name and reading >> this file, this patch uses the loop device API through ioctl to get the >> correct backing file. > >

Re: [PATCH 00/15] btrfs: Hot spare and Auto replace

2015-11-09 Thread Duncan
Austin S Hemmelgarn posted on Mon, 09 Nov 2015 09:09:07 -0500 as excerpted: >> btrfs fi show >> Label: none uuid: 52f170c1-725c-457d-8cfd-d57090460091 >>Total devices 2 FS bytes used 112.00KiB >>devid1 size 2.00GiB used 417.50MiB path /dev/sdc >>devid2 size 2.00GiB used

Re: btrfs-progs send | receive error: no such file or directory

2015-11-09 Thread Glen H
On Mon, Nov 9, 2015 at 8:50 AM, Austin S Hemmelgarn wrote: > On 2015-11-08 16:28, Glen H wrote: >> >> Hi, >> >> I really enjoy the features of btrfs but send|receive is failing me so >> my backups are not working. I'm using "btrbk" to backup my drives >> (all local) and one

Re: [RFCv3 00/12] xfstests: test the btrfs/xfs reflink/dedupe ioctls

2015-11-09 Thread Darrick J. Wong
On Sun, Nov 08, 2015 at 11:59:26PM -0800, Christoph Hellwig wrote: > On Tue, Oct 06, 2015 at 10:12:57PM -0700, Darrick J. Wong wrote: > > * I don't have any interesting NFS/CIFS setups for test. :( > > I have a banrch with client and server support for NFSv4.2 CLONE > support: > >

Re: overflow in inode.c, file.c

2015-11-09 Thread David Sterba
Hi, thanks for the report (and the reports on the forums), On Thu, Oct 22, 2015 at 01:36:46AM +0200, Victor wrote: > Hello, while using linux-⁠4.2.3 (btrfs-⁠progs v4.2.2) with the latest > grsec patch to date, a feature in the grsec patchset, an overflow > checker (made by emese) seems to have

[PATCH] Btrfs: fix race when listing an inode's xattrs

2015-11-09 Thread fdmanana
From: Filipe Manana When listing a inode's xattrs we have a time window where we race against a concurrent operation for adding a new hard link for our inode that makes us not return any xattr to user space. In order for this to happen, the first xattr of our inode needs to be

[PATCH] btrfs: properly set the termination value of ctx->pos in readdir

2015-11-09 Thread David Sterba
The value of ctx->pos in the last readdir call is supposed to be set to INT_MAX due to 32bit compatibility, unless 'pos' is intentially set to a larger value, then it's LLONG_MAX. There's a report from PaX SIZE_OVERFLOW plugin that "ctx->pos++" overflows

Re: Reproducible corruption issue in stable, with possible patch unmerged?

2015-11-09 Thread dcg
Saturday 07 November 2015 15:17:27 Chris Mason escribió: > > error output. The patch doesn't seem to have been merged: > Good catch. Can you describe your configuration? pool of 3 spinning disks, configured with raid0 for data and raid1 for metadata Total devices 3 FS bytes used 749.78GiB

Ideas for btrfs-convert fix(or rework)

2015-11-09 Thread Qu Wenruo
Hi all, Someone may already knows, I'm recently trying to fix(or rework) the old btrfs-convert, to allow it to support separate data and meta chunks. [[FIX IDEA]] The overall idea is quite simple and straight forward: Separate meta/sys chunk at very *beginning*, then insert data chunks to

Re: [PATCH v5 8/9] vfs: Add vfs_copy_file_range() support for pagecache copies

2015-11-09 Thread Darrick J. Wong
On Tue, Oct 13, 2015 at 12:27:37AM -0700, Christoph Hellwig wrote: > On Mon, Oct 12, 2015 at 04:17:49PM -0700, Darrick J. Wong wrote: > > Hm. Peng's patches only generalize the CLONE and CLONE_RANGE ioctls from > > btrfs, however they don't port over the (vastly different) EXTENT_SAME > > ioctl.

Re: Ideas for btrfs-convert fix(or rework)

2015-11-09 Thread Roman Mamedov
On Tue, 10 Nov 2015 14:27:41 +0800 Qu Wenruo wrote: > But without such work, btrfs-convert will always be a mess and no > real support for balance. I wonder, what happened to the current btrfs-convert? Perhaps a couple of years ago I converted a 7TB and ~70%

[PATCH 11/15] btrfs: add check not to mount a spare device

2015-11-09 Thread Anand Jain
Spare devices can be scanned but shouldn't be mountable. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 8 1 file changed, 8 insertions(+) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 38e0385..3662c0a 100644 --- a/fs/btrfs/disk-io.c +++

[PATCH 14/15] btrfs: introduce helper functions to perform hot replace

2015-11-09 Thread Anand Jain
Hot replace / auto replace is important volume manager feature and is critical to the data center operations, so that the degraded volume can be brought back to a healthy state at the earliest and without manual intervention. This modifies the existing replace code to suite the need of auto

[PATCH 00/15] btrfs: Hot spare and Auto replace

2015-11-09 Thread Anand Jain
These set of patches provides btrfs hot spare and auto replace support for you review and comments. First, here below are the simple example steps to configure the same: Add a spare device: btrfs spare add /dev/sde -f OR if there is a spare device which is already added before the, just run

[PATCH 04/15] btrfs: Allow barrier_all_devices to do per-chunk device check

2015-11-09 Thread Anand Jain
From: Qu Wenruo The last user of num_tolerated_disk_barrier_failures is barrier_all_devices(). But it's can be easily changed to new per-chunk degradable check framework. Now btrfs_device will have two extra members, representing send/wait error, set at

[PATCH 06/15] btrfs: Cleanup num_tolerated_disk_barrier_failures

2015-11-09 Thread Anand Jain
From: Qu Wenruo As we use per-chunk degradable check, now the global num_tolerated_disk_barrier_failures is of no use. So cleanup it. Signed-off-by: Qu Wenruo [Btrfs: resolve conflict to apply 'btrfs: Cleanup

[PATCH 13/15] btrfs: provide framework to get and put a spare device

2015-11-09 Thread Anand Jain
This adds functions to get and put a spare device from the list. So that hot repace code can pick a spare device when needed. Signed-off-by: Anand Jain --- fs/btrfs/super.c | 9 + fs/btrfs/volumes.c | 37 + fs/btrfs/volumes.h

[PATCH 10/15] btrfs: introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV

2015-11-09 Thread Anand Jain
Add BTRFS_FEATURE_INCOMPAT_SPARE_DEV (400) flag to identify a spare device. Along with this it checks in the mount context that a spare device will fail to mount. As spare devices aren't mountable. Signed-off-by: Anand Jain --- fs/btrfs/ctree.h | 4 +++- 1 file changed,

[PATCH 09/15] btrfs: block incompatible optional features at scan

2015-11-09 Thread Anand Jain
For the matter of completeness we need to check if the device being scanned has features that are known to the kernel. As of now if it doesn't - the mount will fails, then what is the point in having those devices added to the btrfs_fs_devices list at device_list_add(). So block those devices at

[PATCH 07/15] btrfs: introduce device dynamic state transition to offline or failed

2015-11-09 Thread Anand Jain
Need device forced offline/failed feature for the following reasons, 1) a. it can be reported that device has failed when it does b. close the device when it goes offline so that blocklayer can cleanup 2) identify the candidate for the auto replace 3) avoid further commit error reported

[PATCH 08/15] btrfs: check device for critical errors and mark failed

2015-11-09 Thread Anand Jain
Write and Flush errors are considered as critical errors, upon which the device will be brought offline and marked as failed. Write and Flush errors are identified using device error statistics. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 43

[PATCH 05/15] btrfs: optimize btrfs_check_degradable() for calls outside of barrier

2015-11-09 Thread Anand Jain
Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 8 +++- fs/btrfs/volumes.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 958c2a6..d3303f9 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c

[PATCH 03/15] btrfs: Do per-chunk degraded check for remount

2015-11-09 Thread Anand Jain
From: Qu Wenruo Just the same for mount time check, use new btrfs_check_degraded() to do per chunk check. Signed-off-by: Qu Wenruo Btrfs: use btrfs_error instead of btrfs_err during remount Signed-off-by: Anand Jain

[PATCH 12/15] btrfs: support btrfs dev scan for spare device

2015-11-09 Thread Anand Jain
When the user or system calls the BTRFS_IOC_SCAN_DEV, ioctl this patch will make sure it is added to the device list and set it as spare. This operation will be same when BTRFS_IOC_DEVICES_READY as well since BTRFS_IOC_DEVICES_READY ioctl has been doing that by legacy. Signed-off-by: Anand Jain

[PATCH 02/15] btrfs: Do per-chunk check for mount time check

2015-11-09 Thread Anand Jain
From: Qu Wenruo Now use the btrfs_check_degraded() to do mount time degraded check. With this patch, now we can mount with the following case: # mkfs.btrfs -f -m raid1 -d single /dev/sdb /dev/sdc # wipefs -a /dev/sdc # mount /dev/sdb /mnt/btrfs -o degraded As the

[PATCH 15/15] btrfs: check for failed device and hot replace

2015-11-09 Thread Anand Jain
This patch creates casualty_kthread to check for the failed devices, and triggers device replace. Signed-off-by: Anand Jain --- fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c | 67 ++ fs/btrfs/transaction.c | 3 ++-

[PATCH 01/15] btrfs: Introduce a new function to check if all chunks a OK for degraded mount

2015-11-09 Thread Anand Jain
From: Qu Wenruo Introduce a new function, btrfs_check_degradable(), to judge if all chunks in btrfs is OK for degraded mount. It provides the new basis for accurate btrfs mount/remount and even runtime degraded mount check other than old one-size-fit-all method.

[PATCH 2/4] btrfs-progs: Introduce btrfs spare subcommand

2015-11-09 Thread Anand Jain
Signed-off-by: Anand Jain --- Android.mk | 2 +- Makefile.in | 2 +- btrfs.c | 1 + cmds-spare.c | 291 +++ commands.h | 2 + 5 files changed, 296 insertions(+), 2 deletions(-) create mode 100644

[PATCH 0/4] btrfs-progs: Hot spare and Auto replace

2015-11-09 Thread Anand Jain
Depends on the kernel patch set [PATCH 00/15] btrfs: Hot spare and Auto replace This is btrfs-progs side of the patch set. Anand Jain (4): btrfs-progs: Introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV SB flags btrfs-progs: Introduce btrfs spare subcommand btrfs-progs: add fi show for spare

[PATCH 4/4] btrfs-progs: add global spare device list to filesystem show

2015-11-09 Thread Anand Jain
This patch will add list of spare devices to the filesystem show output, as show in the example below. btrfs fi show Label: none uuid: 17f7d403-17d7-4f0a-b8ba-de673fdd3f56 Total devices 2 FS bytes used 15.88MiB devid1 size 2.00GiB used 417.50MiB path /dev/sdc devid

[PATCH 1/4] btrfs-progs: Introduce BTRFS_FEATURE_INCOMPAT_SPARE_DEV SB flags

2015-11-09 Thread Anand Jain
Signed-off-by: Anand Jain --- btrfs-show-super.c | 3 ++- ctree.h| 4 +++- volumes.c | 4 volumes.h | 2 ++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/btrfs-show-super.c b/btrfs-show-super.c index 27414c8..d9626cd

[PATCH 3/4] btrfs-progs: add fi show for spare

2015-11-09 Thread Anand Jain
Signed-off-by: Anand Jain --- cmds-filesystem.c | 4 1 file changed, 4 insertions(+) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 4d3a9a4..11d0406 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -353,6 +353,9 @@ static void print_one_uuid(struct

Re: strange "No space left on device"

2015-11-09 Thread Filipe Manana
On Sat, Nov 7, 2015 at 11:22 PM, Christoph Anton Mitterer wrote: > Hey. > > I just repeatedly did the following twice on a ~8GB USB stick, under > Debian sid (ergo kernel 4.2.0-1-amd64, btrfsprogs 4.2.2-1). > > First, created some GPT on the stick: > Number Start (sector)

[GIT PULL] Fujitsu for 4.4

2015-11-09 Thread Zhao Lei
Hi Chris, This is collection of some bug fix and cleanup from fujitsu against btrfs in v4.3, the main patch is these 2: Fix lost-data-profile caused by auto removing bg Fix lost-data-profile caused by balance bg It can solve the problem of 'lost all data profile by balance and

Re: [PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message

2015-11-09 Thread Anand Jain
Hi Zhao, Hope you could do this/apply on top of patch set "Introduce device delete by devid" I vaguely remember that patchset as well did some cleanups in this part of the code. Thanks, Anand On 11/09/2015 05:59 PM, Zhao Lei wrote: Switch to common warning()/error() for cmds-device.c.

[PATCH] btrfs: fix signed overflows in btrfs_sync_file

2015-11-09 Thread David Sterba
The calculation of range length in btrfs_sync_file leads to signed overflow. This was caught by PaX gcc SIZE_OVERFLOW plugin. https://forums.grsecurity.net/viewtopic.php?f=1=4284 The fsync call passes 0 and LLONG_MAX, the range length does not fit to loff_t and overflows, but the value is

Re: [PATCH v8 4/4] vfs: Add vfs_copy_file_range() support for pagecache copies

2015-11-09 Thread Al Viro
On Fri, Nov 06, 2015 at 04:18:20PM -0500, Anna Schumaker wrote: > I moved the rw_verify_area() calls into the fallback code since some > filesystems can handle reflinking a large range. Take a look at rw_verify_area() - it does a lot more than "trim down to 2Gb" - starting with "deal with

[PATCH 3/3] btrfs-progs: Remove noused path argument in _cmd_device_usage

2015-11-09 Thread Zhao Lei
Argument of char *path in _cmd_device_usage() is not necessary, remove it. Signed-off-by: Zhao Lei --- cmds-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index 739405b..190bed6 100644 --- a/cmds-device.c

[PATCH 1/3] btrfs-progs: cmds-device: use warning/error for error message

2015-11-09 Thread Zhao Lei
Switch to common warning()/error() for cmds-device.c. Signed-off-by: Zhao Lei --- cmds-device.c | 57 +++-- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index

[PATCH 2/3] btrfs-progs: cleanup cmd_device_usage

2015-11-09 Thread Zhao Lei
1: Remove more_than_one variant, use iterator's value instead 2: Remove "out" mark, use break instead. Signed-off-by: Zhao Lei --- cmds-device.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index

[PATCH] btrfs-progs: Check periodic.timer_fd's value before use

2015-11-09 Thread Zhao Lei
periodic.timer_fd's value is 0 on inititlize-failed case, if no value-checking before read(), the code will run as read(STDIN). This patch fixed above case. Signed-off-by: Zhao Lei --- task-utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/task-utils.c

Re: [RFCv3 00/12] xfstests: test the btrfs/xfs reflink/dedupe ioctls

2015-11-09 Thread Christoph Hellwig
On Tue, Oct 06, 2015 at 10:12:57PM -0700, Darrick J. Wong wrote: > * I don't have any interesting NFS/CIFS setups for test. :( I have a banrch with client and server support for NFSv4.2 CLONE support: http://git.infradead.org/users/hch/pnfs.git/shortlog/refs/heads/reflink+clone For now you

[PATCH] Fix partitioned loop devices resolve.

2015-11-09 Thread Florian Margaine
When using partitions on a loop device, the device's name can be e.g. /dev/loop0p1 or similar, and no relevant entry exists in the /sys filesystem, so the current resolve_loop_device function fails. Instead of using string functions to extract the device name and reading this file, this patch