Re: [PATCH] Btrfs-progs: fix race condition between btrfs and udev

2014-06-11 Thread Anand Jain
Wang, Futher, a easy way to trigger this problem is by running the following c codes repeatedly: int main(int argc, char **argv) { /* pass a btrfs block device */ int fd = open(argv[1], O_RDWR | O_EXCL); if (fd < 0) { perror("fail to open: %s", strer

[PATCH 1/1] btrfs: looping 'mkfs.btrfs -f ' may fail with EBUSY

2014-06-11 Thread Anand Jain
The thread holding the O_EXCL flag seems to be BTRFS_IOC_SCAN_DEV ioctl, which in turn calls btrfs_scan_one_device() to open dev with the O_EXCL flag. But btrfs_scan_one_device() does not write anything to the disk. and it is called by . An intermediary step (not the final open_ctree) in the

[PATCH] btrfs: fix error handling in create_pending_snapshot

2014-06-11 Thread Eric Sandeen
fcebe456 cut and pasted some code to a later point in create_pending_snapshot(), but didn't switch to the appropriate error handling for this stage of the function. Signed-off-by: Eric Sandeen --- I think this is right. Josef, please double check me :) diff --git a/fs/btrfs/transaction.c b/fs/

[PATCH] btrfs: fix use of uninit "ret" in end_extent_writepage()

2014-06-11 Thread Eric Sandeen
If this condition in end_extent_writepage() is false: if (tree->ops && tree->ops->writepage_end_io_hook) we will then test an uninitialized "ret" at: ret = ret < 0 ? ret : -EIO; The test for ret is for the case where ->writepage_end_io_hook failed, and we'd choose that ret as th

[PATCH] btrfs: free ulist in qgroup_shared_accounting() error path

2014-06-11 Thread Eric Sandeen
If tmp = ulist_alloc(GFP_NOFS) fails, we return without freeing the previously allocated qgroups = ulist_alloc(GFP_NOFS) and cause a memory leak. Signed-off-by: Eric Sandeen --- diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index cf5aead..98cb6b2 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrf

Re: Slow startup of systemd-journal on BTRFS

2014-06-11 Thread Duncan
Russell Coker posted on Thu, 12 Jun 2014 11:18:37 +1000 as excerpted: > On Wed, 11 Jun 2014 23:28:54 Goffredo Baroncelli wrote: >> https://bugzilla.redhat.com/show_bug.cgi?id=1006386 >> >> suggested me that the problem could be due to a bad interaction between >> systemd and btrfs. Networ

Re: Slow startup of systemd-journal on BTRFS

2014-06-11 Thread Chris Murphy
On Jun 11, 2014, at 7:21 PM, Dave Chinner wrote: > On Wed, Jun 11, 2014 at 11:28:54PM +0200, Goffredo Baroncelli wrote: >> Hi all, >> >> I would like to share a my experience about a slowness of systemd when used >> on BTRFS. >> >> My boot time was very high (about ~50 seconds); most of time i

[PATCH 3/3] btrfs-progs: cleanup unused assignment for chunk-recover

2014-06-11 Thread Gui Hecheng
The 'num_unordered' will be recounted after 'goto out', just remove it. Signed-off-by: Gui Hecheng --- chunk-recover.c | 1 - 1 file changed, 1 deletion(-) diff --git a/chunk-recover.c b/chunk-recover.c index d5a688e..8bc5bc3 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -1905,7 +1905,6

[PATCH 2/3] btrfs-progs: fix max mirror number error for chunk-recover

2014-06-11 Thread Gui Hecheng
When run chunk-recover on a health btrfs(data profile raid0, with plenty of data), the program has a chance to abort on the number of mirrors of an extent. According to the kernel code, the max mirror number of an extent is 3 not 2: ctree.h:BTRFS_MAX_MIRRORS 3

[PATCH 1/3] btrfs-progs: fix missing parity stripe for raid6 in chunk-recover

2014-06-11 Thread Gui Hecheng
When deal with the p & q stripes for data profile raid6, chunk-recover forgets to insert them into the chunk record. Just insert them back freely. Also wrap the inert procedure into a new function, fill_chunk_up. Signed-off-by: Gui Hecheng --- chunk-recover.c | 30 --

Re: Slow startup of systemd-journal on BTRFS

2014-06-11 Thread Dave Chinner
On Thu, Jun 12, 2014 at 11:21:04AM +1000, Dave Chinner wrote: > On Wed, Jun 11, 2014 at 11:28:54PM +0200, Goffredo Baroncelli wrote: > > Hi all, > > > > I would like to share a my experience about a slowness of systemd when used > > on BTRFS. > > > > My boot time was very high (about ~50 seconds

Re: Slow startup of systemd-journal on BTRFS

2014-06-11 Thread Dave Chinner
On Wed, Jun 11, 2014 at 11:28:54PM +0200, Goffredo Baroncelli wrote: > Hi all, > > I would like to share a my experience about a slowness of systemd when used > on BTRFS. > > My boot time was very high (about ~50 seconds); most of time it was due to > NetworkManager which took about 30-40 secon

Re: Slow startup of systemd-journal on BTRFS

2014-06-11 Thread Russell Coker
On Wed, 11 Jun 2014 23:28:54 Goffredo Baroncelli wrote: > https://bugzilla.redhat.com/show_bug.cgi?id=1006386 > > suggested me that the problem could be due to a bad interaction between > systemd and btrfs. NetworkManager was innocent. It seems that > systemd-journal create a very hight f

[PATCH v2] Btrfs: fix qgroups sanity test crash or hang

2014-06-11 Thread Filipe David Borba Manana
Often when running the qgroups sanity test, a crash or a hang happened. This is because the extent buffer the test uses for the root node doesn't have an header level explicitly set, making it have a random level value. This is a problem when it's not zero for the btrfs_search_slot() calls the test

Re: Slow startup of systemd-journal on BTRFS

2014-06-11 Thread Chris Murphy
On Jun 11, 2014, at 3:28 PM, Goffredo Baroncelli wrote: > > If someone is able to suggest me how FRAGMENT the log file, I can try to > collect more scientific data. So long as you're not using compression, filefrag will show you fragments of systemd-journald journals. I can vouch for the beha

Re: [PATCH] Btrfs: fix qgroups sanity test crash or hang

2014-06-11 Thread Chris Mason
On 06/11/2014 08:12 PM, Filipe David Borba Manana wrote: > Often when running the qgroups sanity test, a crash or a hang happened. > This is because the extent buffer the test uses for the root node doesn't > have an header level explicitly set, making it have a random level value. > This is a prob

Re: btrfs: hang on boot due to tests

2014-06-11 Thread Filipe David Manana
On Tue, Jun 10, 2014 at 12:14 PM, Ed Tomlinson wrote: > On Monday 09 June 2014 12:17:50 Sasha Levin wrote: >> On 06/09/2014 11:59 AM, Chris Mason wrote: >> > On 06/09/2014 11:16 AM, Sasha Levin wrote: >> >> > Hi all, >> >> > >> >> > It seems that some recent changes to btrfs tests make it hang dur

[PATCH] Btrfs: fix qgroups sanity test crash or hang

2014-06-11 Thread Filipe David Borba Manana
Often when running the qgroups sanity test, a crash or a hang happened. This is because the extent buffer the test uses for the root node doesn't have an header level explicitly set, making it have a random level value. This is a problem when it's not zero for the btrfs_search_slot() calls the test

[PATCH V2] btrfs-progs: add mount options to btrfs-mount.5

2014-06-11 Thread Eric Sandeen
This is a straight cut and paste from the util-linux mount manpage into btrfs-mount.5 It's pretty much impossible for util-linux to keep up with every filesystem out there, and Karel has more than once expressed a wish that mount options move into fs-specific manpages. So, here we go. The way bt

[PATCH] btrfs-progs: add mount options to btrfs-mount.5

2014-06-11 Thread Eric Sandeen
This is a straight cut and paste from the util-linux mount manpage into btrfs-mount.5 It's pretty much impossible for util-linux to keep up with every filesystem out there, and Karel has more than once expressed a wish that mount options move into fs-specific manpages. So, here we go. The way bt

Re: [PATCH] mount: add btrfs to mount.8

2014-06-11 Thread Eric Sandeen
On 6/7/14, 8:41 AM, Christoph Hellwig wrote: > On Fri, Jun 06, 2014 at 10:52:48AM -0500, Eric Sandeen wrote: >> On 6/6/14, 5:03 AM, Karel Zak wrote: >>> On Fri, Jun 06, 2014 at 11:44:28AM +0200, Karel Zak wrote: I personally have no problem to maintain information about arbitrary FS in

Slow startup of systemd-journal on BTRFS

2014-06-11 Thread Goffredo Baroncelli
Hi all, I would like to share a my experience about a slowness of systemd when used on BTRFS. My boot time was very high (about ~50 seconds); most of time it was due to NetworkManager which took about 30-40 seconds to start (this data came from "systemd-analyze plot"). I make several attempts

[GIT PULL] Btrfs for 3.16

2014-06-11 Thread Chris Mason
Hi Linus, Please pull my for-linus branch: git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git for-linus The biggest change here is Josef's rework of the btrfs quota accounting, which improves the in-memory tracking of delayed extent operations. I had been working on Btrfs stack

[PATCH] btrfs: prevent RCU warning when dereferencing radix tree slot

2014-06-11 Thread Sasha Levin
Mark the dereference as protected by lock. Not doing so triggers an RCU warning since the radix tree assumed that RCU is in use. Signed-off-by: Sasha Levin --- fs/btrfs/tests/btrfs-tests.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/bt

[PATCH 2/2] src/cloner: add CIFS_IOC_COPYCHUNK_FILE support

2014-06-11 Thread David Disseldorp
cifs.ko supports server-side copy offloads via CIFS_IOC_COPYCHUNK_FILE. In handling the ioctl, the request is split into a series of SMB2 FSCTL_SRV_COPYCHUNK wire requests, which may be handled by the SMB server as a local read/write, or COW clone as is the case for Samba with vfs_btrfs. Signed-of

[PATCH 1/2] src/cloner: check filesystem type

2014-06-11 Thread David Disseldorp
Limit clone requests to Btrfs only for the moment. Signed-off-by: David Disseldorp --- src/cloner.c | 47 +++ 1 file changed, 47 insertions(+) diff --git a/src/cloner.c b/src/cloner.c index ccc2354..6fb40fa 100644 --- a/src/cloner.c +++ b/src/cloner.c

[PATCH 0/2] xfstests: add cifs.ko server-side copy helper

2014-06-11 Thread David Disseldorp
In preparation for adding cifs.ko support to xfstests, this patch series extends the cloner binary to support SMB2 server-side copies via CIFS_IOC_COPYCHUNK_FILE, in addition to the existing Btrfs COW clone functionality. This could be split into a separate binary if deemed necessary, but given th

Re: [PATCH] Btrfs-progs: fix race condition between btrfs and udev

2014-06-11 Thread Tomasz Torcz
On Wed, Jun 11, 2014 at 08:11:38PM +0800, Wang Shilong wrote: > So the problem is RW opening would trigger udev event which will > call btrfs_scan_one_device(). In btrfs_scan_one_device(), it > would open the block device with EXCL flag..meanwhile if another > program try to open that device with O

[PATCH] Btrfs-progs: fix race condition between btrfs and udev

2014-06-11 Thread Wang Shilong
Originally this problem was reproduced by the following scripts: # dd if=/dev/zero of=data bs=1M count=50 # losetup /dev/loop1 data # i =1 # while [ 1 ] do mkfs.btrfs -fK /dev/loop1 >& /dev/null || exit 1 ((i++)) echo "loop $i" done Futher, a easy way to trigger

[RFC PATCH V2 1/8] Btrfs: subpagesize-blocksize: Get rid of whole page reads.

2014-06-11 Thread Chandan Rajendra
Based on original patch from Aneesh Kumar K.V bio_vec->{bv_offset, bv_len} cannot be relied upon by the end bio functions to track the file offset range operated on by the bio. Hence this patch adds two new members to 'struct btrfs_io_bio' to track the file offset range. This patch also brings b

[RFC PATCH V2 4/8] Btrfs: subpagesize-blocksize: Define extent_buffer_head.

2014-06-11 Thread Chandan Rajendra
From: Chandra Seetharaman In order to handle multiple extent buffers per page, first we need to create a way to handle all the extent buffers that are attached to a page. This patch creates a new data structure 'struct extent_buffer_head', and moves fields that are common to all extent buffers i

[RFC PATCH V2 8/8] Btrfs: subpagesize-blocksize: Compute and look up csums based on sectorsized blocks.

2014-06-11 Thread Chandan Rajendra
Checksums are applicable to sectorsize units. The current code uses bio->bv_len units to compute and look up checksums. This works on machines where sectorsize == PAGE_CACHE_SIZE. This patch makes the checksum computation and look up code to work with sectorsize units. Signed-off-by: Chandan Rajen

[RFC PATCH V2 6/8] Btrfs: subpagesize-blocksize: Write only dirty extent buffers belonging to a page

2014-06-11 Thread Chandan Rajendra
For the subpagesize-blocksize scenario, This patch adds the ability to write a single extent buffer to the disk. Signed-off-by: Chandan Rajendra --- fs/btrfs/disk-io.c | 20 ++-- fs/btrfs/extent_io.c | 277 ++- 2 files changed, 243 insertions(+)

[RFC PATCH V2 7/8] Btrfs: subpagesize-blocksize: Allow mounting filesystems where sectorsize != PAGE_SIZE

2014-06-11 Thread Chandan Rajendra
From: Chandra Seetharaman This patch allows mounting filesystems with blocksize smaller than the PAGE_SIZE. Signed-off-by: Chandra Seetharaman Signed-off-by: Chandan Rajendra --- fs/btrfs/disk-io.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.

[RFC PATCH V2 5/8] Btrfs: subpagesize-blocksize: Read tree blocks whose size is

2014-06-11 Thread Chandan Rajendra
In the case of subpagesize-blocksize, this patch makes it possible to read only a single metadata block from the disk instead of all the metadata blocks that map into a page. Signed-off-by: Chandan Rajendra --- fs/btrfs/disk-io.c | 45 - fs/btrfs/disk-io.h | 3 ++ fs/btrfs

[RFC PATCH V2 2/8] Btrfs: subpagesize-blocksize: Get rid of whole page writes.

2014-06-11 Thread Chandan Rajendra
This commit brings back functions that set/clear EXTENT_WRITEBACK bits. These are required to reliably clear PG_writeback page flag. Signed-off-by: Chandan Rajendra --- fs/btrfs/extent_io.c | 147 +++ fs/btrfs/extent_io.h | 2 +- fs/btrfs/inode.c

[RFC PATCH V2 0/8] Btrfs: Subpagesize-blocksize: Get rid of whole page I/O

2014-06-11 Thread Chandan Rajendra
This patchset continues with the work posted earlier at https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg34036.html. Changes from V1: 1. Remove usage of bio_vec->bv_{len,offset} in end_bio_extent_readpage() and end_bio_extent_writepage(). Xfstests' generic tests were run on an x86_6

[RFC PATCH V2 3/8] Btrfs: subpagesize-blocksize: __btrfs_buffered_write: Reserve/release extents aligned to block size.

2014-06-11 Thread Chandan Rajendra
Currently, the code reserves/releases extents in multiples of PAGE_CACHE_SIZE units. Fix this. Signed-off-by: Chandan Rajendra --- fs/btrfs/file.c | 32 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 006af2