Re: Problem with file system

2017-11-06 Thread Dave
On Sat, Nov 4, 2017 at 1:25 PM, Chris Murphy wrote: > > On Sat, Nov 4, 2017 at 1:26 AM, Dave wrote: > > On Mon, Oct 30, 2017 at 5:37 PM, Chris Murphy > > wrote: > >> > >> That is not a general purpose file system. It's

Re: how to run balance successfully (No space left on device)?

2017-11-06 Thread Tomasz Chmielewski
On 2017-10-31 23:18, Tomasz Chmielewski wrote: On 2017-09-18 17:20, Tomasz Chmielewski wrote: # df -h /var/lib/lxd FWIW, standard (aka util-linux) df is effectively useless in a situation such as this, as it really doesn't give you the information you need (it can say you have lots of space

Re: Should cp default to reflink?

2017-11-06 Thread Marat Khalili
Obviously (for me) yes, but who will decide? There should be --no-reflink for people trying to defragment something. >Seems to me any request to duplicate should be optimized by default >with an auto reflink when possible, and require an explicit option to >inhibit. Key word is "any". I much

Re: [PATCH v2] btrfs: cleanup btrfs_async_submit_limit to return the final limit value

2017-11-06 Thread Anand Jain
1. If the pdflush issue is fixed, we should go back to bdi congestion method, as block layer is more appropriate and accurate to tell when the device is congested. Device q depth 256 is very generic. 2. Consider RAID1 devices at different speed (SSD and iscsi LUN) not too sure if this approach

Re: [PATCH 2/3] btrfs: tree-checker: Add checker for dir item

2017-11-06 Thread Su Yue
On 11/06/2017 05:20 PM, Qu Wenruo wrote: Add checker for dir item, for key types DIR_ITEM, DIR_INDEX and XATTR_ITEM. This checker does comprehensive check for: 1) dir_item header and its data size Against item boundary and maximum name/xattr length. This part is mostly the same as old

[PATCH 2/2] btrfs-progs: fi defrag: extend -c to drop nocompress flag on files

2017-11-06 Thread Su Yue
Now, files which have nocompress flag also will be defraged with compression. However, nocompress flag is still existed and have to be cleared manually. So add an option '--clear-nocompress' to extend -c to drop nocompress flag after defragement. Suggested-by: David Sterba

[PATCH 1/2] btrfs-progs: fi defrag: clean up duplicate code if find errors

2017-11-06 Thread Su Yue
In function cmd_filesystem_defrag(), lines of code for error handling are duplicate and hard to expand in further. Create a jump label for errors. Signed-off-by: Su Yue --- cmds-filesystem.c | 46 +- 1 file changed, 25

[PATCH v3] btrfs: cleanup btrfs_async_submit_limit to return the final limit value

2017-11-06 Thread Anand Jain
We feedback IO progress when it falls below the 2/3 times of the limit obtained from btrfs_async_submit_limit() so to creates a wait for the write process and make uncontested progress during the async submission. In general device/transport q depth is 256 and, btrfs_async_submit_limit() returns

Re: feedback on three different scrub methods

2017-11-06 Thread Qu Wenruo
On 2017年11月07日 04:17, Chris Murphy wrote: > I just did scrubs on five different volumes using all three scrub > methods. There were no errors found, so the test leaves uncertain what > the error handling differences are between the three scrubs. But at > the least with no errors, there are also

Re: [PATCH] btrfs: Don't generate UUID for non-fs tree

2017-11-06 Thread Qu Wenruo
On 2017年11月06日 23:28, David Sterba wrote: > On Tue, Oct 31, 2017 at 02:08:16PM +0800, Qu Wenruo wrote: >> btrfs_create_tree() will unconditionally generate UUID for any root. >> So for quota tree and data reloc tree created by kernel, they will have >> unique UUIDs. >> >> However UUID in root

Re: [PATCH 5/7] btrfs: btrfs_rm_device() does not need uuid_mutex

2017-11-06 Thread Anand Jain
On 11/07/2017 01:02 AM, David Sterba wrote: On Mon, Nov 06, 2017 at 04:36:16PM +0800, Anand Jain wrote: Signed-off-by: Anand Jain No changelog at all? Oh. This patch is wrong. I thought I deleted this from my workspace. Now I notice this ended up in the ML. We

Re: [PATCH 3/7] btrfs: use i_size_read() instead of open code

2017-11-06 Thread Anand Jain
On 11/07/2017 12:52 AM, David Sterba wrote: On Mon, Nov 06, 2017 at 04:36:14PM +0800, Anand Jain wrote: As i_size_read() takes care of 32bit smp or preempt cases as well. Can bdev->bd_inode->i_size change so that we need to use the i_size_read()? My answer is 'no'. Hm. Right I was

Should cp default to reflink?

2017-11-06 Thread Chris Murphy
I'm doing copies from one subvolume to another, through a mounted top level (id5) at /mnt/int. This copies the whole file conventionally (no shared extents) $ sudo cp /mnt/int/home/chris/Downloads/Fedora-Server-dvd-x86_64-27-1.6.iso /mnt/int/root00/var/lib/libvirt/images/ This is a reflink copy

Re: Several questions regarding btrfs

2017-11-06 Thread waxhead
ST wrote: Hello, I've recently learned about btrfs and consider to utilize for my needs. I have several questions in this regard: I manage a dedicated server remotely and have some sort of script that installs an OS from several images. There I can define partitions and their FSs. 1. By

Re: [PATCH 00/10] Cleanup unnecessary get_extent parameters

2017-11-06 Thread Nikolay Borisov
On 6.11.2017 21:30, David Sterba wrote: > There are several functions that take a generic get_extent parameter, but not > all of them use it to distinguish between btree_get_exnent (for metadata) and > btrfs_get_extent (for data). This is namely extent_read_full_page and > __do_readpage. I

feedback on three different scrub methods

2017-11-06 Thread Chris Murphy
I just did scrubs on five different volumes using all three scrub methods. There were no errors found, so the test leaves uncertain what the error handling differences are between the three scrubs. But at the least with no errors, there are also no disagreements between the three methods. 1.

Re: btrfs send yields "ERROR: send ioctl failed with -5: Input/output error"

2017-11-06 Thread Chris Murphy
On Sun, Oct 29, 2017 at 1:05 PM, Chris Murphy wrote: > On Thu, Oct 26, 2017 at 4:34 AM, Zak Kohler wrote: > >> I will gladly repeat this process, but I am very concerned why this >> corruption happened in the first place. > > Right. So everyone who

Re: updatedb does not index /home when /home is Btrfs

2017-11-06 Thread Austin S. Hemmelgarn
On 2017-11-06 13:35, Chris Murphy wrote: On Mon, Nov 6, 2017 at 6:51 AM, Austin S. Hemmelgarn wrote: This brings to mind another 'feature' of BTRFS that I came across recently, namely that subvolumes that aren't explicitly mounted still show up as mount points according

[PATCH 09/10] btrfs: sink get_extent parameter to __do_contiguous_readpages

2017-11-06 Thread David Sterba
All callers pass btrfs_get_extent. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a266239716f7..72620cf41423 100644 --- a/fs/btrfs/extent_io.c

[PATCH 10/10] btrfs: sink get_extent parameter to read_extent_buffer_pages

2017-11-06 Thread David Sterba
All callers pass btree_get_extent, which needs to be exported. Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 8 fs/btrfs/disk-io.h | 3 +++ fs/btrfs/extent_io.c | 6 +++--- fs/btrfs/extent_io.h | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff

[PATCH 08/10] btrfs: sink get_extent parameter to __extent_readpages

2017-11-06 Thread David Sterba
All callers pass btrfs_get_extent. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 1140ce4d321a..a266239716f7 100644 ---

[PATCH 02/10] btrfs: sink get_extent parameter to extent_write_locked_range

2017-11-06 Thread David Sterba
There's only one caller. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 5 ++--- fs/btrfs/extent_io.h | 3 +-- fs/btrfs/inode.c | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index

[PATCH 01/10] btrfs: sink get_extent parameter to extent_writepages

2017-11-06 Thread David Sterba
There's only one caller. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 3 +-- fs/btrfs/extent_io.h | 1 - fs/btrfs/inode.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index

[PATCH 07/10] btrfs: sink get_extent parameter to extent_readpages

2017-11-06 Thread David Sterba
There's only one caller that passes btrfs_get_extent. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 11 +-- fs/btrfs/extent_io.h | 3 +-- fs/btrfs/inode.c | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/extent_io.c

[PATCH 06/10] btrfs: sink get_extent parameter to get_extent_skip_holes

2017-11-06 Thread David Sterba
All callers pass btrfs_get_extent_fiemap and get_extent_skip_holes itself is used only as a fiemap helper. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/extent_io.c

[PATCH 05/10] btrfs: sink get_extent parameter to extent_fiemap

2017-11-06 Thread David Sterba
All callers pass btrfs_get_extent_fiemap and we don't expect anything else in the context of extent_fiemap. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 6 +++--- fs/btrfs/extent_io.h | 2 +- fs/btrfs/inode.c | 2 +- 3 files changed, 5 insertions(+), 5

[PATCH 04/10] btrfs: drop get_extent from extent_page_data

2017-11-06 Thread David Sterba
Previous patches cleaned up all places where extent_page_data::get_extent was set and it was btrfs_get_extent all the time, so we can simply call that instead. This also reduces size of extent_page_data by 8 bytes which has positive effect on stack consumption on various functions on the write

[PATCH 03/10] btrfs: sink get_extent parameter to extent_write_full_page

2017-11-06 Thread David Sterba
There's only one caller. Signed-off-by: David Sterba --- fs/btrfs/extent_io.c | 3 +-- fs/btrfs/extent_io.h | 1 - fs/btrfs/inode.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index

[PATCH 00/10] Cleanup unnecessary get_extent parameters

2017-11-06 Thread David Sterba
There are several functions that take a generic get_extent parameter, but not all of them use it to distinguish between btree_get_exnent (for metadata) and btrfs_get_extent (for data). This is namely extent_read_full_page and __do_readpage. The rest can be cleaned up so that the desired

Re: Problem with file system

2017-11-06 Thread Austin S. Hemmelgarn
On 2017-11-06 13:45, Chris Murphy wrote: On Mon, Nov 6, 2017 at 6:29 AM, Austin S. Hemmelgarn wrote: With ATA devices (including SATA), except on newer SSD's, TRIM commands can't be queued, SATA spec 3.1 includes queued trim. There are SATA spec 3.1 products on the

Re: Problem with file system

2017-11-06 Thread Chris Murphy
On Mon, Nov 6, 2017 at 6:29 AM, Austin S. Hemmelgarn wrote: > > With ATA devices (including SATA), except on newer SSD's, TRIM commands > can't be queued, SATA spec 3.1 includes queued trim. There are SATA spec 3.1 products on the market claiming to do queued trim. Some of

Re: updatedb does not index /home when /home is Btrfs

2017-11-06 Thread Chris Murphy
On Mon, Nov 6, 2017 at 6:51 AM, Austin S. Hemmelgarn wrote: > This brings to mind another 'feature' of BTRFS that I came across recently, > namely that subvolumes that aren't explicitly mounted still show up as mount > points according to how most CLI tools differentiate

[PATCH] btrfs: switch uuid tree semaphore to mutex

2017-11-06 Thread David Sterba
The uuid_tree_rescan_sem is used as a mutex (initialized with value 1 and with at most one active user), no reason to obscure that as a semaphore. Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 6 +- fs/btrfs/disk-io.c | 6 +++--- fs/btrfs/super.c | 4 ++--

[PATCH] btrfs: switch to on-stack csum buffer in csum_tree_block

2017-11-06 Thread David Sterba
The maximum size of a checksum buffer is known, BTRFS_CSUM_SIZE, and we don't have to allocate it dynamically. This code path is not used at all as we have only the crc32c and use an on-stack buffer already. Signed-off-by: David Sterba --- fs/btrfs/disk-io.c | 16

Re: [PATCH] Btrfs: add __init macro to btrfs init function

2017-11-06 Thread David Sterba
On Thu, Nov 02, 2017 at 05:21:50PM -0600, Liu Bo wrote: > Adding __init macro gives kernel a hint that this function is only > used during the initialization phase and its memory resources can be > freed up after. > Signed-off-by: Liu Bo Reviewed-by: David Sterba

Re: [PATCH 5/7] btrfs: btrfs_rm_device() does not need uuid_mutex

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 04:36:16PM +0800, Anand Jain wrote: > Signed-off-by: Anand Jain No changelog at all? Sorry but I'm tired of asking you for explanations each time. Removing a mutex is far from a trivial change. -- To unsubscribe from this list: send the line

Re: [PATCH 4/7] btrfs: rename btrfs_add_device to btrfs_add_dev_item

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 04:36:15PM +0800, Anand Jain wrote: > Function btrfs_add_device() is about adding the device item > so rename to reflect that in the function. Similarly we have > btrfs_rm_dev_item(). > > Signed-off-by: Anand Jain Reviewed-by: David Sterba

Re: [PATCH 3/7] btrfs: use i_size_read() instead of open code

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 04:36:14PM +0800, Anand Jain wrote: > As i_size_read() takes care of 32bit smp or preempt cases as well. Can bdev->bd_inode->i_size change so that we need to use the i_size_read()? My answer is 'no'. You haven't provided any reasoning why it should be otherwise. -- To

Re: [PATCH 1/7] btrfs: optimize use of volume_mutex in btrfs_ioctl_resize()

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 04:36:12PM +0800, Anand Jain wrote: > We can push volume_mutex lock further down after the memory operation. I'm a bit reluctant to apply any patches that cleanup volume_mutex as it's going to be removed. -- To unsubscribe from this list: send the line "unsubscribe

Re: [PATCH 1/4] Btrfs: introduce device flags

2017-11-06 Thread David Sterba
On Wed, Nov 01, 2017 at 06:54:02PM -0600, Liu Bo wrote: > Here we have defined two flags, > - Fautly > - In_sync > > Currently only In_sync is in use, it only matters when device serves > as part of a raid profile. The flag In_sync is decided when mounting > a btrfs and opening a device, by

Re: [PATCH 2/2] Btrfs: fix reported number of inode blocks after buffered append writes

2017-11-06 Thread David Sterba
On Tue, Oct 31, 2017 at 06:56:12PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > The patch from commit 7e3b975a0f92 ("Btrfs: fix reported number of inode The commit id should be a7e3b975a0f9, looks like a typo, missing 'a' at the beginning. > blocks")

Re: [PATCH 1/2] Btrfs: use cached state when dirtying pages during buffered write

2017-11-06 Thread David Sterba
On Tue, Oct 31, 2017 at 06:55:40PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > During a buffered IO write, we can have an extent state that we got when > we locked the range (if the range starts at an offset lower than eof), so > always pass it to

Re: [PATCH 3/3] btrfs: Cleanup existing name_len checks

2017-11-06 Thread Nikolay Borisov
On 6.11.2017 11:20, Qu Wenruo wrote: > Since tree-checker has verified leaf when reading from disk, we don't > need the existing verify_dir_item() or btrfs_is_name_len_valid(). > > Signed-off-by: Qu Wenruo Reviewed-by: Nikolay Borisov > --- > Unlike checks

Re: [PATCH 2/3] btrfs: tree-checker: Add checker for dir item

2017-11-06 Thread Nikolay Borisov
On 6.11.2017 11:20, Qu Wenruo wrote: > Add checker for dir item, for key types DIR_ITEM, DIR_INDEX and > XATTR_ITEM. > > This checker does comprehensive check for: > 1) dir_item header and its data size >Against item boundary and maximum name/xattr length. >This part is mostly the same

Re: [PATCH v2] btrfs: cleanup btrfs_async_submit_limit to return the final limit value

2017-11-06 Thread David Sterba
On Thu, Nov 02, 2017 at 02:03:53PM +0800, Anand Jain wrote: > We feedback IO progress when it falls below 2/3 times of the limit > obtained from btrfs_async_submit_limit(), and creates a wait for the > write process and makes progress during the async submission. > > In general device/transport q

Re: [PATCH v2] btrfs: cleanup btrfs_async_submit_limit to return the final limit value

2017-11-06 Thread David Sterba
On Thu, Nov 02, 2017 at 02:03:53PM +0800, Anand Jain wrote: > We feedback IO progress when it falls below 2/3 times of the limit > obtained from btrfs_async_submit_limit(), and creates a wait for the > write process and makes progress during the async submission. > > In general device/transport q

Re: [PATCH] btrfs: Don't generate UUID for non-fs tree

2017-11-06 Thread David Sterba
On Tue, Oct 31, 2017 at 02:08:16PM +0800, Qu Wenruo wrote: > btrfs_create_tree() will unconditionally generate UUID for any root. > So for quota tree and data reloc tree created by kernel, they will have > unique UUIDs. > > However UUID in root item is only referred by UUID tree, which only >

Re: [PATCH] btrfs: move volume_mutex into the btrfs_rm_device()

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 10:28:00AM +0800, Anand Jain wrote: > A cleanup patch no functional change, we hold volume_mutex before > calling btrfs_rm_device, so move it into the function itself. > > Signed-off-by: Anand Jain > --- > David, This patch is based on your

Re: [PATCH 06/11] btrfs: document device locking

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 05:02:21PM +0200, Nikolay Borisov wrote: > Right, I did a fresh read and indeed the structure now makes sense. I > have completely missed the nesting though. Maybe you can nest more > agressively, now every sentence is aligned to the header, perhaps we > want to have it one

Re: [PATCH] btrfs/volumes: Improve unlocking of a mutex in __btrfs_balance()

2017-11-06 Thread SF Markus Elfring
>> @@ -3682,7 +3678,7 @@ static int __btrfs_balance(struct btrfs_fs_info >> *fs_info) >> counting = false; >> goto again; >> } >> -error: >> +free_path: >> btrfs_free_path(path); >> if (enospc_errors) { >> btrfs_info(fs_info, "%d enospc errors

Re: [PATCH 06/11] btrfs: document device locking

2017-11-06 Thread Nikolay Borisov
On 6.11.2017 15:51, David Sterba wrote: > On Thu, Nov 02, 2017 at 12:29:17PM +0200, Nikolay Borisov wrote: >> On 31.10.2017 19:44, David Sterba wrote: >>> Overview of the main locks protecting various device-related structures. >>> >>> Signed-off-by: David Sterba >>> --- >>>

Re: [PATCH] btrfs-progs: docs: correct grammar

2017-11-06 Thread David Sterba
On Sun, Nov 05, 2017 at 10:49:57PM -0800, Benjamin Peterson wrote: > Signed-off-by: Benjamin Peterson Applied, thanks. -- 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] btrfs/volumes: Improve unlocking of a mutex in __btrfs_balance()

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 09:04:37AM +0100, SF Markus Elfring wrote: > > * Adjust jump targets so that a call of the function "mutex_unlock" > can be better reused for error cases at the end of this function. > > * Replace three calls by goto statements. > > This issue was detected by using the

Re: [PATCH 11/11] btrfs: use non-RCU list traversal in write_all_supers callees

2017-11-06 Thread David Sterba
On Thu, Nov 02, 2017 at 11:49:15AM +0200, Nikolay Borisov wrote: > > > On 31.10.2017 19:44, David Sterba wrote: > > We take the fs_devices::device_list_mutex mutex in write_all_supers > > which will prevent any add/del changes to the device list. Therefore we > > don't need to use the RCU

Re: [PATCH 06/11] btrfs: document device locking

2017-11-06 Thread David Sterba
On Thu, Nov 02, 2017 at 12:29:17PM +0200, Nikolay Borisov wrote: > On 31.10.2017 19:44, David Sterba wrote: > > Overview of the main locks protecting various device-related structures. > > > > Signed-off-by: David Sterba > > --- > > fs/btrfs/volumes.c | 66 > >

Re: updatedb does not index /home when /home is Btrfs

2017-11-06 Thread Austin S. Hemmelgarn
On 2017-11-05 03:01, Andrei Borzenkov wrote: 04.11.2017 21:55, Chris Murphy пишет: On Sat, Nov 4, 2017 at 12:27 PM, Andrei Borzenkov wrote: 04.11.2017 10:05, Adam Borowski пишет: On Sat, Nov 04, 2017 at 09:26:36AM +0300, Andrei Borzenkov wrote: 04.11.2017 07:49, Adam

Re: [PATCH 06/11] btrfs: document device locking

2017-11-06 Thread David Sterba
On Mon, Nov 06, 2017 at 10:32:48AM +0800, Anand Jain wrote: > >> + * Lock nesting > >> + * > >> + * > >> + * uuid_mutex > >> + * volume_mutex > > I think it should be nested like this, but as of now its not. Ref [1] > [1] > btrfs: move volume_mutex into the btrfs_rm_device()

Re: [PATCH 06/11] btrfs: document device locking

2017-11-06 Thread David Sterba
On Fri, Nov 03, 2017 at 07:13:01PM +0800, Anand Jain wrote: > > > Thanks for writing this. > > > + * - fs_devices::device_list_mutex (per-fs, with RCU) > > + * > > + * protects updates to fs_devices::devices, ie. adding and deleting > > + * > > + * simple list traversal with read-only

Re: Problem with file system

2017-11-06 Thread Austin S. Hemmelgarn
On 2017-11-04 13:14, Chris Murphy wrote: On Fri, Nov 3, 2017 at 10:46 PM, Adam Borowski wrote: On Fri, Nov 03, 2017 at 04:03:44PM -0600, Chris Murphy wrote: On Tue, Oct 31, 2017 at 5:28 AM, Austin S. Hemmelgarn wrote: If you're running on an SSD

Re: [PATCH 01/11] btrfs: add missing device::flush_bio puts

2017-11-06 Thread David Sterba
On Thu, Nov 02, 2017 at 11:41:44AM +0200, Nikolay Borisov wrote: > > > On 31.10.2017 19:44, David Sterba wrote: > > This fixes potential bio leaks, in several error paths. Unfortunatelly > > the device structure freeing is opencoded in many places and I missed > > them when introducing the

Re: [PATCH] btrfs: move volume_mutex into the btrfs_rm_device()

2017-11-06 Thread Nikolay Borisov
On 6.11.2017 04:28, Anand Jain wrote: > A cleanup patch no functional change, we hold volume_mutex before > calling btrfs_rm_device, so move it into the function itself. > > Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov > --- > David, This

Re: [PATCH 1/2] btrfs: Fix wild memory access in compression level parser

2017-11-06 Thread Lu Fengqi
On Mon, Nov 06, 2017 at 10:43:18AM +0800, Qu Wenruo wrote: >[BUG] >Kernel panic when mounting with "-o compress" mount option. >KASAN will report like: >-- >== >BUG: KASAN: wild-memory-access in strncmp+0x31/0xc0 >Read of size 1

unable to handle kernel NULL pointer dereference

2017-11-06 Thread Benedikt Schindler
Hello, i updated our server from kernel 4.7.4 to 4.13.11 . We have two connected btrfs devcies: a) a connected hardware raid5 in the machine (/dev/sdb1) b) a IBM Storewize v3700 connected via iSCSI (/dev/mapper/36005076300808b95c803-part1) After restarting the server, the samba

[PATCH 3/3] btrfs: Cleanup existing name_len checks

2017-11-06 Thread Qu Wenruo
Since tree-checker has verified leaf when reading from disk, we don't need the existing verify_dir_item() or btrfs_is_name_len_valid(). Signed-off-by: Qu Wenruo --- Unlike checks in btrfs_mark_buffer_dirty(), the existing checks all happen in read routine, so there is no need to

[PATCH 0/3] tree-checker bug fix and enhancement.

2017-11-06 Thread Qu Wenruo
This patchset fix a false panic introduced by tree-checker, and then introduce dir_item checker, along with cleanups to remove existing checkers sparsed in dir-item. The 1st patch is a fix to address kernel panic with sanity test in btrfs. The cause is there are several callers which call

[PATCH 1/3] btrfs: tree-checker: Fix false panic for sanity test

2017-11-06 Thread Qu Wenruo
[BUG] If we run btrfs with CONFIG_BTRFS_FS_RUN_SANITY_TESTS=y, it will instantly cause kernel panic like: -- ... assertion failed: 0, file: fs/btrfs/disk-io.c, line: 3853 ... Call Trace: btrfs_mark_buffer_dirty+0x187/0x1f0 [btrfs] setup_items_for_insert+0x385/0x650 [btrfs]

[PATCH 2/3] btrfs: tree-checker: Add checker for dir item

2017-11-06 Thread Qu Wenruo
Add checker for dir item, for key types DIR_ITEM, DIR_INDEX and XATTR_ITEM. This checker does comprehensive check for: 1) dir_item header and its data size Against item boundary and maximum name/xattr length. This part is mostly the same as old verify_dir_item(). 2) dir_type Against

[PATCH 1/7] btrfs: optimize use of volume_mutex in btrfs_ioctl_resize()

2017-11-06 Thread Anand Jain
We can push volume_mutex lock further down after the memory operation. Signed-off-by: Anand Jain --- fs/btrfs/ioctl.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index

[PATCH 2/7] btrfs: move user provided string checks outside of volume_mutex

2017-11-06 Thread Anand Jain
Do string check for the device's new size before volume_mutex is held. Signed-off-by: Anand Jain --- fs/btrfs/ioctl.c | 37 +++-- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index

[PATCH 3/7] btrfs: use i_size_read() instead of open code

2017-11-06 Thread Anand Jain
As i_size_read() takes care of 32bit smp or preempt cases as well. Signed-off-by: Anand Jain --- fs/btrfs/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index b0465020972a..86e7f5abd740 100644 ---

[PATCH 4/7] btrfs: rename btrfs_add_device to btrfs_add_dev_item

2017-11-06 Thread Anand Jain
Function btrfs_add_device() is about adding the device item so rename to reflect that in the function. Similarly we have btrfs_rm_dev_item(). Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git

[PATCH 6/7] btrfs: move volume_mutex into btrfs_init_new_device()

2017-11-06 Thread Anand Jain
By moving the volume_mutex into btrfs_init_new_device() it will be much closer to the items to be protected. Signed-off-by: Anand Jain --- fs/btrfs/ioctl.c | 2 -- fs/btrfs/volumes.c | 10 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git

[PATCH 7/7] btrfs: rename btrfs_init_new_device() to btrfs_add_device()

2017-11-06 Thread Anand Jain
No functional changes this patch renames btrfs_init_new_device() to btrfs_add_device(), so that it matches to the btrfs_rm_device() naming. And further it will help to further cleanup device init part from btrfs_add_device() and btrfs_init_dev_replace(). Signed-off-by: Anand Jain

[PATCH 5/7] btrfs: btrfs_rm_device() does not need uuid_mutex

2017-11-06 Thread Anand Jain
Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 4 1 file changed, 4 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 2329f429ce40..3d5ed4518f20 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -1914,7 +1914,6 @@ int

[PATCH 0/8] Misc device cleanup patches: part1

2017-11-06 Thread Anand Jain
A miscellaneous device management related cleanup patches. The core objective of this and upcoming patches is to able to have a clear clarity on mutex usages and remove redundant codes. And few good to have fixes. Anand Jain (7): btrfs: optimize use of volume_mutex in btrfs_ioctl_resize()

[PATCH] btrfs/volumes: Improve unlocking of a mutex in __btrfs_balance()

2017-11-06 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 5 Nov 2017 22:03:22 +0100 * Adjust jump targets so that a call of the function "mutex_unlock" can be better reused for error cases at the end of this function. * Replace three calls by goto statements. This issue was detected by