[GIT PULL] Btrfs readdir fix for 4.15

2018-01-25 Thread David Sterba
Hi, please consider pulling the fix to 4.15. It's been reported recently that readdir can list stale entries under some conditions. As it is a user visible bug I'd like to get it fix despite we're in the late rc. Thanks. The following changes since commit ec35e48b286959991cdbb886f1bdeda4575c80b4:

Re: btrfs check: backref lost, mismatch with its hash -- can't repair

2018-01-25 Thread ^m'e
Here it is: --- # ./btrfs-debug-tree.static -t 257 /dev/sdb3 | grep -C 20 30039322 | tee /mnt/custom/rescue/btrfs-recovery/btrfs-debug.30039322.t257.log location key (30037910 INODE_ITEM 0) type DIR transid 136248 data_len 0 name_len 3

Re: btrfs check: backref lost, mismatch with its hash -- can't repair

2018-01-25 Thread Qu Wenruo
Confirmed same problem as previous root. So branch updated to fix the same problem for root 257. Please try and see if the following error message is gone: -- ERROR: root 257 DIR_ITEM[30039322 4007295565] couldn't find relative INODE_ITEM[0] namelen 0 filename filetype 0 ERROR: root 257 DIR

Re: btrfs check: backref lost, mismatch with its hash -- can't repair

2018-01-25 Thread ^m'e
No luck this time: # ./btrfs-corrupt-block.static -X /dev/sdb3 ERROR: Failed to unlink the old file "Manifest": No such file or directory extent buffer leak: start 4210688 len 16384 extent_io.c:607: free_extent_buffer_internal: BUG_ON `eb->flags & EXTENT_DIRTY` triggered, value 1 [0x416a32] [0x417

Re: btrfs check: backref lost, mismatch with its hash -- can't repair

2018-01-25 Thread Qu Wenruo
On 2018年01月25日 20:29, ^m'e wrote: > No luck this time: > > # ./btrfs-corrupt-block.static -X /dev/sdb3 > ERROR: Failed to unlink the old file "Manifest": No such file or directory > extent buffer leak: start 4210688 len 16384 > extent_io.c:607: free_extent_buffer_internal: BUG_ON `eb->flags & >

Re: bad key ordering - repairable?

2018-01-25 Thread Austin S. Hemmelgarn
On 2018-01-24 18:54, Chris Murphy wrote: On Wed, Jan 24, 2018 at 5:30 AM, Austin S. Hemmelgarn wrote: APFS is really vague on this front, it may be checksumming metadata, it's not checksumming data and with no option to. Apple proposes their branded storage devices do not return bogus data. OK

Re: btrfs check: backref lost, mismatch with its hash -- can't repair

2018-01-25 Thread ^m'e
Quite some progress, thanks :-) The check: --- # ./btrfs.static check --mode=lowmem /dev/sdb3 2>&1 | tee /mnt/custom/rescue/btrfs-recovery/btrfs-check.3.log checking extents checking free space cache checking fs roots ERROR: root 1385 INODE[30039323

Re: [PATCH 1/2] btrfs-progs: mkfs: Fix minimal device size calculation for new temporary chunk layout

2018-01-25 Thread David Sterba
On Wed, Jan 24, 2018 at 10:38:29AM +0800, Qu Wenruo wrote: > Commit 0b2161becf8e ("btrfs-progs: mkfs: Prevent temporary system chunk > to use space in reserved 1M range") changed the hard-coded temporary > chunk layout to avoid the first 1M. > > However this also affects btrfs_min_dev_size() which

Re: [PATCH v2] btrfs-progs: Remove unnecessary parameter for btrfs_add_block_group

2018-01-25 Thread David Sterba
On Wed, Jan 24, 2018 at 11:37:23AM +0200, Nikolay Borisov wrote: > > > On 24.01.2018 04:30, Qu Wenruo wrote: > > @chunk_objectid of btrfs_make_block_group() function is always fixed to > > BTRFS_FIRST_FREE_OBJECTID, so there is no need to pass it as parameter > > explicitly. > > > > Signed-off-b

[PATCH] Btrfs: fix unexpected cow in run_delalloc_nocow

2018-01-25 Thread Liu Bo
Fstests generic/475 provides a way to fail metadata reads while checking if checksum exists for the inode inside run_delalloc_nocow(), and csum_exist_in_range() interprets error (-EIO) as inode having checksum and makes its caller enters the cow path. In case of free space inode, this ends up with

[PATCH] Btrfs: fix deadlock in run_delalloc_nocow

2018-01-25 Thread Liu Bo
@cur_offset is not set back to what it should be (@cow_start) if btrfs_next_leaf() returns something wrong, and the range [cow_start, cur_offset) remains locked forever. cc: Signed-off-by: Liu Bo --- fs/btrfs/inode.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btr

[PATCH] Btrfs: enhance leak debug checker for extent state and extent buffer

2018-01-25 Thread Liu Bo
This prints out eb->bflags since it contains some useful information, e.g. whether eb is dirty. Signed-off-by: Liu Bo --- fs/btrfs/extent_io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 012d638..efe263f 100644 --- a/f

[PATCH] Btrfs: fix extent state leak from tree log

2018-01-25 Thread Liu Bo
It's possible that btrfs_sync_log() bails out after one of the two btrfs_write_marked_extents() which convert extent state's state bit into EXTENT_NEED_WAIT from EXTENT_DIRTY/EXTENT_NEW, however only EXTENT_DIRTY and EXTENT_NEW are searched by free_log_tree() so that those extent states with EXTENT

[PATCH] Btrfs: fix unexpected -EEXIST when creating new inode

2018-01-25 Thread Liu Bo
The highest objectid, which is assigned to new inode, is decided at the time of initializing fs roots. However, in cases where log replay gets processed, the btree which fs root owns might be changed, so we have to search it again for the highest objectid, otherwise creating new inode would end up

[PATCH] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly

2018-01-25 Thread Liu Bo
This regression is introduced in commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction"). There are two problems, a) it is ->destroy_inode() that does the final free on inode, not ->evict_inode(), b) clear_inode() must be called before ->evict_inode() returns. This could end up hit

[PATCH] Btrfs: fix use-after-free on root->orphan_block_rsv

2018-01-25 Thread Liu Bo
I got these from running generic/475, WARNING: CPU: 0 PID: 26384 at fs/btrfs/inode.c:3326 btrfs_orphan_commit_root+0x1ac/0x2b0 [btrfs] BUG: unable to handle kernel NULL pointer dereference at 0010 IP: btrfs_block_rsv_release+0x1c/0x70 [btrfs] Call Trace: btrfs_orphan_release_metadat

[PATCH] Btrfs: fix crash due to not cleaning up tree log block's dirty bits

2018-01-25 Thread Liu Bo
In cases that the whole fs flips into readonly status due to failures in critical sections, then log tree's blocks are still dirty, and this leads to a crash during umount time, the crash is about use-after-free, umount -> close_ctree -> stop workers -> iput(btree_inode) -> iput_fi

[PATCH] Btrfs: do not check inode's runtime flags under root->orphan_lock

2018-01-25 Thread Liu Bo
It's not necessary to hold ->orphan_lock when checking inode's runtime flags. Signed-off-by: Liu Bo --- fs/btrfs/inode.c | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b3fe0a8..1511db2 100644 --- a/fs/btrfs/ino

Re: btrfs check: backref lost, mismatch with its hash -- can't repair

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 00:40, ^m'e wrote: > Quite some progress, thanks :-) > > The check: > --- > # ./btrfs.static check --mode=lowmem /dev/sdb3 2>&1 | tee > /mnt/custom/rescue/btrfs-recovery/btrfs-check.3.log > checking extents > checking free space cac

[PATCH] Btrfs: delete dead code in btrfs_orphan_add()

2018-01-25 Thread Omar Sandoval
From: Omar Sandoval btrfs_orphan_add() has had this case commented out since it was first introduced in commit d68fc57b7e32 ("Btrfs: Metadata reservation for orphan inodes"). Most of the orphan cleanup code has been rewritten since then, so it's safe to say that this code isn't needed. Signed-of

[PATCH] btrfs: delete function btrfs_close_extra_devices()

2018-01-25 Thread Anand Jain
btrfs_close_extra_devices() is not exactly about just closing the opened devices, but its about free-ing the stale devices which may have scanned into the given fsid which is being mounted. The way it picks devices to be freeed is by going through the btrfs_fs_devices::dev_list and finding devices

[PATCH 2/6] btrfs-progs: Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK, since maybe in some situation we do not know root, but just know fs_info. Signed-off-by: Gu Jinxiang --- cmds-check.c | 4 ++-- ctree.c | 18 +- ctree.h | 3 +-

[PATCH 6/6] btrfs-progs: remove no longer be used btrfs_alloc_extent

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Function btrfs_alloc_extent is no longer be used. So let's remove it. Signed-off-by: Gu Jinxiang --- ctree.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/ctree.h b/ctree.h index c82e7547..34d2505e 100644 --- a/ctree.h +++ b/ctree.h @@ -2487,12 +2487,6 @@ struct extent_b

[PATCH 1/6] btrfs-progs: Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE, since maybe in some situation we do not know root, but just know fs_info. Signed-off-by: Gu Jinxiang --- cmds-check.c | 6 +++--- convert/source-ext2.c | 2 +- convert/sour

[PATCH 5/6] btrfs-progs: do clean up for redundancy value assignment

2018-01-25 Thread Gu Jinxiang
Although skinny_metadata's type is int, its value just can be 0/1. And if condition be true only when skinny_metadata equals 1, so in if's executive part, set skinny_metadata to 1 is redundancy. Remove it. Signed-off-by: Gu Jinxiang --- extent-tree.c | 1 - 1 file changed, 1 deletion(-) diff --

[PATCH 4/6] btrfs-progs: Use fs_info instead of root for BTRFS_MAX_XATTR_SIZE

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_MAX_XATTR_SIZE, since maybe in some situation we do not know root, but just know fs_info. Signed-off-by: Gu Jinxiang --- ctree.h| 2 +- dir-item.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-

[PATCH 3/6] btrfs-progs: Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE, since maybe in some situation we do not know root, but just know fs_info. Signed-off-by: Gu Jinxiang --- convert/source-ext2.c | 2 +- convert/source-reiserfs.c | 2 +- ctree.h

Re: [PATCH 1/6] btrfs-progs: Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 11:22, Gu Jinxiang wrote: > Do a cleanup. Also make it consistent with kernel. > Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE, since > maybe in some situation we do not know root, but just know fs_info. > > Signed-off-by: Gu Jinxiang > --- > cmds-check.c |

RE: [PATCH 1/6] btrfs-progs: Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE

2018-01-25 Thread Gu, Jinxiang
Hi, > -Original Message- > From: Qu Wenruo [mailto:quwenruo.bt...@gmx.com] > Sent: Friday, January 26, 2018 11:37 AM > To: Gu, Jinxiang/顾 金香 ; > linux-btrfs@vger.kernel.org > Subject: Re: [PATCH 1/6] btrfs-progs: Use fs_info instead of root for > BTRFS_LEAF_DATA_SIZE > > > > On 2018年01月

Re: [PATCH 2/6] btrfs-progs: Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 11:22, Gu Jinxiang wrote: > Do a cleanup. Also make it consistent with kernel. > Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK, since > maybe in some situation we do not know root, but just know fs_info. > > Signed-off-by: Gu Jinxiang > --- > cmds-check.c | 4 ++-- >

Re: [PATCH 1/6] btrfs-progs: Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 13:12, Gu, Jinxiang wrote: > Hi, > >> -Original Message- >> From: Qu Wenruo [mailto:quwenruo.bt...@gmx.com] >> Sent: Friday, January 26, 2018 11:37 AM >> To: Gu, Jinxiang/顾 金香 ; >> linux-btrfs@vger.kernel.org >> Subject: Re: [PATCH 1/6] btrfs-progs: Use fs_info instead of

Re: [PATCH 3/6] btrfs-progs: Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 11:22, Gu Jinxiang wrote: > Do a cleanup. Also make it consistent with kernel. > Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE, since > maybe in some situation we do not know root, but just know fs_info. > > Signed-off-by: Gu Jinxiang > --- > convert/source-ext2.c

Re: [PATCH 4/6] btrfs-progs: Use fs_info instead of root for BTRFS_MAX_XATTR_SIZE

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 11:22, Gu Jinxiang wrote: > Do a cleanup. Also make it consistent with kernel. > Use fs_info instead of root for BTRFS_MAX_XATTR_SIZE, since > maybe in some situation we do not know root, but just know fs_info. > > Signed-off-by: Gu Jinxiang > --- > ctree.h| 2 +- > dir-item

Re: [PATCH 6/6] btrfs-progs: remove no longer be used btrfs_alloc_extent

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 11:22, Gu Jinxiang wrote: > Do a cleanup. > Function btrfs_alloc_extent is no longer be used. > So let's remove it. > > Signed-off-by: Gu Jinxiang Reviewed-by: Qu Wenruo Thanks, Qu > --- > ctree.h | 6 -- > 1 file changed, 6 deletions(-) > > diff --git a/ctree.h b/ctree

RE: [PATCH 2/6] btrfs-progs: Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK

2018-01-25 Thread Gu, Jinxiang
Hi, > -Original Message- > From: Qu Wenruo [mailto:quwenruo.bt...@gmx.com] > Sent: Friday, January 26, 2018 1:16 PM > To: Gu, Jinxiang/顾 金香 ; > linux-btrfs@vger.kernel.org > Subject: Re: [PATCH 2/6] btrfs-progs: Use fs_info instead of root for > BTRFS_NODEPTRS_PER_BLOCK > > > > On 2018年

Re: [PATCH 5/6] btrfs-progs: do clean up for redundancy value assignment

2018-01-25 Thread Qu Wenruo
On 2018年01月26日 11:22, Gu Jinxiang wrote: > Although skinny_metadata's type is int, its value just can be 0/1. > And if condition be true only when skinny_metadata equals 1, > so in if's executive part, set skinny_metadata to 1 is redundancy. > Remove it. > > Signed-off-by: Gu Jinxiang Reviewed

Darlehen Geld für Einzelpersonen und Fachleute in weniger als 72 Stunden

2018-01-25 Thread Peter Schuster
Hallo, Sind Sie in einer schwierigen Situation, für die Sie sich für ein Darlehen suchen? Benötigen Sie eine Finanzierung, um eine Schuld zu begleichen oder eine Aktivität zu finanzieren? Haben Sie einen Verbraucherkredit, eine Hypothek, einen persönlichen Kredit, eine Hypothek, Investition Darleh

[PATCH v2 1/7] btrfs-progs: Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_LEAF_DATA_SIZE, since maybe in some situation we do not know root, but just know fs_info. Signed-off-by: Gu Jinxiang --- cmds-check.c | 6 +++--- convert/source-ext2.c | 2 +- convert/sour

[PATCH v2 2/7] btrfs-progs: Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK, since maybe in some situation we do not know root, but just know fs_info. Changelog: v2->v1: To be consistent with kernel, change macro to inline function. Signed-off-by: Gu Jinxiang ---

[PATCH v2 0/7] btrfs-progs: Do some clean up to be consistent

2018-01-25 Thread Gu Jinxiang
Patch 1~4 and 7: clean up use of btrfs_root. Patch 5: remove redundancy value assignment. Patch 6: remove no longer be used function define. Changelog: v2->v1: Patch 2,4: To be consistent with kernel, change macro to inline function. Patch 3: Change macro to inline function to be consisten

[PATCH v2 5/7] btrfs-progs: do clean up for redundancy value assignment

2018-01-25 Thread Gu Jinxiang
Although skinny_metadata's type is int, its value just can be 0/1. And if condition be true only when skinny_metadata equals 1, so in if's executive part, set skinny_metadata to 1 is redundancy. Remove it. Reviewed-by: Qu Wenruo Signed-off-by: Gu Jinxiang --- extent-tree.c | 1 - 1 file changed

[PATCH v2 3/7] btrfs-progs: Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_MAX_INLINE_DATA_SIZE, since maybe in some situation we do not know root, but just know fs_info. Changelog: v2->v1: Change macro to inline function to be consistent with kernel. And change the function body to

[PATCH v2 6/7] btrfs-progs: remove no longer be used btrfs_alloc_extent

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Function btrfs_alloc_extent is no longer be used. So let's remove it. Reviewed-by: Qu Wenruo Signed-off-by: Gu Jinxiang --- ctree.h | 6 -- 1 file changed, 6 deletions(-) diff --git a/ctree.h b/ctree.h index 679bbc91..41b14b57 100644 --- a/ctree.h +++ b/ctree.h @@ -2501,12 +2

[PATCH v2 7/7] btrfs-progs: Cleanup use of root in leaf_data_end

2018-01-25 Thread Gu Jinxiang
In function leaf_data_end, root is just used to get fs_info, so change the parameter of this function from btrfs_root to btrfs_fs_info. And also make it consistent with kernel. Signed-off-by: Gu Jinxiang --- ctree.c | 32 +--- 1 file changed, 17 insertions(+), 15 dele

[PATCH v2 4/7] btrfs-progs: Use fs_info instead of root for BTRFS_MAX_XATTR_SIZE

2018-01-25 Thread Gu Jinxiang
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_MAX_XATTR_SIZE, since maybe in some situation we do not know root, but just know fs_info. Changelog: v2->v1: To be consistent with kernel, change macro to inline function. Signed-off-by: Gu Jinxiang --- ctr