Re: [PATCH 1/6] Btrfs: fix deadlock in btrfs_commit_transaction

2010-10-26 Thread liubo
On 10/26/2010 03:07 AM, Sage Weil wrote: We calculate timeout (either 1 or MAX_SCHEDULE_TIMEOUT) based on whether num_writers 1 or should_grow at the top of the loop. Then, much much later, we wait for that timeout if either num_writers or should_grow is true. However, it's possible for a

some issues with lots of snapshots

2010-10-26 Thread Xavier Nicollet
I can't reproduce this right know, but it seems that creating lots of snapshots, one per minute (keeping only a dozens of them) may block the system. Every btrfs snap processes stay idle and the load skyrockets to 900. I use an old version: 2.6.34.5 kernel, and the system is still very responsive

[patch v3 3/4] Add an option to show ISO, binary or raw bytes counts using show.

2010-10-26 Thread Hugo Mills
Change btrfs filesystem show to allow the user to control the scales used for sizes in the output. Signed-off-by: Hugo Mills h...@carfax.org.uk --- btrfs.c|2 +- btrfs_cmds.c | 45 ++--- man/btrfs.8.in | 15 ++- 3 files

[patch v3 1/4] Update pretty-printer for different systems of counting multiples.

2010-10-26 Thread Hugo Mills
Make the pretty-printer for data sizes capable of printing in ISO (powers of 10^3), binary (powers of 2^10) or raw (a simple byte count). Signed-off-by: Hugo Mills h...@carfax.org.uk --- btrfs-show.c |7 --- btrfs_cmds.c | 13 - mkfs.c |3 ++- utils.c | 48

[patch v3 0/4] Size reporting of btrfs tool

2010-10-26 Thread Hugo Mills
While playing around with resizing volumes recently, I realised that I didn't know whether btrfs fi show and btrfs fi df reported sizes in ISO (e.g. powers of 10^3) units, as they appear to from the labels they use, or in binary (powers of 2^10) units. Also, a mere three significant figures is

[patch v3 4/4] Add an option to show ISO, binary or raw bytes counts using btrfs-show.

2010-10-26 Thread Hugo Mills
Change btrfs-show to allow the user to control the scales used for sizes in the output. Signed-off-by: Hugo Mills h...@carfax.org.uk --- btrfs-show.c| 27 +++ man/btrfs-show.8.in | 10 -- 2 files changed, 27 insertions(+), 10 deletions(-) Index:

Re: [PATCH 1/6] Btrfs: fix deadlock in btrfs_commit_transaction

2010-10-26 Thread Sage Weil
On Tue, 26 Oct 2010, liubo wrote: On 10/26/2010 03:07 AM, Sage Weil wrote: We calculate timeout (either 1 or MAX_SCHEDULE_TIMEOUT) based on whether num_writers 1 or should_grow at the top of the loop. Then, much much later, we wait for that timeout if either num_writers or should_grow is

[PATCH] Btrfs: set trans to null in reserve_metadata_bytes if we commit the transaction

2010-10-26 Thread Josef Bacik
btrfs_commit_transaction will free our trans, but because we pass trans to shrink_delalloc we could possibly have a use after free situation. So instead if we commit the transaction, set trans to null and set committed to true so we don't keep trying to commit a transaction. This fixes a panic I

Re: [PATCH 1/6] Btrfs: fix deadlock in btrfs_commit_transaction

2010-10-26 Thread Chris Mason
On Tue, Oct 26, 2010 at 09:36:26AM -0700, Sage Weil wrote: On Tue, 26 Oct 2010, liubo wrote: Since wake_up() itself provides a implied wmb, and a wq active check, it is better to drop if (wq) in __btrfs_end_transaction(). I see. It could also be smb_mb(); if (wq)

Re: Mark btrfsctl deprecated

2010-10-26 Thread Goffredo Baroncelli
On Monday, 25 October, 2010, David Nicol wrote: I am certainly not in a position to answer for Chris Mason, but I am happy to share my response to the question, coming from a perspective of being somewhat obsessive about not breaking back-compat. I agree with this sentence; in fact I suggested

Re: [PATCH] Btrfs: allow subvol deletion by unprivileged user with -o user_subvol_rm_allowed

2010-10-26 Thread Goffredo Baroncelli
Hi sage, On Monday, 25 October, 2010, Sage Weil wrote: Add a mount option user_subvol_rm_allowed that allows users to delete a (potentially non-empty!) subvol when they would otherwise we allowed to do an rmdir(2). We duplicate the may_delete() checks from the core VFS code to implement

Re: [PATCH] Btrfs: allow subvol deletion by unprivileged user with -o user_subvol_rm_allowed

2010-10-26 Thread Sage Weil
On Tue, 26 Oct 2010, Goffredo Baroncelli wrote: inode = dentry-d_inode; + dest = BTRFS_I(inode)-root; + if (!capable(CAP_SYS_ADMIN)){ + /* +* Regular user. Only allow this with a special mount +* option, and when rmdir(2) would have been

[PATCH v2] Btrfs: fix deadlock in btrfs_commit_transaction

2010-10-26 Thread Sage Weil
We calculate timeout (either 1 or MAX_SCHEDULE_TIMEOUT) based on whether num_writers 1 or should_grow at the top of the loop. Then, much much later, we wait for that timeout if either num_writers or should_grow is true. However, it's possible for a racing process (calling

[PATCH v2] Btrfs: allow subvol deletion by unprivileged user with -o user_subvol_rm_allowed

2010-10-26 Thread Sage Weil
Add a mount option user_subvol_rm_allowed that allows users to delete a (potentially non-empty!) subvol when they would otherwise we allowed to do an rmdir(2). We duplicate the may_delete() checks from the core VFS code to implement identical security checks (minus the directory size check). We

Re: some issues with lots of snapshots

2010-10-26 Thread Pat Regan
On Tue, 26 Oct 2010 12:28:53 +0200 Xavier Nicollet nicol...@jeru.org wrote: I can't reproduce this right know, but it seems that creating lots of snapshots, one per minute (keeping only a dozens of them) may block the system. Every btrfs snap processes stay idle and the load skyrockets to

Re: Mark btrfsctl deprecated

2010-10-26 Thread Chris Mason
On Tue, Oct 26, 2010 at 07:32:14PM +0200, Goffredo Baroncelli wrote: The package btrfs-tools needs a lot of care: - the INSTALL file still reports that is not possible to remove a subvolume - a lot of program are not documented (what is the meaning of btrfs-zero-log ?) - btrfs dev scan and

Re: [PATCH 1/6] Btrfs: fix deadlock in btrfs_commit_transaction

2010-10-26 Thread liubo
On 10/27/2010 01:06 AM, Chris Mason wrote: On Tue, Oct 26, 2010 at 09:36:26AM -0700, Sage Weil wrote: On Tue, 26 Oct 2010, liubo wrote: Since wake_up() itself provides a implied wmb, and a wq active check, it is better to drop if (wq) in __btrfs_end_transaction(). I see. It could also be

Re: Replacing the top-level root

2010-10-26 Thread David Brown
On Mon, Oct 25, 2010 at 03:20:58PM -0500, C Anthony Risinger wrote: For example, right now extlinux support booting btrfs, but _only_ from the top-level root. if i just had a way to swap the top-level root with a different subvol, i could overcome several problems i have with users all at