Re: About minimal device number for RAID5/6

2016-08-15 Thread Anand Jain
IMHO it's better to warn user about 2 devices RAID5 or 3 devices RAID6. Any comment is welcomed. Based on looking at the code, we do in fact support 2/3 devices for raid5/6 respectively. Personally, I agree that we should warn when trying to do this, but I absolutely don't think we should s

Re: About minimal device number for RAID5/6

2016-08-15 Thread Anand Jain
Have a look at this.. http://www.spinics.net/lists/linux-btrfs/msg54779.html -- RAID5&6 devs_min values are in the context of degraded volume. RAID1&10.. devs_min values are in the context of healthy volume. RAID56 is correct. We already have devs_max to know the number of devices in

Re: About minimal device number for RAID5/6

2016-08-15 Thread Anand Jain
On 08/15/2016 10:10 PM, Austin S. Hemmelgarn wrote: On 2016-08-15 10:08, Anand Jain wrote: IMHO it's better to warn user about 2 devices RAID5 or 3 devices RAID6. Any comment is welcomed. Based on looking at the code, we do in fact support 2/3 devices for raid5/6 respect

Re: [PATCH] btrfs: do not background blkdev_put()

2016-08-18 Thread Anand Jain
On 08/18/2016 08:46 PM, David Sterba wrote: On Fri, Jul 22, 2016 at 06:04:53AM +0800, Anand Jain wrote: From: Anand Jain At the end of unmount/dev-delete, if the device exclusive open is not actually closed, then there might be a race with another program in the userland who is trying to

Re: [PATCH 01/13] btrfs-progs: pass OPEN_CTREE flags as unsigned

2016-08-24 Thread Anand Jain
All patches looks good. nice cleanups. Reviewed-by: Anand Jain Thanks. On 08/23/2016 06:25 PM, David Sterba wrote: As we're passing a set of flags, the enum type is not appropriate. Signed-off-by: David Sterba --- btrfstune.c | 2 +- cmds-check.c | 2 +- disk-io.c

Re: [PATCH 05/13] btrfs-progs: two staged filesystem creation

2016-08-24 Thread Anand Jain
valid filesystem on all devices. We can also rely on the partially created filesystem to do better error handling during creation. We can just bail out and do not need to clean up. Looks good to me. Reviewed-by: Anand Jain Thanks, Anand The partial signature is '!BHRfS_M', can b

Re: Another 4.8-rc locked splat: btrfs_close_devices()

2016-09-08 Thread Anand Jain
Thanks for the report Ilya. Yep. Have seen similar issues during hotspare fixes as well. Where the vfs call to btrfs_show_devname() and its device_list_mutex lock is conflicting. One of that is fixed here. -- 779bf3fefa835cb52a07457c8acac6f2f66f2493 btrfs: fix lock dep warning, move scr

[PATCH] btrfs: fix a possible umount deadlock

2016-09-09 Thread Anand Jain
39] [] deactivate_super+0x5d/0x70 [ 984.051525] [] cleanup_mnt+0x5c/0x80 [ 984.056774] [] __cleanup_mnt+0x12/0x20 [ 984.062201] [] task_work_run+0x7e/0xc0 [ 984.067625] [] exit_to_usermode_loop+0x7e/0xb4 [ 984.073747] [] syscall_return_slowpath+0xbb/0xd0 [ 984.080038] [] entry_SYSCA

Re: Another 4.8-rc locked splat: btrfs_close_devices()

2016-09-09 Thread Anand Jain
Looks like we need to take time to clean up device_list_mutex, chunk_mutex, volume_mutex and rcu. As of now I have sent out, [PATCH] btrfs: fix a possible umount deadlock This has passed xfstests/btrfs. Thanks, Anand On 09/09/2016 08:38 AM, Anand Jain wrote: Thanks for the report

[PATCH v2] btrfs: fix a possible umount deadlock

2016-09-09 Thread Anand Jain
39] [] deactivate_super+0x5d/0x70 [ 984.051525] [] cleanup_mnt+0x5c/0x80 [ 984.056774] [] __cleanup_mnt+0x12/0x20 [ 984.062201] [] task_work_run+0x7e/0xc0 [ 984.067625] [] exit_to_usermode_loop+0x7e/0xb4 [ 984.073747] [] syscall_return_slowpath+0xbb/0xd0 [ 984.080038] [] entry_SYSCALL_64_f

Re: [PATCH] btrfs: fix a possible umount deadlock

2016-09-09 Thread Anand Jain
On 09/09/2016 08:53 PM, David Sterba wrote: On Fri, Sep 09, 2016 at 04:31:04PM +0800, Anand Jain wrote: static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) { struct btrfs_device *device, *tmp; + static LIST_HEAD(pending_put); Why is it static? sorry my

[PATCH] btrfs: Encryption: Add btrfs encryption support

2016-09-13 Thread Anand Jain
Adds encryption support. Based on v4.7-rc3. Signed-off-by: Anand Jain --- fs/btrfs/Makefile | 4 +- fs/btrfs/btrfs_inode.h | 6 + fs/btrfs/compression.c | 30 +- fs/btrfs/compression.h | 10 +- fs/btrfs/ctree.h| 4 + fs/btrfs/disk

[PATCH 1/2] btrfs-progs: make wait_for_commit non static

2016-09-13 Thread Anand Jain
wait_for_commit() is needed by encrypt patch set so this patch makes it non static. Also as utils.h is included twice deletes one of it. Signed-off-by: Anand Jain --- btrfs-list.c | 10 ++ cmds-subvolume.c | 11 --- utils.h | 1 + 3 files changed, 11 insertions

[RFC] Preliminary BTRFS Encryption

2016-09-13 Thread Anand Jain
xt switch, which I do believe should be fixed in the due course, but is not a roadblock at this stage. Thanks, Anand Anand Jain (1): btrfs: Encryption: Add btrfs encryption support fs/btrfs/Makefile | 4 +- fs/btrfs/btrfs_inode.h | 6 + fs/btrfs/compression.c

[PATCH 2/2] btrfs-progs: add encryption support

2016-09-13 Thread Anand Jain
Based on v4.7.2 Depends on keyctl-utils and libscrypt packages. Signed-off-by: Anand Jain --- Makefile.in | 5 +- btrfs-list.c | 23 +++ cmds-filesystem.c | 4 +- cmds-restore.c| 16 ++ cmds-subvolume.c | 101 +++- commands.h| 1 + ctree.h

[PATCH] fstests: btrfs: support encryption

2016-09-13 Thread Anand Jain
isn't for the end users but for the testing only, but inspired by ecryptfs, we could provide such an interface if useful. (Not sending this patch to fstests community as of now, but it would be in the long run). Signed-off-by: Anand Jain --- common/filter.btrfs | 2 +- common/rc

Re: [RFC] Preliminary BTRFS Encryption

2016-09-14 Thread Anand Jain
s on top of the list to be supported, it helps testing as well. Thanks, Anand Thanks in advance, Wilson Am 13.09.2016 um 15:39 schrieb Anand Jain : This patchset adds btrfs encryption support. The main objective of this series is to have bugs fixed and stability. I have verified wit

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

2016-09-14 Thread Anand Jain
On 09/13/2016 05:49 AM, Hugo Mills wrote: What happened to these patches? (Particularly the per-chunk degraded checks). Per-chunk degraded-check patch helps to workaround the issue. Which is needed to test hotspare support. The final fix for the same is.. [RFC] btrfs: create degr

Re: [RFC] Preliminary BTRFS Encryption

2016-09-15 Thread Anand Jain
Thanks for the comments. Pls see inline below.. On 09/15/2016 01:38 PM, Chris Murphy wrote: On Tue, Sep 13, 2016 at 7:39 AM, Anand Jain wrote: This patchset adds btrfs encryption support. The main objective of this series is to have bugs fixed and stability. I have verified with fstests to

Re: [RFC] Preliminary BTRFS Encryption

2016-09-15 Thread Anand Jain
Thanks for commenting. pls see inline below. On 09/15/2016 12:53 PM, Alex Elsayed wrote: On Tue, 13 Sep 2016 21:39:46 +0800, Anand Jain wrote: This patchset adds btrfs encryption support. The main objective of this series is to have bugs fixed and stability. I have verified with fstests to

Re: [RFC] Preliminary BTRFS Encryption

2016-09-15 Thread Anand Jain
Thanks for comments. Pls see inline as below. On 09/15/2016 07:37 PM, Austin S. Hemmelgarn wrote: On 2016-09-13 09:39, Anand Jain wrote: This patchset adds btrfs encryption support. The main objective of this series is to have bugs fixed and stability. I have verified with fstests to

Re: [RFC] Preliminary BTRFS Encryption

2016-09-16 Thread Anand Jain
On 09/15/2016 07:47 PM, Alex Elsayed wrote: On Thu, 15 Sep 2016 19:33:48 +0800, Anand Jain wrote: Thanks for commenting. pls see inline below. On 09/15/2016 12:53 PM, Alex Elsayed wrote: On Tue, 13 Sep 2016 21:39:46 +0800, Anand Jain wrote: This patchset adds btrfs encryption support

Re: [RFC] Preliminary BTRFS Encryption

2016-09-16 Thread Anand Jain
On 09/16/2016 09:12 AM, Dave Chinner wrote: On Tue, Sep 13, 2016 at 09:39:46PM +0800, Anand Jain wrote: This patchset adds btrfs encryption support. The main objective of this series is to have bugs fixed and stability. I have verified with fstests to confirm that there is no regression. A

Re: [RFC] Preliminary BTRFS Encryption

2016-09-16 Thread Anand Jain
however here below is the quick example on the cli usage. Please try out, let me know if I have missed something. Also would like to mention that a review from the security experts is due, which is important and I believe those review comments can be accommodated without major changes from her

Re: [RFC] Preliminary BTRFS Encryption

2016-09-17 Thread Anand Jain
Hi Eric, Thanks for the constructive feedback, pls see inline below. On 09/17/2016 02:58 PM, Eric Biggers wrote: On Tue, Sep 13, 2016 at 09:39:46PM +0800, Anand Jain wrote: This patchset adds btrfs encryption support. Hi Anand, I'm part of a team that will be maintainin

RAID1 availability issue[2], Hot-spare and auto-replace

2016-09-18 Thread Anand Jain
(updated the subject, was [1]) IMO the hot-spare feature makes most sense with the raid56, Why. ? which is stuck where it is, so we need to get it working first. We need at least one RAID which does not have the availability issue. We could achieve that with raid1, there are patche

Re: [RFC] Preliminary BTRFS Encryption

2016-09-18 Thread Anand Jain
On 09/18/2016 04:35 AM, David Sterba wrote: On Fri, Sep 16, 2016 at 07:56:02PM +0800, Anand Jain wrote: however here below is the quick example on the cli usage. Please try out, let me know if I have missed something. Also would like to mention that a review from the security experts is

Re: RAID1 availability issue[2], Hot-spare and auto-replace

2016-09-18 Thread Anand Jain
, 2016 at 2:34 AM, Anand Jain wrote: (updated the subject, was [1]) IMO the hot-spare feature makes most sense with the raid56, Why. ? Raid56 is not scalable, has less redundancy in most all configurations, rebuild impacts the entire array performance, and in the case of raid6 two drives

Re: [RFC] Preliminary BTRFS Encryption

2016-09-19 Thread Anand Jain
Hi Chris, Hi Anand, Thanks for sending these out. It's an important feature and I'm glad to see it getting some love. Right now, the design doc is really the most important part. The encryption side of things requires a layer of extra verification that we can't get from reviewing the code

Re: Experimental btrfs encryption

2016-09-19 Thread Anand Jain
Hi Ted, I appreciate your email, thanks for taking time to review. Before I wrote the current version, I had a version which used fs/crypto. BTRFS needs a highly scalable solution, I am experimenting and evaluating, integration with fs/crypto is needed, I will discuss that in the fsdevel

Re: [RFC] Preliminary BTRFS Encryption

2016-09-20 Thread Anand Jain
Hi David, On 09/18/2016 02:45 AM, David Sterba wrote: On Sat, Sep 17, 2016 at 12:38:30AM -0400, Zygo Blaxell wrote: There's also a nasty problem with the extent tree--there's only one per filesystem, it's shared between all subvols and block groups, and every extent in that tree has back ref

Re: Experimental btrfs encryption

2016-09-21 Thread Anand Jain
So there's a matrix of possible configurations. If you're doing a reflink between subvolumes and you're doing a subvolume granular encryption and you don't have keys to the source subvolume, the reflink shouldn't be allowed. Right, this is working. If you do have keys, any new writes are

[PATCH v3] btrfs: fix a possible umount deadlock

2016-09-21 Thread Anand Jain
39] [] deactivate_super+0x5d/0x70 [ 984.051525] [] cleanup_mnt+0x5c/0x80 [ 984.056774] [] __cleanup_mnt+0x12/0x20 [ 984.062201] [] task_work_run+0x7e/0xc0 [ 984.067625] [] exit_to_usermode_loop+0x7e/0xb4 [ 984.073747] [] syscall_return_slowpath+0xbb/0xd0 [ 984.080038] [] e

Re: [PATCH v2] btrfs: fix a possible umount deadlock

2016-09-21 Thread Anand Jain
On 09/21/2016 10:26 PM, David Sterba wrote: On Sat, Sep 10, 2016 at 07:03:38AM +0800, Anand Jain wrote: static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices) { struct btrfs_device *device, *tmp; + LIST_HEAD(pending_put); + INIT_LIST_HEAD(&pending

Re: [PATCH] generic/175: disable inline data feature for btrfs

2016-10-10 Thread Anand Jain
On 10/10/16 13:06, Wang Xiaoguang wrote: For btrfs, if compression is enabled, it may generate inline data for a blocksize data range, this inline data is stored in fs tree, will not have a individual extent, try to reflink this data range at a not-zero offset will return EOPNOTSUPP, so here we

Re: [PATCH] btrfs-progs: btrfstune: Register new UUIDs after uuid change

2016-10-10 Thread Anand Jain
On 10/10/16 17:21, Qu Wenruo wrote: For multi-device btrfs, after UUID change we should info kernel, or new fs can't be mounted due to false alert on missing devices. Signed-off-by: Qu Wenruo --- btrfstune.c | 9 + 1 file changed, 9 insertions(+) diff --git a/btrfstune.c b/btrfstune

Re: [PATCH] btrfs-progs: btrfstune: Register new UUIDs after uuid change

2016-10-10 Thread Anand Jain
On 10/10/16 19:08, David Sterba wrote: On Mon, Oct 10, 2016 at 06:54:08PM +0800, Anand Jain wrote: On 10/10/16 17:21, Qu Wenruo wrote: For multi-device btrfs, after UUID change we should info kernel, or new fs can't be mounted due to false alert on missing devices. Signed-off-b

Re: RAID system with adaption to changed number of disks

2016-10-12 Thread Anand Jain
Missing device is the _only_ thing the current design handles. Right. below patches in the ML added two more device states offline and failed. It is tested with raid1. [PATCH 11/13] btrfs: introduce device dynamic state transition to offline or failed [PATCH 12/13] btrfs: check device fo

Re: Monitoring Btrfs

2016-10-17 Thread Anand Jain
I would like to monitor my btrfs-filesystem for missing drives. This is actually correct behavior, the filesystem reports that it should have 6 devices, which is how it knows a device is missing. Missing - means missing at the time of mount. So how are you planning to monitor a disk whic

Re: Monitoring Btrfs

2016-10-18 Thread Anand Jain
I would like to monitor my btrfs-filesystem for missing drives. This is actually correct behavior, the filesystem reports that it should have 6 devices, which is how it knows a device is missing. Missing - means missing at the time of mount. So how are you planning to monitor a disk wh

Re: Monitoring Btrfs

2016-10-19 Thread Anand Jain
On 10/19/16 19:15, Austin S. Hemmelgarn wrote: On 2016-10-18 17:36, Anand Jain wrote: I would like to monitor my btrfs-filesystem for missing drives. This is actually correct behavior, the filesystem reports that it should have 6 devices, which is how it knows a device is missing

Re: Monitoring Btrfs

2016-10-19 Thread Anand Jain
On 10/19/16 21:33, Austin S. Hemmelgarn wrote: On 2016-10-19 09:06, Anand Jain wrote: On 10/19/16 19:15, Austin S. Hemmelgarn wrote: On 2016-10-18 17:36, Anand Jain wrote: I would like to monitor my btrfs-filesystem for missing drives. This is actually correct behavior, the

Re: Btrfs progs git repo on kernel.org

2011-10-27 Thread Anand Jain
w we can easily and repeatably test the recovery tools). Please talk with Anand Jain on the test programs, he has been making scripts for xfs-tests. Will do, although I think we're aiming at different things. I'm very definitely *not* attempting to test the filesystem itself wit

Re: revert to static snapshot on reboot

2012-01-10 Thread Anand Jain
Upcoming btrfs autosnap feature might help your problem-solution. But the main part in your case which is to replace the root with its snapshot is something beyond the scope of autosnap project. What is being developed is a set of btrfs-prog sub-command to create and manage snapshots with

Re: can't access diagrams on wiki

2012-01-24 Thread Anand Jain
The wiki on kernel.org is in read-only mode [1] http://btrfs.ipv5.de/ Is wiki still in read only mode? I am able to login, but there isn't any link to create new page ? thanks, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord

Re: can't access diagrams on wiki

2012-01-26 Thread Anand Jain
: On 25.01.2012 03:37, Anand Jain wrote: The wiki on kernel.org is in read-only mode [1] http://btrfs.ipv5.de/ Is wiki still in read only mode? I am able to login, but there isn't any link to create new page ? You mean the wiki mentioned above? You have to confirm your email addre

[PATCH V2] Btrfs-progs: add \"btrfs subvolume get-default\" subcommand

2012-02-14 Thread Anand Jain
Hi Xin / Hugo, I am referring to git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs.git has miss match parameter list for list_subvols -- # cd btrfs-progs # egrep list_subvols * btrfs_cmds.c: ret = list_subvols(fd, print_parent, 0); btrfs_cmds.c: ret = list_subv

Re: [RFC] btrfs auto snapshot

2012-02-23 Thread Anand Jain
On Thursday 23,February,2012 06:37 PM, Hubert Kario wrote: On Wednesday 17 of August 2011 10:15:46 Anand Jain wrote: btrfs auto snapshot feature will include: Initially: - snapshot destination will be subvol/.btrfs/snapshot@ and snapshot/.btrfs/snapshot@ for subvolum

Re: git resources

2012-02-23 Thread Anand Jain
(When we have this I shall update the btrfs wiki) As promised an article was posted here sometime back. Writing patch for btrfs http://btrfs.ipv5.de/index.php?title=Writing_patch_for_btrfs It was long waiting in my mail draft as kernel.org was down sorry for the delay. -Anand -- T

Re: [RFC] btrfs auto snapshot

2012-02-23 Thread Anand Jain
Thanks for the inputs. there is no clear winner as of now. Let me keep the uuid for now, if more sysadmin feel timestamp is better we could device it that way. -Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel

Re: [PATCH] [RFC] Add btrfs autosnap feature

2012-02-28 Thread Anand Jain
Hi, This patch added autosnap feature for the btrfs-progs. The link below provides autosnap guide.. http://btrfs.ipv5.de/index.php?title=Autosnap:_Configure_your_btrfs_to_create_and_manage_snapshots_automatically_based_on_events_or_at_a_regular_frequency Further there is timeslider, a

Re: [PATCH] [RFC] Add btrfs autosnap feature

2012-03-04 Thread Anand Jain
(notably the direct modification of crontab files, which is considered to be an internal detail if I understand correctly, and I'm fairly certain is broken as written), I did came across that point of view however, using crontab cli in the program wasn't convincing either, (library call woul

Re: [PATCH] [RFC] Add btrfs autosnap feature

2012-03-05 Thread Anand Jain
Prior to making a new snapshot, grab the (stored) transid of the previous snapshot, and check if any files have been modified in the source since that transid: btrfs sub find "${source}" "${previous_transid}". If nothing is returned, then you don't have to bother making the snapshot at all, oth

[PATCH 1/2] Make find_updated_files to return value instead of printing

2012-03-05 Thread Anand jain
From: Anand Jain This patch made the function find_updated_files to update the transid in a pointer instead of printing it on the stdout. This is needed by the autosnap and anyother program which may want to find the current transid. Note that when last_gen 3rd parameter is not -1 then

[PATCH 2/2] Use transaction id to determin if there is any change in the subvol

2012-03-05 Thread Anand jain
From: Anand Jain Moved from hash method of determining the FS changes to the transaction record id method Signed-off-by: Anand Jain --- autosnap.c | 106 ++-- autosnap.h |4 +-- 2 files changed, 70 insertions(+), 40 deletions

[PATCH 2/2 v2] Use transaction id to determin if there is any change in the subvol

2012-03-06 Thread Anand jain
From: Anand Jain Moved from hash method of determining the FS changes to the transaction record id method Signed-off-by: Anand Jain --- Makefile |2 +- autosnap.c | 176 ++-- autosnap.h |4 +- 3 files changed, 66 insertions

Re: kernel BUG at fs/btrfs/transaction.c:1337!

2012-03-11 Thread Anand Jain
could you also post few lines of dmesg logged _before_ the below logs. Thanks, -Anand On Saturday 10,March,2012 06:26 PM, qasdfgtyuiop wrote: [11558.527680] [ cut here ] [11558.527708] kernel BUG at fs/btrfs/transaction.c:1337! [11558.527730] invalid opcode: [#1

Re: kernel BUG at fs/btrfs/transaction.c:1337!

2012-03-13 Thread Anand Jain
Input/output error cp: reading `log/errors.log': Input/output error cp: failed to extend `/home/gaoxiang/tests/log/errors.log': Input/output error cp: reading `log/everything.log': Input/output error cp: failed to extend `/home/gaoxiang/tests/log/everything.log': Input/output err

Re: kernel BUG at fs/btrfs/transaction.c:1337!

2012-03-13 Thread Anand Jain
block key (310249 54 3310625780) level 0 tree block backref root 256 failed to find block number 51019776 On 3/14/12, qasdfgtyuiop wrote: I'm sorry but I don't know how to get the kernel dump. It seems that the kernel dump is not enabled for my kernel: # CONFIG_CRASH_DUMP is not s

Synchronous snapshot delete

2012-03-20 Thread Anand Jain
Hi Team, Could you let me know if you are working on.. Synchronous snapshot delete (or similar) few requested for this feature, just wanted to know if anyone has picked up this and is working on it. Thanks, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrf

Re: Kernel bug in BTRFS (kernel 3.3.0)

2012-04-17 Thread anand jain
Hi Olivier > [370517.204350] btrfs: 1 errors while writing supers > [370517.204376] [ cut here ] > [370517.204391] kernel BUG at fs/btrfs/disk-io.c:2880! --- if (total_errors > max_errors) { printk(KERN_ERR "btrfs: %d errors while writing supers

Re: ran cppcheck and going to make cosmetic changes--where do I submit code?

2012-05-04 Thread Anand Jain
where do I submit the code when I'm done? P.S. This is my first kernel project, so I'm going to need some direction. wiki page 'Writing patch for btrfs' has this info http://btrfs.ipv5.de/index.php?title=Writing_patch_for_btrfs good luck. -Anand -- To unsubscribe from this list: send th

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

2018-11-07 Thread Anand Jain
btrfs_dev_replace_finishing() is called when btrfs_scub_dev() returns along with the scrub return status. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 61 -- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/fs/btrfs/dev-replace

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

2018-11-07 Thread Anand Jain
BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 47d6768a9cde..e001c2418940 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -898,6

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

2018-11-07 Thread Anand Jain
ting"); AND OR wait_for_user("scrub running is NOT set..waiting"); reboot mount -o degraded /dev/sdb /btrfs btrfs replace status /btrfs btrfs replace cancel /btrfs btrfs replace status /btrfs umount /btrfs mount /dev/sdb /btrfs Anand Jain (9): btrfs: mark btrfs_dev_replace_start(

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

2018-11-07 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 2/9] btrfs: replace go back to suspended if target missing

2018-11-07 Thread Anand Jain
BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any matching scrub running as part of replace. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 59991165e126..47d6768a9cde 100644 --- a/fs/

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

2018-11-07 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 ++

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

2018-11-07 Thread Anand Jain
There isn't any other consumer other than in its own file dev-replace.c. Signed-off-by: Anand Jain --- 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 b/fs/btrfs/dev-replace.c index 2aa48ae

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

2018-11-07 Thread Anand Jain
while reading the code. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index cf3554554616..ca44998189c7 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c

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

2018-11-07 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 c14c41b70287

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

2018-11-07 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. So skip the -ECANCELED error to log the WARN. Signed-off-by: Anand

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

2018-11-07 Thread Anand Jain
On 11/07/2018 08:15 PM, Nikolay Borisov wrote: On 7.11.18 г. 13:43 ч., Anand Jain wrote: 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

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

2018-11-08 Thread Anand Jain
On 11/07/2018 08:17 PM, Nikolay Borisov wrote: On 7.11.18 г. 13:43 ч., Anand Jain wrote: - WARN_ON(ret); + if (ret != -ECANCELED) + WARN_ON(ret); WARN_ON(ret && ret != -ECANCELED) Will fix. Thanks, Anand

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

2018-11-08 Thread Anand Jain
On 11/07/2018 08:19 PM, Nikolay Borisov wrote: On 7.11.18 г. 13:43 ч., Anand Jain wrote: + /* scrub for replace must not be running in suspended state */ + if (btrfs_scrub_cancel(fs_info) != -ENOTCONN) + ASSERT(0); ASSERT

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

2018-11-08 Thread Anand Jain
On 11/08/2018 04:52 PM, Nikolay Borisov wrote: On 8.11.18 г. 10:33 ч., Anand Jain wrote: On 11/07/2018 08:19 PM, Nikolay Borisov wrote: On 7.11.18 г. 13:43 ч., Anand Jain wrote: +    /* scrub for replace must not be running in suspended state */ +    if (btrfs_scrub_cancel

Re: [PATCH v15.1 00/13] Btrfs In-band De-duplication

2018-11-09 Thread Anand Jain
De-duplication must also let use cases to enable de-duplication on per subvolume level, using the subvolume properties. Similar to compression and future-encryption. Thanks, Anand

Re: [PATCH] btrfs: Check for missing device before bio submission in btrfs_map_bio

2018-11-10 Thread Anand Jain
device->bdev check. Doing so ensures that no bio cloning/submission happens for both async/sync requests in the face of missing device. This makes the async io submission path slightly shorter in terms of instruction count. No functional changes. Signed-off-by: Nikolay Borisov Reviewe

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

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

2018-11-11 Thread Anand Jain
btrfs_dev_replace_finishing() is called when btrfs_scub_dev() returns along with the scrub return status. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 61 -- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/fs/btrfs/dev-replace

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

2018-11-11 Thread Anand Jain
BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 4 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 3c29b0976087..35ce10f18607 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -897,6

[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 b/fs/btrf

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

2018-11-11 Thread Anand Jain
db && mount /dev/sdb /btrfs && fillfs /btrfs 1 btrfs replace start /dev/sdb /dev/sdc /btrfs wait_for_user("scrub running is set..waiting"); AND OR wait_for_user("scrub running is NOT set..waiting"); reboot mount -o degraded /dev/sdb /b

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

2018-11-11 Thread Anand Jain
BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any matching scrub running as part of replace. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 59991165e126..3c29b0976087 100644 --- a/fs/

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

2018-11-11 Thread Anand Jain
quieten the warn here. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 1dc8e86546db..9031a362921a 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c

[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 9031a362921a

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

2018-11-11 Thread Anand Jain
while reading the code. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 40a0942b4659..cc25a34f87b0 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c

[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 ++

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: non

[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

[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 b/fs

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

Re: [PATCH] btrfs: fix computation of max fs size for multiple device fs tests

2018-11-13 Thread Anand Jain
Example: $ echo -e "11\n9\n20" | sort 11 20 9 $ echo -e "11\n9\n20" | sort -n 9 11 20 Signed-off-by: Filipe Manana Thanks for the fix. Reviewed-by: Anand Jain --- tests/btrfs/124 | 2 +- tests/btrfs/125 | 2 +- tests/btrfs/154 | 2 +- 3 files changed, 3 insertions(

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

2018-11-13 Thread Anand Jain
David, Gentle ping. Thanks, Anand On 11/12/2018 03:50 PM, Nikolay Borisov wrote: 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

Re: [PATCH RFC RESEND] btrfs: harden agaist duplicate fsid

2018-11-13 Thread Anand Jain
On 11/13/2018 11:21 PM, David Sterba wrote: On Mon, Oct 15, 2018 at 10:45:17AM +0800, Anand Jain wrote: (Thanks for the comments on requiring to warn_on if we fail the device change.) (This fixes an ugly bug, I appreciate if you have any further comments). Its not that impossible to imagine

Re: [PATCH RFC] btrfs: harden agaist duplicate fsid

2018-11-13 Thread Anand Jain
On 11/13/2018 11:31 PM, David Sterba wrote: On Mon, Oct 01, 2018 at 09:31:04PM +0800, Anand Jain wrote: +    /* + * we are going to replace the device path, make sure its the + * same device if the device mounted + */ +    if (device->b

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

2018-11-13 Thread Anand Jain
I am ok with the least used path approach here for the IO routing that's probably most reasonable in generic configurations. It can be default read mirror policy as well. But as I mentioned. Not all configurations would agree to the heuristic approach here. For example: To make use of the SAN

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

2018-11-13 Thread Anand Jain
On 11/14/2018 01:24 AM, David Sterba wrote: On Sun, Nov 11, 2018 at 10:22:19PM +0800, Anand Jain wrote: 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

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

2018-11-13 Thread Anand Jain
btrfs_dev_replace_finishing() is called when btrfs_scub_dev() returns along with the scrub return status. Signed-off-by: Anand Jain --- v2->v2.1: Fix compiler warning. (I couldn't reproduce on gcc 4.8.5) fs/btrfs/dev-replace.c: In function ‘btrfs_dev_replace_cancel’: fs/btrfs/dev-replace.c:8

  1   2   3   4   5   6   7   8   9   10   >