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

2018-06-29 Thread Anand Jain
ed-off-by: Nikolay Borisov Reviewed-by: Anand Jain Thanks, Anand --- V2: * Fixed build failure due to using old name of free_device_rcu function. fs/btrfs/volumes.c | 26 ++ 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/fs/btrfs/volumes.c b

Re: [GIT PULL] Btrfs updates for 4.18

2018-06-29 Thread Anand Jain
On 06/29/2018 02:26 AM, David Sterba wrote: On Thu, Jun 28, 2018 at 07:22:59PM +0800, Anand Jain wrote: The circular locking dependency warning occurs at FSSTRESS_PROG. And in particular at doproc() in xfstests/ltp/fsstress.c, randomly at any of the command at opdesc_tops

Re: [PATCH RFC] btrfs: Do extra device generation check at mount time

2018-06-28 Thread Anand Jain
On 06/28/2018 04:02 PM, Qu Wenruo wrote: Also CC Anand Jain, since he is also working on various device related work, and an expert on this. Especially I'm not pretty sure if such enhancement is already on his agenda or there are already some unmerged patch for this. Right, some

Re: Major design flaw with BTRFS Raid, temporary device drop will corrupt nodatacow files

2018-06-28 Thread Anand Jain
On 06/28/2018 09:42 AM, Remi Gauvin wrote: There seems to be a major design flaw with BTRFS that needs to be better documented, to avoid massive data loss. Tested with Raid 1 on Ubuntu Kernel 4.15 The use case being tested was a Virtualbox VDI file created with NODATACOW attribute, (as is

Re: [GIT PULL] Btrfs updates for 4.18

2018-06-28 Thread Anand Jain
On 06/12/2018 12:16 AM, David Sterba wrote: On Mon, Jun 11, 2018 at 10:50:54AM +0100, Filipe Manana wrote: btrfs: replace uuid_mutex by device_list_mutex in btrfs_open_devices * * the mutex can be very coarse and can cover long-running operations * * protects: updates

Re: [PATCH 3/3] btrfs: fix race between mkfs and mount

2018-06-26 Thread Anand Jain
On 06/26/2018 08:19 PM, David Sterba wrote: On Tue, Jun 26, 2018 at 02:25:11PM +0800, Anand Jain wrote: (sorry for the delay in reply due to my vacation and, other urgent things took my priority too). Please see inline below. On 06/19/2018 09:53 PM, David Sterba wrote: On Thu, Jun

Re: [PATCH 7/7] btrfs: fix mount and ioctl device scan ioctl race

2018-06-26 Thread Anand Jain
On 06/21/2018 01:51 AM, David Sterba wrote: Technically this extends the critical section covered by uuid_mutex to: - parse early mount options -- here we can call device scan on paths that can be passed as 'device=/dev/...' - scan the device passed to mount - open the devices related

Re: [PATCH 2/7] btrfs: extend critical section when scanning a new device

2018-06-26 Thread Anand Jain
On 06/21/2018 01:51 AM, David Sterba wrote: The stale device list removal needs to be protected by device_list_mutex too as this could delete from the list and could race with another list modification and cause crash. Its is very less likely or almost practically impossible (unless

Re: [PATCH 3/3] btrfs: fix race between mkfs and mount

2018-06-26 Thread Anand Jain
On 06/20/2018 10:06 PM, David Sterba wrote: On Mon, Jun 04, 2018 at 11:00:30PM +0800, Anand Jain wrote: In an instrumented testing it is possible that the mount and a newer mkfs.btrfs thread on the same device can race and if the new mkfs.btrfs wins it will free the older fs_devices

Re: [PATCH 3/3] btrfs: fix race between mkfs and mount

2018-06-26 Thread Anand Jain
(sorry for the delay in reply due to my vacation and, other urgent things took my priority too). Please see inline below. On 06/19/2018 09:53 PM, David Sterba wrote: On Thu, Jun 07, 2018 at 06:39:32PM +0200, David Sterba wrote: On Mon, Jun 04, 2018 at 11:00:30PM +0800, Anand Jain wrote

Re: [GIT PULL] Btrfs updates for 4.18

2018-06-11 Thread Anand Jain
) Al Viro (1): btrfs: take the last remnants of ->d_fsdata use out Anand Jain (19): btrfs: add comment about BTRFS_FS_EXCL_OP btrfs: rename struct btrfs_fs_devices::list btrfs: cleanup __btrfs_open_devices() drop head pointer btrfs: rename __btrfs_close_devi

[PATCH] btrfs: fix race between free_stale_devices and close_fs_devices

2018-06-06 Thread Anand Jain
-by: Anand Jain --- fs/btrfs/volumes.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index c2b7d66192e8..32fba4e24027 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1153,6 +1153,12 @@ static int close_fs_devices(struct

Re: [PATCH] fstests: btrfs: Test if btrfs will corrupt nodatasum compressed extent when replacing device

2018-06-05 Thread Anand Jain
On 06/01/2018 09:34 AM, Qu Wenruo wrote: This is a long existing bug (from 2012) but exposed by a reporter recently, that when compressed extent without data csum get written to device-replace target device, the written data is in fact uncompressed data other than the original compressed

[PATCH 1/3] btrfs: convert volume rotating flag into bitmap

2018-06-04 Thread Anand Jain
Add bitmap btrfs_fs_devices::volume_state to maintain the volume states and flags. This patch in perticular converts btrfs_fs_devices::rotating into flag BTRFS_VOLUME_STATE_ROTATING. Signed-off-by: Anand Jain --- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/volumes.c | 7 --- fs/btrfs/volumes.h

[PATCH 2/3] btrfs: convert volume seeding flag into bitmap

2018-06-04 Thread Anand Jain
This patch converts btrfs_fs_devices::seeding into flag BTRFS_VOL_FLAG_SEEDING. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 3 ++- fs/btrfs/volumes.c | 25 +++-- fs/btrfs/volumes.h | 2 +- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git

[PATCH 3/3] btrfs: fix race between mkfs and mount

2018-06-04 Thread Anand Jain
Fix this with a mutually exclusive flag BTRFS_VOL_FLAG_EXCL_OPS. Signed-off-by: Anand Jain --- fs/btrfs/super.c | 6 ++ fs/btrfs/volumes.c | 10 +- fs/btrfs/volumes.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index f0c13defc

[PATCH v3 3/4] fstests: btrfs: seed device replace test

2018-06-01 Thread Anand Jain
Test case to verify that a seed device can be replaced Signed-off-by: Anand Jain --- v2->v3: New line for the test subject Drop author name add _require_command "$BTRFS_TUNE_PROG" btrfstune rename to small letters for the local variables v2: Born te

[PATCH v3 2/4] fstests: btrfs: nested seed device test

2018-06-01 Thread Anand Jain
Test case to verify that a sprout device can be a seed device Signed-off-by: Anand Jain --- v2->v3: New line for the test subject Drop author name add _require_command "$BTRFS_TUNE_PROG" btrfstune rename to small letters for the local variables v2: Born te

[PATCH v3 4/4] fstests: btrfs: seed device delete test

2018-06-01 Thread Anand Jain
Test case to verify that a seed device can be deleted Signed-off-by: Anand Jain --- v2->v3: New line for the test subject Drop author name add _require_command "$BTRFS_TUNE_PROG" btrfstune rename to small letters for the local variables v2: Born te

[PATCH v3 1/4] fstests: btrfs: add seed sprout functionality test

2018-06-01 Thread Anand Jain
Create a seed device and add the sprout device to it. Signed-off-by: Anand Jain --- v2->v3: New line for the test subject Drop author name add _require_command "$BTRFS_TUNE_PROG" btrfstune rename to small letters for the local variables v1->v2: Use

[PATCH v3 0/4] fstests: btrfs seed test cases

2018-06-01 Thread Anand Jain
out opertions. Anand Jain (4): fstests: btrfs: add seed sprout functionality test fstests: btrfs: nested seed device test fstests: btrfs: seed device replace test fstests: btrfs: seed device delete test common/config | 1 + tests/btrfs/161 |

Re: [PATCH v2 1/4] fstests: btrfs: add seed sprout functionality test

2018-06-01 Thread Anand Jain
On 05/29/2018 09:48 PM, Eryu Guan wrote: On Mon, May 28, 2018 at 05:51:45PM +0800, Anand Jain wrote: Create a seed device and add the sprout device to it. Signed-off-by: Anand Jain This series looks fine to me from fstests' point of view, there're just some really minor common issues

[PATCH 1/1] btrfs: prefix balance for recover and resume

2018-06-01 Thread Anand Jain
No functional changes. Signed-off-by: Anand Jain --- Hi David, Can you please fixup this with btrfs: balance: prefix kernel logs there were two more places where we could make balance logging consistent but it was missed before. Thanks. fs/btrfs/disk-io.c | 4 ++-- 1 file changed, 2

[PATCH] btrfs: drop uuid_mutex in btrfs_rm_device()

2018-06-01 Thread Anand Jain
-by: Anand Jain --- The changes here are on top the patch other btrfs_rm_device patches.. [PATCH 1/2] btrfs: fix parent in memory total_devices after seed delete [PATCH 2/2] btrfs: fix missing superblock update in the device delete commit transaction But they are not related. fs/btrfs/volumes.c | 18

[PATCH 2/2] btrfs: fix missing superblock update in the device delete commit transaction

2018-05-31 Thread Anand Jain
rfs mount $dev2 /btrfs btrfs dev del $dev1 /btrfs btrfs dev ready $dev2; echo RESULT=$? Signed-off-by: Anand Jain --- The seed device test case needs to fix the bug as in the patch, [PATCH 1/2] btrfs: fix parent in memory total_devices after seed delete As there is a bug in the btrfs_device

[PATCH 1/2] btrfs: fix parent in memory total_devices after seed delete

2018-05-31 Thread Anand Jain
update its corresponding btrfs_super_block::number_devices. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d3f9efbef9a9..5296f26be2f6 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c

[PATCH 5/6] btrfs: fix btrfs_free_stale_devices() with needed locks

2018-05-30 Thread Anand Jain
btrfs_free_stale_devices() finds the stale (not opened) matching device path in the fs_uuid list. We are already under uuid_mutex so when we check for each fs_devices, hold the respective device_list_mutex. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 25 +++-- 1 file

[PATCH 6/6] btrfs: rename btrfs_free_stale_devices drop btrfs prefix

2018-05-30 Thread Anand Jain
btrfs_free_stale_devices() is a static function drop the btrfs prefix. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a6a23b0185e5..afb3504f4097 100644 --- a/fs/btrfs

[PATCH 4/6] btrfs: btrfs_free_stale_devices() rename local variables

2018-05-30 Thread Anand Jain
Over the years we named %fs_devices and %devices to represent, the struct btrfs_fs_devices and the struct btrfs_device. So follow the same norm here too. No functional changes. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 35 ++- 1 file changed, 18

[PATCH 3/6] btrfs: update device_list_mutex protected items

2018-05-30 Thread Anand Jain
Include items of fs_uuids::fs_devices to be protected by device_list_mutex, like (but not limited to) fs_devices::opened, fs_devices::total_devices and fs_devices::num_devices. This is been done in the code already. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 3 ++- 1 file changed, 2

[PATCH 2/6] btrfs: fix device_list_add() missing device_list_mutex()

2018-05-30 Thread Anand Jain
When the device is added or if the device pointer is retrieved for writing, make sure that device_list_mutex is held. Also make sure it is held when we check fs_devices::opened and fs_devices::total_devices is updated. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 16 1

[PATCH 1/6] btrfs: do btrfs_free_stale_devices() outside of device_list_add()

2018-05-30 Thread Anand Jain
purpose. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 0a47b4162d12..4edba7c5c050 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -750,7 +750,8 @@ static

[PATCH 0/6] fix device_list_mutex usage and cleanups in device_list_add()

2018-05-30 Thread Anand Jain
(). Patch 6/6 renames btrfs_free_stale_device() to free_stale_device(), no functional changes. Anand Jain (6): btrfs: do btrfs_free_stale_devices() outside of device_list_add() btrfs: fix device_list_add() missing device_list_mutex() btrfs: update device_list_mutex protected items btrfs

Re: [PATCH] btrfs: set device state reappearing missing device

2018-05-30 Thread Anand Jain
On 05/29/2018 02:50 PM, Gu Jinxiang wrote: From: Gu JinXiang patch for commit 921518924084 ("btrfs: handle dynamically reappearing missing device"). --- v4: :: . No need to set in_fs_metadata flag as its already set on missing device --- > Since BTRFS_DEV_STATE_IN_FS_METADATA will be clear

[PATCH] fstests: introduce btrfs/volume group

2018-05-28 Thread Anand Jain
is helpful to verify the btrfs volume related changes. Run as ./check -g btrfs/volume Signed-off-by: Anand Jain --- tests/btrfs/group | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/btrfs/group b/tests/btrfs/group index

Re: [PATCH 2nd try v4] btrfs: drop uuid_mutex in btrfs_free_extra_devids()

2018-05-28 Thread Anand Jain
On 05/29/2018 06:57 AM, Anand Jain wrote: On 05/28/2018 11:40 PM, David Sterba wrote: On Mon, May 28, 2018 at 10:43:29PM +0800, Anand Jain wrote: btrfs_free_extra_devids() is called only in the mount context which traverses through the fs_devices::devices and frees the orphan devices

Re: [PATCH 2nd try v4] btrfs: drop uuid_mutex in btrfs_free_extra_devids()

2018-05-28 Thread Anand Jain
On 05/28/2018 11:40 PM, David Sterba wrote: On Mon, May 28, 2018 at 10:43:29PM +0800, Anand Jain wrote: btrfs_free_extra_devids() is called only in the mount context which traverses through the fs_devices::devices and frees the orphan devices devices in the given %fs_devices if any

[PATCH v4] btrfs: drop uuid_mutex in btrfs_free_extra_devids()

2018-05-28 Thread Anand Jain
-by: Anand Jain <anand.j...@oracle.com> --- v3->v4: As we traverse through the seed device, fs_device gets updated with the child seed fs_devices, so make sure we use the top most fs_devices pointer. v2->v3: Update change log. (Currently device_list_add() is very

[PATCH 2nd try v4] btrfs: drop uuid_mutex in btrfs_free_extra_devids()

2018-05-28 Thread Anand Jain
-by: Anand Jain <anand.j...@oracle.com> --- (I didn't see this email in the mailing list, so trying again). v3->v4: As we traverse through the seed device, fs_device gets updated with the child seed fs_devices, so make sure we use the same fs_devices pointer for the mut

[PATCH v2 2/4] fstests: btrfs: nested seed device test

2018-05-28 Thread Anand Jain
Test case to verify that a sprout device can be a seed device Signed-off-by: Anand Jain <anand.j...@oracle.com> --- tests/btrfs/162 | 103 tests/btrfs/162.out | 9 + tests/btrfs/group | 1 + 3 files changed, 113 inse

[PATCH v2 4/4] fstests: btrfs: seed device delete test

2018-05-28 Thread Anand Jain
Test case to verify that a seed device can be deleted Signed-off-by: Anand Jain <anand.j...@oracle.com> --- tests/btrfs/164 | 114 tests/btrfs/164.out | 9 + tests/btrfs/group | 1 + 3 files changed, 124 insertions(+)

[PATCH v2 3/4] fstests: btrfs: seed device replace test

2018-05-28 Thread Anand Jain
Test case to verify that a seed device can be replaced Signed-off-by: Anand Jain <anand.j...@oracle.com> --- tests/btrfs/163 | 114 tests/btrfs/163.out | 9 + tests/btrfs/group | 1 + 3 files changed, 124 insertions(+)

[PATCH v2 1/4] fstests: btrfs: add seed sprout functionality test

2018-05-28 Thread Anand Jain
Create a seed device and add the sprout device to it. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v1->v2: Use functions to do the respective operations. Add data verification. common/config | 1 + tests/btrfs/161

[PATCH v3 0/4] fstests: btrfs seed test cases

2018-05-28 Thread Anand Jain
1/4 was sent separately which is now integrated into this set, with some changes as indicated in the patch. Though rest of the patches 2/4..4/4 are new, they carry the set version v2. These test cases verify the seed sprout opertions. Anand Jain (4): fstests: btrfs: add seed sprout

Re: [PATCH v3 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread Anand Jain
On 05/25/2018 10:59 AM, Qu Wenruo wrote: On 2018年05月25日 08:54, Qu Wenruo wrote: On 2018年05月25日 00:24, Anand Jain wrote: On misc-next this patch is causing regression, the seed sprout functionality test [1] (in the mailing list) fails.  [1]  [PATCH] fstests: btrfs: add seed sprout

[PATCH v4.1b 2/3] btrfs: balance: add args info during start and resume

2018-05-24 Thread Anand Jain
=10..20 -msoft,profiles=raid1,convert=single -ssoft,profiles=raid1,convert=single Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v4->v4.1b: Rename last missed sz to size_buf. Allocate at least (64*3) 192 bytes for tmp_buf. Log format change: No space afte

[PATCH v4.1a 2/3] btrfs: balance: add args info during start and resume

2018-05-24 Thread Anand Jain
mit=10..20 M:soft,profiles=raid1,convert=single S:soft,profiles=raid1,convert=single Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v4->v4.1a: Rename last missed sz to size_buf. Allocate at least (64*3) 192 bytes for tmp_buf. Log format change: Use CAPS abbrevia

Re: [PATCH v4 2/3] btrfs: balance: add args info during start and resume

2018-05-24 Thread Anand Jain
On 05/24/2018 09:03 PM, David Sterba wrote: On Wed, May 23, 2018 at 02:35:07PM +0800, Anand Jain wrote: Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: ->btrfs bal start --full-balance -f -mprofiles=ra

[PATCH v4.1 1/3] btrfs: add helper function describe_block_group()

2018-05-24 Thread Anand Jain
Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain <anand.j...@oracle.com> Reviewed-by: David Sterba <dste...@suse.com> --- v4->v4.1: Use strcpy(buf, "|NONE"); as in the original v3->v4: Just pass

Re: [PATCH v4 1/3] btrfs: add helper function describe_block_group()

2018-05-24 Thread Anand Jain
On 05/24/2018 08:43 PM, David Sterba wrote: On Wed, May 23, 2018 at 02:35:06PM +0800, Anand Jain wrote: Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v3->v4: Just pass full

Re: [PATCH v3 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread Anand Jain
On misc-next this patch is causing regression, the seed sprout functionality test [1] (in the mailing list) fails. [1] [PATCH] fstests: btrfs: add seed sprout functionality test more below.. On 05/11/2018 01:35 PM, Qu Wenruo wrote: Just move btrfs_check_super_valid() before its single

[PATCH] fstests: btrfs: add seed sprout functionality test

2018-05-24 Thread Anand Jain
Create a seed device and add the sprout device to it. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- common/config | 1 + tests/btrfs/161 | 69 + tests/btrfs/161.out | 2 ++ tests/btrfs/group | 1 + 4 files chang

[PATCH v4 3/3] btrfs: balance: add kernel log for end or paused

2018-05-23 Thread Anand Jain
Add a kernel log when the balance ends, either for cancel or completed or if it is paused. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v3->v4: nothing. v2->v3: nothing. v1->v2: Moved from 2/3 to 3/3 fs/btrfs/volumes.c | 7 +++ 1 file changed, 7 insertions(+) diff -

[PATCH v4 1/3] btrfs: add helper function describe_block_group()

2018-05-23 Thread Anand Jain
Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v3->v4: Just pass full flag name in the define DESCRIBE_FLAG(flag,..), so that it can be used at couple of more places.

[PATCH v4 2/3] btrfs: balance: add args info during start and resume

2018-05-23 Thread Anand Jain
-d usage=50,limit=10..20 -m soft,profiles=raid1,convert=single -s soft,profiles=raid1,convert=single Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v3->v4: Change log updated with new example. Log format is changed to almost match with the cli. snprintf drop %s for i

[PATCH v4 0/3] btrfs: balance: improve kernel logs

2018-05-23 Thread Anand Jain
alance logs easy to review. Anand Jain (3): btrfs: add helper function describe_block_group() btrfs: balance: add args info during start and resume btrfs: balance: add kernel log for end or paused fs/btrfs/relocation.c | 30 ++- fs/btrfs/volumes.c

Re: [PATCH v3 1/3] btrfs: add helper function describe_block_group()

2018-05-23 Thread Anand Jain
On 05/22/2018 08:26 PM, David Sterba wrote: On Mon, May 21, 2018 at 02:37:43PM +0800, Anand Jain wrote: Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v3: Born. fs/btrfs/relocation.

Re: [PATCH v3 2/3] btrfs: balance: add args info during start and resume

2018-05-23 Thread Anand Jain
On 05/22/2018 08:35 PM, David Sterba wrote: On Mon, May 21, 2018 at 02:37:44PM +0800, Anand Jain wrote: Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: -> btrfs bal start -dprofiles='raid1|single',conv

[PATCH v3] btrfs: drop uuid_mutex in btrfs_free_extra_devids()

2018-05-22 Thread Anand Jain
-by: Anand Jain <anand.j...@oracle.com> --- Currently device_list_add() is very lean on its device_list_mutex usage, a cleanup and fix is wip. Given the practicality of the above race condition this patch is good to merge. fs/btrfs/volumes.c | 5 ++--- 1 file changed, 2 insertions(+), 3 del

[PATCH v2] btrfs: drop uuid_mutex in close_fs_devices()

2018-05-22 Thread Anand Jain
close_fs_devices() closes devices of a given fsid, and it is limited to all the devices of a fsid, so we don't have to hold the global uuid_mutex, instead we need the device_list_mutex as the device state is being changed. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v1->v2: Ad

[PATCH v2] btrfs: drop uuid_mutex in btrfs_free_extra_devids()

2018-05-22 Thread Anand Jain
btrfs_free_extra_devids() frees the orphan fsid::devid with in btrfs_fs_devices::devices, so we dont need uuid_mutex, instead hold the btrfs_fs_devices::device_list_mutex. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v1->v2: replace uuid_mutex with device_list_mutex instead

Re: [PATCH 0/15] Review uuid_mutex usage

2018-05-22 Thread Anand Jain
On 05/16/2018 12:33 AM, David Sterba wrote: On Thu, Apr 12, 2018 at 10:29:23AM +0800, Anand Jain wrote: uuid_mutex lock is not a per-fs lock but a global lock. The main aim of this patch-set is to critically review the usage of this lock, and delete the unnecessary once. By doing this we

Re: [PATCH 12/15] btrfs: drop uuid_mutex in close_fs_devices()

2018-05-22 Thread Anand Jain
On 05/16/2018 12:30 AM, David Sterba wrote: On Thu, Apr 12, 2018 at 10:29:35AM +0800, Anand Jain wrote: close_fs_devices() closes devices of a given fsid, and it is limited to all the devices of a fsid, so we don't have to hold the global uuid_mutex, instead we need the device_list_mutex

Re: [PATCH 10/15] btrfs: drop uuid_mutex in btrfs_free_extra_devids()

2018-05-22 Thread Anand Jain
On 05/16/2018 12:26 AM, David Sterba wrote: On Thu, Apr 12, 2018 at 10:29:33AM +0800, Anand Jain wrote: btrfs_free_extra_devids() frees the orphan fsid::devid but its search is limited to btrfs_fs_devices::devices, so we dont need uuid_mutex. From that it's not clear why there's no locking

[PATCH v3 3/3] btrfs: balance: add kernel log for end or paused

2018-05-21 Thread Anand Jain
Add a kernel log when the balance ends, either for cancel or completed or if it is paused. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v2->v3: nothing. v1->v2: Moved from 2/3 to 3/3 fs/btrfs/volumes.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/btrfs/vo

[PATCH v3 0/3] btrfs: balance: improve kernel logs

2018-05-21 Thread Anand Jain
Based on misc-next. v2->v3: Inspried by describe_relocation(), improves it, makes it a helper function and use it to log the balance operations. Kernel logs are very important for the forensic investigations of the issues, these patchs make balance logs easy to review. Anand Jain

[PATCH v3 2/3] btrfs: balance: add args info during start and resume

2018-05-21 Thread Anand Jain
Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: -> btrfs bal start -dprofiles='raid1|single',convert=raid5 -mprofiles='raid1|single',convert=raid5 /btrfs kernel: BTRFS info (device sdb): balance: start

Re: [PATCH v2 3/3] btrfs: balance: add kernel log for end or paused

2018-05-21 Thread Anand Jain
On 05/17/2018 08:06 PM, David Sterba wrote: On Wed, May 16, 2018 at 10:51:28AM +0800, Anand Jain wrote: Add a kernel log when the balance ends, either for cancel or completed or if it is paused. Missing S-O-B. oops. Fixed in v3. --- v1->v2: Moved from 2/3 to 3/3 fs/btrfs/volume

[PATCH v3 1/3] btrfs: add helper function describe_block_group()

2018-05-21 Thread Anand Jain
Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v3: Born. fs/btrfs/relocation.c | 30 +++--- fs/btrfs/volumes.c| 44 ++

Re: [PATCH v2 2/3] btrfs: balance: add args info during start and resume

2018-05-21 Thread Anand Jain
On 05/17/2018 07:59 PM, David Sterba wrote: On Wed, May 16, 2018 at 10:51:27AM +0800, Anand Jain wrote: Balance args info is an important information to be reviewed for the system audit. So this patch adds it to the kernel log. Example: -> btrfs bal start -dprofiles='raid1|single',conv

Re: [PATCH v2 0/3] btrfs: add read mirror policy

2018-05-18 Thread Anand Jain
On 05/17/2018 10:46 PM, Jeff Mahoney wrote: On 5/17/18 8:25 AM, Austin S. Hemmelgarn wrote: On 2018-05-16 22:32, Anand Jain wrote: On 05/17/2018 06:35 AM, David Sterba wrote: On Wed, May 16, 2018 at 06:03:56PM +0800, Anand Jain wrote: Not yet ready for the integration. As I need to introduce

[PATCH] btrfs: fix describe_relocation string pointer

2018-05-17 Thread Anand Jain
Looks like the original idea was to print the hex of the flags which is not coded with their flag name. So use the current buf pointer bp instead of buf. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- fs/btrfs/relocation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

Re: [PATCH v2] btrfs: fix BUG trying to resume balance without resume flag

2018-05-17 Thread Anand Jain
On 05/16/2018 10:35 PM, David Sterba wrote: On Mon, Apr 30, 2018 at 05:48:45PM +0800, Anand Jain wrote: We set the BTRFS_BALANCE_RESUME flag in the btrfs_recover_balance(), which is not called during the remount. So when resuming from the paused balance we hit BUG. kernel: kernel BUG at fs

[PATCH v3] btrfs: fix BUG trying to resume balance without resume flag

2018-05-17 Thread Anand Jain
the BTRFS_BALANCE_RESUME flag in btrfs_resume_balance_async(). Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v2->v3: . Hold fs_info->balance_lock because in remount context there can be more the one thread accessing the balance_ctl. . Don't remove the BTRFS_BALANCE_RESUME set at rec

Re: [PATCH v2 0/3] btrfs: add read mirror policy

2018-05-16 Thread Anand Jain
On 05/17/2018 06:35 AM, David Sterba wrote: On Wed, May 16, 2018 at 06:03:56PM +0800, Anand Jain wrote: Not yet ready for the integration. As I need to introduce -o no_read_mirror_policy instead of -o read_mirror_policy=- Mount option is mostly likely not the right interface for setting

Re: [PATCH v2 3/3] btrfs: balance: add kernel log for end or paused

2018-05-16 Thread Anand Jain
On 05/16/2018 07:25 PM, Austin S. Hemmelgarn wrote: On 2018-05-15 22:51, Anand Jain wrote: Add a kernel log when the balance ends, either for cancel or completed or if it is paused. --- v1->v2: Moved from 2/3 to 3/3   fs/btrfs/volumes.c | 7 +++   1 file changed, 7 insertions(+) d

Re: [PATCH] Btrfs: fix the corruption by reading stale btree blocks

2018-05-16 Thread Anand Jain
On 05/16/2018 01:37 AM, Liu Bo wrote: If a btree block, aka. extent buffer, is not available in the extent buffer cache, it'll be read out from the disk instead, i.e. btrfs_search_slot() read_block_for_search() # hold parent and its lock, go to read child btrfs_release_path()

Re: [PATCH v2 2/3] btrfs: balance: add args info during start and resume

2018-05-16 Thread Anand Jain
On 05/16/2018 03:57 PM, Nikolay Borisov wrote: On 16.05.2018 05:51, Anand Jain wrote: Balance args info is an important information to be reviewed for the system audit. So this patch adds it to the kernel log. Example: -> btrfs bal start -dprofiles='raid1|single',convert=raid5 -mprofi

[PATCH] fstests: btrfs/161: test raid1 missing writes

2018-05-16 Thread Anand Jain
Test to make sure that a raid1 device with missed write reads good data when reassembled. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- This test case fails as of now. I am sending this to btrfs ML only as it depends on the read_mirror_policy kernel patches which is in the ML.

[PATCH v2 3/3] btrfs: read_mirror_policy ability to reset

2018-05-16 Thread Anand Jain
Adds an ability to change the read_mirror_policy at remount. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- fs/btrfs/super.c | 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 7ddecf4178a6..e70592036b95

[PATCH v2 0/3] btrfs: add read mirror policy

2018-05-16 Thread Anand Jain
Not yet ready for the integration. As I need to introduce -o no_read_mirror_policy instead of -o read_mirror_policy=- to reset the policy as in 3/3. But I am sending this early so that we can use it for btrfs/161 in the ML, and this patch-set is stable enough for the testing. Anand Jain (3

[PATCH v2 2/3] btrfs: add read_mirror_policy parameter devid

2018-05-16 Thread Anand Jain
. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- fs/btrfs/super.c | 21 + fs/btrfs/volumes.c | 10 ++ fs/btrfs/volumes.h | 2 ++ 3 files changed, 33 insertions(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 21eff0ac1e4f..7ddecf4178a6 100644 --- a/fs

[PATCH v2 1/3] btrfs: add mount option read_mirror_policy

2018-05-16 Thread Anand Jain
$pid policy configurable from the mount option. For example.. mount -o read_mirror_policy=pid (which is also default) Signed-off-by: Anand Jain <anand.j...@oracle.com> --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/super.c | 10 ++ fs/btrfs/volumes.c | 8 +++- fs/btrfs/volumes.

[PATCH v2] btrfs: update uuid_mutex and device_list_mutex comments

2018-05-15 Thread Anand Jain
Make the uuid_mutex and device_list_mutex comments inline with the changes. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v1->v2: Fix typo. fs_devs -> fs_uuids fs/btrfs/volumes.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --gi

Re: [PATCH] btrfs: update uuid_mutex and device_list_mutex comments

2018-05-15 Thread Anand Jain
On 04/24/2018 11:48 PM, David Sterba wrote: On Wed, Apr 18, 2018 at 05:56:31PM +0800, Anand Jain wrote: @@ -155,29 +155,26 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, * * uuid_mutex (global lock) * - * protects the fs_uuids list

[PATCH v2 3/3] btrfs: balance: add kernel log for end or paused

2018-05-15 Thread Anand Jain
Add a kernel log when the balance ends, either for cancel or completed or if it is paused. --- v1->v2: Moved from 2/3 to 3/3 fs/btrfs/volumes.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ce68c4f42f94..a4e243a29f5c 100644 ---

[PATCH v2 1/3] btrfs: balance: prefix kernel logs

2018-05-15 Thread Anand Jain
Kernel logs are very important for the forensic investigations of the issues in general make it easy to use it. This patch adds 'balance:' prefix so that it can be easily searched. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v1-v2: Change log update. fs/btrfs/volumes.

[PATCH v2 0/3] btrfs: balance: improve kernel logs

2018-05-15 Thread Anand Jain
Kernel logs are very important for the forensic investigations of the issues, these patchs make balance logs easy to review. Anand Jain (3): btrfs: balance: prefix kernel logs btrfs: balance: add args info during start and resume btrfs: balance: add kernel log for end or paused fs/btrfs

Re: [PATCH 2/2] btrfs: add balance args info during start and resume

2018-05-15 Thread Anand Jain
All comments accepted in v2 in ml, except for the one below.   clear_bit(BTRFS_FS_BALANCE_RUNNING, _info->flags);   if (bargs) { @@ -3947,10 +4096,8 @@ static int balance_kthread(void *data)   int ret = 0;   mutex_lock(_info->balance_mutex); -    if (fs_info->balance_ctl) { -  

Re: [PATCH] btrfs: property: Set incompat flag of lzo/zstd compression

2018-05-15 Thread Anand Jain
<misono.tomoh...@jp.fujitsu.com> Reviewed-by: Anand Jain <anand.j...@oracle.com> -- 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 2/5] btrfs: Split btrfs_del_delalloc_inode into 2 functions

2018-05-10 Thread Anand Jain
. I am not sure if the function name should prefix with __ here. Reviewed-by: Anand Jain <anand.j...@orcle.com> Thanks, Anand -- 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

Re: [PATCH v2] btrfs: Unexport and rename btrfs_invalidate_inodes

2018-05-10 Thread Anand Jain
the sole caller to avoid introducing yet-another-pointless forward declaration. Signed-off-by: Nikolay Borisov <nbori...@suse.com> Reviewed-by: Anand Jain <anand.j...@oracle.com> Thanks, Anand -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in

Re: [PATCH] btrfs: remove redundant btrfs_balance_control::fs_info

2018-05-07 Thread Anand Jain
On 05/07/2018 11:44 PM, David Sterba wrote: The fs_info is always available from the context so we don't need to store it in the structure. Signed-off-by: David Sterba <dste...@suse.com> Reviewed-by: Anand Jain <anand.j...@oracle.com> -- To unsubscribe from this list: s

Re: [btrfs_put_block_group] WARNING: CPU: 1 PID: 14674 at fs/btrfs/disk-io.c:3675 free_fs_root+0xc2/0xd0 [btrfs]

2018-05-03 Thread Anand Jain
On 04/19/2018 03:25 PM, Nikolay Borisov wrote: On 19.04.2018 08:32, Fengguang Wu wrote: Hello, FYI this happens in mainline kernel and at least dates back to v4.16 . It's rather rare error and happens when running xfstests. Yeah, so this is something which only recently was

Re: [PATCH] btrfs: rename btrfs_balance_control::flags to b_flags

2018-05-01 Thread Anand Jain
On 05/01/2018 01:08 AM, David Sterba wrote: On Mon, Apr 30, 2018 at 05:49:13PM +0800, Anand Jain wrote: As flags is a generic name, its often difficult to search, rename btrfs_balance_control::flags to btrfs_balance_control::b_flags. I don't think this one is necessary as it's always tied

[PATCH] btrfs: rename btrfs_balance_control::flags to b_flags

2018-04-30 Thread Anand Jain
As flags is a generic name, its often difficult to search, rename btrfs_balance_control::flags to btrfs_balance_control::b_flags. Signed-off-by: Anand Jain <anand.j...@oracle.com> --- fs/btrfs/ioctl.c | 10 +- fs/btrfs/volumes.c | 30 +++--- fs/btrfs/vol

[PATCH v2] btrfs: fix BUG trying to resume balance without resume flag

2018-04-30 Thread Anand Jain
in btrfs_resume_balance_async() instead of btrfs_recover_balance(). Signed-off-by: Anand Jain <anand.j...@oracle.com> --- v1->v2: btrfs_resume_balance_async() can be called only from remount or mount, we don't need to hold fs_info->balance_lock. Strictly speaking we should rather keep

Re: [PATCH 2/2] btrfs: add balance args info during start and resume

2018-04-27 Thread Anand Jain
On 04/27/2018 02:46 PM, Nikolay Borisov wrote: On 26.04.2018 11:01, Anand Jain wrote: Balance args info is an important information to be reviewed on the system under audit. So this patch adds that. Would have been good to add example output to the change log. Here are the samples

Re: [PATCH v2 12/16] btrfs: track running balance in a simpler way

2018-04-26 Thread Anand Jain
ps. So for now.. Reviewed-by: Anand Jain <anand.j...@oracle.com> Thanks, Anand -- 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 v2.1 13/16] btrfs: move and comment read-only check in btrfs_cancel_balance

2018-04-26 Thread Anand Jain
t; instead of "read-only filesystem". Signed-off-by: David Sterba <dste...@suse.com> Reviewed-by: Anand Jain <anand.j...@oracle.com> Thanks, Anand --- - Add missing unlock fs/btrfs/volumes.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git

<    1   2   3   4   5   6   7   8   9   10   >