Re: [RFC] BTRFS_DEV_REPLACE_ITEM_STATE_* doesn't match with on disk

2018-11-11 Thread Nikolay Borisov
On 12.11.18 г. 6:58 ч., Anand Jain wrote: > > The dev_replace_state defines are miss matched between the > BTRFS_IOCTL_DEV_REPLACE_STATE_* and BTRFS_DEV_REPLACE_ITEM_STATE_* [1]. > > [1] > - > btrfs.h:#define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED    2 >

Re: [PATCH] btrfs: remove redundant replace_state init

2018-11-11 Thread Nikolay Borisov
On 12.11.18 г. 7:05 ч., Anand Jain wrote: > dev_replace::replace_state has been set to > BTRFS_DEV_REPLACE_ITEM_STATE_NEVER_STARTED (0) in the same function, > So delete the line which sets replace_state = 0; > > Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- >

Re: [PATCH V6] Btrfs: enhance raid1/10 balance heuristic

2018-11-11 Thread Nikolay Borisov
On 25.09.18 г. 21:38 ч., Timofey Titovets wrote: > Currently btrfs raid1/10 balancer bаlance requests to mirrors, > based on pid % num of mirrors. > > Make logic understood: > - if one of underline devices are non rotational > - Queue length to underline devices > > By default try use pid %

Re: Full filesystem btrfs rebalance kernel panic to read-only lock

2018-11-11 Thread Qu Wenruo
On 2018/11/12 下午1:30, Anand Jain wrote: [snip] Btrfs-progs could do it with some extra dirty work. (I purposed offline device resize idea, but didn't implement it yet) You could use this branch: https://github.com/adam900710/btrfs-progs/tree/dirty_fix >>> >>> Qu, >>> >>>

Re: Full filesystem btrfs rebalance kernel panic to read-only lock

2018-11-11 Thread Anand Jain
On 11/12/2018 10:12 AM, Qu Wenruo wrote: On 2018/11/12 上午9:35, Anand Jain wrote: On 11/09/2018 09:21 AM, Qu Wenruo wrote: On 2018/11/9 上午6:40, Pieter Maes wrote: Hello, So, I've had the full disk issue, so when I tried re-balancing, I got a panic, that pushed filesystem read-only

[PATCH] btrfs: remove redundant replace_state init

2018-11-11 Thread Anand Jain
dev_replace::replace_state has been set to BTRFS_DEV_REPLACE_ITEM_STATE_NEVER_STARTED (0) in the same function, So delete the line which sets replace_state = 0; Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/dev-replace.c

[RFC] BTRFS_DEV_REPLACE_ITEM_STATE_* doesn't match with on disk

2018-11-11 Thread Anand Jain
The dev_replace_state defines are miss matched between the BTRFS_IOCTL_DEV_REPLACE_STATE_* and BTRFS_DEV_REPLACE_ITEM_STATE_* [1]. [1] - btrfs.h:#define BTRFS_IOCTL_DEV_REPLACE_STATE_FINISHED 2 btrfs.h:#define BTRFS_IOCTL_DEV_REPLACE_STATE_CANCELED

Re: Full filesystem btrfs rebalance kernel panic to read-only lock

2018-11-11 Thread Qu Wenruo
On 2018/11/12 上午9:35, Anand Jain wrote: > > > On 11/09/2018 09:21 AM, Qu Wenruo wrote: >> >> >> On 2018/11/9 上午6:40, Pieter Maes wrote: >>> Hello, >>> >>> So, I've had the full disk issue, so when I tried re-balancing, >>> I got a panic, that pushed filesystem read-only and I'm unable to >>>

Re: Full filesystem btrfs rebalance kernel panic to read-only lock

2018-11-11 Thread Anand Jain
On 11/09/2018 09:21 AM, Qu Wenruo wrote: On 2018/11/9 上午6:40, Pieter Maes wrote: Hello, So, I've had the full disk issue, so when I tried re-balancing, I got a panic, that pushed filesystem read-only and I'm unable to balance or grow the filesystem now. fs info: btrfs fi show / Label:

Price Inquiry

2018-11-11 Thread Daniel Murray
Hi,friend, This is Daniel Murray and i am from Sinara Group Co.Ltd Group Co.,LTD in Russia. We are glad to know about your company from the web and we are interested in your products. Could you kindly send us your Latest catalog and price list for our trial order. Best Regards, Daniel

Re: [PATCH V6] Btrfs: enhance raid1/10 balance heuristic

2018-11-11 Thread Timofey Titovets
Gentle ping. вт, 25 сент. 2018 г. в 21:38, Timofey Titovets : > > Currently btrfs raid1/10 balancer bаlance requests to mirrors, > based on pid % num of mirrors. > > Make logic understood: > - if one of underline devices are non rotational > - Queue length to underline devices > > By default try

Re: [PATCH 0/7] fstests: test Btrfs swapfile support

2018-11-11 Thread Eryu Guan
On Tue, Nov 06, 2018 at 02:06:30PM +0100, David Sterba wrote: > On Mon, Nov 05, 2018 at 12:09:31AM +0800, Eryu Guan wrote: > > On Fri, Nov 02, 2018 at 02:29:35PM -0700, Omar Sandoval wrote: > > > From: Omar Sandoval > > > > > > This series fixes a couple of generic swapfile tests and adds some >

[PATCH 9/9] btrfs: add explicit check for replace result no error

2018-11-11 Thread Anand Jain
We recast the replace return status BTRFS_IOCTL_DEV_REPLACE_RESULT_SCRUB_INPROGRESS to 0, to indicate no error. And since BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR should also return 0, which is also declared as 0, so we just return. Instead add it to the if statement so that there is enough clarity

[PATCH 5/9] btrfs: replace cancel is successful if scrub cancel is successful

2018-11-11 Thread Anand Jain
In btrfs_dev_replace_cancel() we should check if the btrfs_scrub_cancel() is successful. If the btrfs_scrub_cancel() fails, return BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED so that user can try to cancel the replace again. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 22

[PATCH 6/9] btrfs: replace's scrub must not be running in replace suspended state

2018-11-11 Thread Anand Jain
When the replace state is placed in the suspended state, btrfs_scrub_cancel() should fail with -ENOTCONN as there is no scrub running, as a safety catch check if btrfs_scrub_cancel() returns -ENOTCONN and assert if it doesn't. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 4 +++- 1

[PATCH 7/9] btrfs: quiten warn if the replace is canceled at finish

2018-11-11 Thread Anand Jain
When we successfully cancel the replace its scrub returns -ECANCELED, which then passed to btrfs_dev_replace_finishing(), it cleans up based on the scrub returned status and propagates the same -ECANCELED back the parent function. As of now only user can cancel the replace-scrub, so its ok to

[PATCH 8/9] btrfs: user requsted replace cancel is not an error

2018-11-11 Thread Anand Jain
As of now only user requested replace cancel can cancel the replace-scrub so no need to log error for it. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index

[PATCH 3/9] btrfs: replace back to suspend state if EXCL OP is running

2018-11-11 Thread Anand Jain
In a secnario where balance and replace co-exists as below, start balance; pause balance; start replace; reboot and when system restarts balance restarts first and the replace restart will fail as EXCL OP lock is already held by the balance. If so place the replace state back to

[PATCH 2/9] btrfs: replace go back to suspended if target missing

2018-11-11 Thread Anand Jain
At the time of forced unmount we place the running replace to BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes back and suppose the target device is missing, then let the replace state continue to be in BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state instead of

[PATCH 1/9] btrfs: mark btrfs_dev_replace_start() as static

2018-11-11 Thread Anand Jain
There isn't any other consumer other than in its own file dev-replace.c. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov --- fs/btrfs/dev-replace.c | 2 +- fs/btrfs/dev-replace.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/btrfs/dev-replace.c

[PATCH 0/9 v2] fix replace-start and replace-cancel racing

2018-11-11 Thread Anand Jain
v1->v2: 2/9: Drop writeback required 3/9: Drop writeback required 7/9: Use the condition within the WARN_ON() 6/9: Use the condition within the ASSERT() Replace-start and replace-cancel threads can race to create a messy situation leading to UAF. We use the scrub code to write the blocks

[PATCH 4/9] btrfs: fix UAF due to race between replace start and cancel

2018-11-11 Thread Anand Jain
replace cancel thread can race with the replace start thread and if fs_info::scrubs_running is not yet set the btrfs_scrub_cancel() will fail to stop the scrub thread, so the scrub thread continue with the scrub for replace which then shall try to write to the target device and which is already

Re: [PATCH 2/9] btrfs: replace go back to suspended if target missing

2018-11-11 Thread Anand Jain
On 11/07/2018 08:35 PM, Nikolay Borisov wrote: On 7.11.18 г. 13:43 ч., Anand Jain wrote: At the time of forced unmount we place the running replace to BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes back and suppose the target device is missing, then let the replace