[PATCH] ARM: Don't oops when userspace executes kgdb break instructions.

2014-07-18 Thread Omar Sandoval
Don't break into kgdb when userspace executes the kernel break instructions (KGDB_BREAKINST and KGDB_COMPILED_BREAK). The kernel will oops in kgdb_handle_exception. Signed-off-by: Omar Sandoval osan...@osandov.com --- The following program will immediately cause a kernel oops: .globl _start

Re: [PATCH] ARM: Don't oops when userspace executes kgdb break instructions.

2014-07-19 Thread Omar Sandoval
On Fri, Jul 18, 2014 at 03:51:31PM -0700, Omar Sandoval wrote: Don't break into kgdb when userspace executes the kernel break instructions (KGDB_BREAKINST and KGDB_COMPILED_BREAK). The kernel will oops in kgdb_handle_exception. Signed-off-by: Omar Sandoval osan...@osandov.com

[PATCH] ARM/ARM64: don't enter kgdb when userspace executes a kgdb break instruction.

2014-07-30 Thread Omar Sandoval
or KGDB_COMPILED_BREAK on ARM, or brk #KGDB_{DYN,COMPILED}_DGB_BRK_IMM on ARM64. Signed-off-by: Omar Sandoval osan...@osandov.com --- The following program reproduces the fixed problem on ARM: .globl _start _start: udf #65006 @ KGDB_BREAKINST And on ARM64: .globl _start _start: brk #0x400

Re: [PATCH] ARM/ARM64: don't enter kgdb when userspace executes a kgdb break instruction.

2014-07-30 Thread Omar Sandoval
Hi, On Wed, Jul 30, 2014 at 12:24:14PM +0100, Will Deacon wrote: Whilst this sounds like a worrying problem, I've failed to reproduce it on arm64. Executing a brk instruction with either KGDB_DYN_DGB_BRK_IMM or KDBG_COMPILED_DBG_BRK_IMM immediates from userspace results in a SIGTRAP being

[PATCH] ARM: don't enter kgdb when userspace executes a kgdb break instruction.

2014-07-31 Thread Omar Sandoval
or KGDB_COMPILED_BREAK. Signed-off-by: Omar Sandoval osan...@osandov.com --- On a kernel running with kgdb enabled, this program reproduces the problem: .globl _start _start: udf #65006 @ KGDB_BREAKINST The same problem has been fixed in ARM64. arch/arm/kernel/kgdb.c | 4 1 file changed, 4

Re: [PATCH] ARM/ARM64: don't enter kgdb when userspace executes a kgdb break instruction.

2014-07-31 Thread Omar Sandoval
Hi, Will, On Thu, Jul 31, 2014 at 11:46:53AM +0100, Will Deacon wrote: I'll merge the arm64 diff I proposed. Could you repost the ARM part please? I've just reposted it, hopefully we can get that merged in soon as well. I think enabling and activating kgdb by default is a pretty crazy thing to

Re: [PATCH v4 RESEND] Move BTRFS RCU string to common library

2014-10-20 Thread Omar Sandoval
On Fri, Oct 03, 2014 at 10:12:38AM -0700, Omar Sandoval wrote: The RCU-friendly string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code and documents the existing API. Signed-off-by: Omar Sandoval osan

[PATCH] staging: bcm: sort.c: fix coding style

2014-09-06 Thread Omar Sandoval
Fix checkpatch.pl Alignment should match open parenthesis. Signed-off-by: Omar Sandoval osan...@osandov.com --- drivers/staging/bcm/sort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/bcm/sort.c b/drivers/staging/bcm/sort.c index d518c42..ca0b179 100644

[PATCH] net sched: text ematch: zero out ts_state before using it

2014-10-09 Thread Omar Sandoval
textsearch_find zeroes out the offset, but the control buffer (which may or may not matter in this case) needs to be zeroed out as well. Signed-off-by: Omar Sandoval osan...@osandov.com --- net/sched/em_text.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sched/em_text.c b/net/sched

Re: [PATCH] net sched: text ematch: zero out ts_state before using it

2014-10-09 Thread Omar Sandoval
On Thu, Oct 09, 2014 at 09:05:21AM -0700, Omar Sandoval wrote: textsearch_find zeroes out the offset, but the control buffer (which may or may not matter in this case) needs to be zeroed out as well. Signed-off-by: Omar Sandoval osan...@osandov.com --- net/sched/em_text.c | 2 ++ 1 file

[PATCH] textsearch: clarify how to clean up in doc

2014-10-09 Thread Omar Sandoval
textsearch_put() doesn't exist; this comment appears to be referring to textsearch_destroy(). Signed-off-by: Omar Sandoval osan...@osandov.com --- This patch applies to 3.17. There was a patch submitted previously which got rid of this documentation (https://lkml.org/lkml/2014/9/6/128

[PATCH v4 RESEND] Move BTRFS RCU string to common library

2014-10-03 Thread Omar Sandoval
The RCU-friendly string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code and documents the existing API. Signed-off-by: Omar Sandoval osan...@osandov.com Reviewed-by: Josh Triplett j...@joshtriplett.org Acked

Re: [PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-30 Thread Omar Sandoval
On Mon, Sep 29, 2014 at 11:49:54PM +0200, David Sterba wrote: On Mon, Sep 29, 2014 at 12:45:12PM -0700, Omar Sandoval wrote: @@ -639,8 +640,7 @@ static int send_header(struct send_ctx *sctx) - return write_buf(sctx-send_filp, hdr, sizeof(hdr

[PATCH v2 0/3] btrfs: fix several sparse warnings

2014-09-30 Thread Omar Sandoval
straightforward sparse warnings still remaining. Version 2 replaces an open-coded implementation of kernel_write in write_buf, doesn't touch unrelated style issues, and add's David's Reviewed-by. This patch series applies to 3.17-rc7. Omar Sandoval (3): btrfs: replace open-coded kernel_write btrfs: fix

[PATCH v2 1/3] btrfs: replace open-coded kernel_write

2014-09-30 Thread Omar Sandoval
write_buf used by btrfs send has what is more or less a reimplementation of kernel_write. This also gets rid of a sparse address space warning. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/send.c | 21 ++--- 1 file changed, 6 insertions(+), 15 deletions(-) diff

[PATCH v2 3/3] btrfs: fix sparse lock context warnings

2014-09-30 Thread Omar Sandoval
Fix several sparse warnings that can easily be addressed with context annotations. These annotations also provide some sort of documentation for the internal helper functions. Signed-off-by: Omar Sandoval osan...@osandov.com Reviewed-by: David Sterba dste...@suse.cz --- fs/btrfs/extent-tree.c

[PATCH v2 2/3] btrfs: fix sparse address space warnings

2014-09-30 Thread Omar Sandoval
Several casts of ioctl fields from userspace are missing the __user annotation. Signed-off-by: Omar Sandoval osan...@osandov.com Reviewed-by: David Sterba dste...@suse.cz --- fs/btrfs/ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs

[PATCH v2 1/2] Return a value from printk_ratelimited

2014-09-19 Thread Omar Sandoval
printk returns an integer; there's no reason for printk_ratelimited to swallow it. Signed-off-by: Omar Sandoval osan...@osandov.com --- include/linux/printk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index d78125f

[PATCH v2 2/2] Move BTRFS RCU string to common library

2014-09-19 Thread Omar Sandoval
The RCU-friendy string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code and documents the existing API. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/check-integrity.c | 6 +-- fs/btrfs/dev

[PATCH v2 0/2] Move BTRFS RCU string to common library

2014-09-19 Thread Omar Sandoval
on the return value from printk. The second patch actually moves the RCU string library. Version 2 passes on the return values from printk{,_ratelimited} and fixes some style issues. Omar Sandoval (2): Return a value from printk_ratelimited Move BTRFS RCU string to common library fs/btrfs

Re: [RFC PATCH 0/6] btrfs: implement swap file support

2014-11-18 Thread Omar Sandoval
e58c52e69a9aef07c0089f9ce552fca96d42bce9 Mon Sep 17 00:00:00 2001 Message-Id: e58c52e69a9aef07c0089f9ce552fca96d42bce9.1416380574.git.osan...@osandov.com From: Omar Sandoval osan...@osandov.com Date: Tue, 18 Nov 2014 22:42:10 -0800 Subject: [PATCH] swap: use direct_IO for swap_readpage Signed-off-by: Omar

Re: [PATCH v7] Move BTRFS RCU string to common library

2014-11-20 Thread Omar Sandoval
On Thu, Nov 13, 2014 at 02:18:21AM -0800, Omar Sandoval wrote: The RCU-friendly string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code and documents the existing API. Reviewed-by: Josh Triplett j

[PATCH v2 0/5] btrfs: implement swap file support

2014-11-21 Thread Omar Sandoval
. - Supporting COW swapfiles might also come with some weird edge cases? This functionality is tenuously tested in a virtual machine with some artificial workloads. Comment away. Omar Sandoval (5): direct-io: don't dirty ITER_BVEC pages on read nfs: don't dirty ITER_BVEC pages read through direct I/O

[PATCH v2 2/5] nfs: don't dirty ITER_BVEC pages read through direct I/O

2014-11-21 Thread Omar Sandoval
As with the generic blockdev code, kernel pages shouldn't be dirtied by the direct I/O path. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/nfs/direct.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 10bf072..a67fa2c

[PATCH v2 5/5] btrfs: enable swap file support

2014-11-21 Thread Omar Sandoval
Implement the swap file a_ops on btrfs. Activation simply checks for a usable swap file: it must be fully allocated (no holes), support direct I/O (so no compressed or inline extents) and should be nocow (I'm not sure about that last one). Signed-off-by: Omar Sandoval osan...@osandov.com --- fs

[PATCH v2 4/5] btrfs: don't allow -C or +c chattrs on a swap file

2014-11-21 Thread Omar Sandoval
swap_activate will check for a compressed or copy-on-write file; we shouldn't allow it to become either once it has already been activated. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/ioctl.c | 50 +++--- 1 file changed, 31 insertions

Re: [RFC PATCH 0/6] btrfs: implement swap file support

2014-11-21 Thread Omar Sandoval
On Fri, Nov 21, 2014 at 02:06:57AM -0800, Christoph Hellwig wrote: On Tue, Nov 18, 2014 at 11:22:35PM -0800, Omar Sandoval wrote: Here's a nice little bit of insanity I put together in that direction -- consider it a discussion point more than a patch. It does two things: - Uses

Re: [PATCH v2 0/5] btrfs: implement swap file support

2014-11-21 Thread Omar Sandoval
Sorry for the noise, looks like Christoph got back to me on the previous RFC just before I sent this out -- disregard this for now. -- Omar -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at

[PATCH v2 1/5] direct-io: don't dirty ITER_BVEC pages on read

2014-11-21 Thread Omar Sandoval
Reads through the iov_iter infrastructure for kernel pages shouldn't be dirtied by the direct I/O code. This is based on Dave Kleikamp's and Ming Lei's previously posted patches. Cc: Dave Kleikamp dave.kleik...@oracle.com Cc: Ming Lei ming@canonical.com Signed-off-by: Omar Sandoval osan

[PATCH v2 3/5] swap: use direct I/O for SWP_FILE swap_readpage

2014-11-21 Thread Omar Sandoval
-by: Omar Sandoval osan...@osandov.com --- mm/page_io.c | 32 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 955db8b..10715e0 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -283,8 +283,7 @@ int __swap_writepage(struct

Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-11-22 Thread Omar Sandoval
On Fri, Nov 21, 2014 at 07:00:45PM +0100, David Sterba wrote: + pr_err(BTRFS: swapfile has holes); + ret = -EINVAL; + goto out; + } + if (em-block_start == EXTENT_MAP_INLINE) { + pr_err(BTRFS:

Re: [PATCH v2 5/5] btrfs: enable swap file support

2014-11-24 Thread Omar Sandoval
On Sat, Nov 22, 2014 at 12:03:57PM -0800, Omar Sandoval wrote: On Fri, Nov 21, 2014 at 07:00:45PM +0100, David Sterba wrote: + ret = -EINVAL; + goto out; + } + if (test_bit(EXTENT_FLAG_COMPRESSED, em-flags)) { + pr_err

Re: [PATCH v2 0/5] btrfs: implement swap file support

2014-11-24 Thread Omar Sandoval
On Fri, Nov 21, 2014 at 02:19:14AM -0800, Christoph Hellwig wrote: On Fri, Nov 21, 2014 at 02:15:31AM -0800, Omar Sandoval wrote: Sorry for the noise, looks like Christoph got back to me on the previous RFC just before I sent this out -- disregard this for now. If the NFS people are fine

[PATCH] Move BTRFS RCU string to common library

2014-09-18 Thread Omar Sandoval
The RCU-friendy string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code and documents the existing API. Signed-off-by: Omar Sandoval osan...@osandov.com --- This patch applies to 3.17-rc5. fs/btrfs/check

[PATCH] staging: lustre: fix gfp_t/int coercion

2014-09-26 Thread Omar Sandoval
Fix a few implicit casts between int and gfp_t which were caught by sparse. Signed-off-by: Omar Sandoval osan...@osandov.com --- This patch applies to v3.17-rc6. drivers/staging/lustre/lustre/llite/lloop.c| 4 ++-- drivers/staging/lustre/lustre/ptlrpc/client.c | 2

[PATCH v3 1/2] Return a value from printk_ratelimited

2014-09-26 Thread Omar Sandoval
printk returns an integer; there's no reason for printk_ratelimited to swallow it. Signed-off-by: Omar Sandoval osan...@osandov.com Acked-by: Paul E. McKenney paul...@linux.vnet.ibm.com --- include/linux/printk.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include

[PATCH v3 0/2] Move BTRFS RCU string to common library

2014-09-26 Thread Omar Sandoval
string header and updates the BTRFS code that depends on it. Version 3 adds the __rcu annotation to the relevant functions. Version 3 also adds Paul's ack and Josh's review. Omar Sandoval (2): Return a value from printk_ratelimited Move BTRFS RCU string to common library fs/btrfs/check

[PATCH v3 2/2] Move BTRFS RCU string to common library

2014-09-26 Thread Omar Sandoval
The RCU-friendly string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code and documents the existing API. Signed-off-by: Omar Sandoval osan...@osandov.com Reviewed-by: Josh Triplett j...@joshtriplett.org Acked

Re: [PATCH v3 0/2] Move BTRFS RCU string to common library

2014-09-26 Thread Omar Sandoval
On Fri, Sep 26, 2014 at 10:36:47PM -0700, Omar Sandoval wrote: This patch series makes the generic RCU string library used internally by BTRFS accessible by anyone. The first patch makes printk_ratelimited pass on the return value from printk. Version 3 gives the temporary return variable

Re: [PATCH v3 1/2] Return a value from printk_ratelimited

2014-09-27 Thread Omar Sandoval
On Fri, Sep 26, 2014 at 10:48:11PM -0700, Joe Perches wrote: I'd prefer to keep it the way it is actually. I've submitted several patches to convert the int return to void for printk derived functions recently. Alright, it doesn't seem like anyone feels strongly for keeping the return

[PATCH] Move BTRFS RCU string to common library

2014-09-27 Thread Omar Sandoval
The RCU-friendly string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code and documents the existing API. Signed-off-by: Omar Sandoval osan...@osandov.com Reviewed-by: Josh Triplett j...@joshtriplett.org Acked

[PATCH 2/2] btrfs: fix sparse lock context warnings

2014-09-28 Thread Omar Sandoval
Fix several sparse warnings that can easily be addressed with context annotations. These annotations also provide some sort of documentation for the internal helper functions. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/ctree.c| 3 ++- fs/btrfs/extent-tree.c

[PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-28 Thread Omar Sandoval
The buffer passed to vfs_write in send and several casts of ioctl fields are missing the __user annotation. Also fixes a couple of related trivial style issues. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/ioctl.c | 6 +++--- fs/btrfs/send.c | 8 2 files changed, 7

[PATCH 0/2] btrfs: fix several sparse warnings

2014-09-28 Thread Omar Sandoval
straightforward sparse warnings still remaining. Omar Sandoval (2): btrfs: fix sparse address space warnings btrfs: fix sparse lock context warnings fs/btrfs/ctree.c| 3 ++- fs/btrfs/extent-tree.c | 1 + fs/btrfs/extent_io.c| 2 +- fs/btrfs/free-space-cache.c | 1 + fs/btrfs

Re: [PATCH 0/2] btrfs: fix several sparse warnings

2014-09-28 Thread Omar Sandoval
On Sun, Sep 28, 2014 at 01:48:10AM -0700, Omar Sandoval wrote: This patch series fixes some warnings reported by sparse when building the btrfs module. It fixes two classes of warnings: address space warnings and lock context warnings. This didn't uncover any logical errors, but it reduces

Re: [PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-28 Thread Omar Sandoval
On Sun, Sep 28, 2014 at 01:48:11AM -0700, Omar Sandoval wrote: diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 6528aa6..e0be577 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -515,7 +515,8 @@ static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off

Re: [PATCH 1/2] btrfs: fix sparse address space warnings

2014-09-29 Thread Omar Sandoval
On Mon, Sep 29, 2014 at 06:07:38PM +0200, David Sterba wrote: On Sun, Sep 28, 2014 at 01:48:11AM -0700, Omar Sandoval wrote: The buffer passed to vfs_write in send and several casts of ioctl fields are missing the __user annotation. Also fixes a couple of related trivial style issues

[PATCH v7] Move BTRFS RCU string to common library

2014-11-13 Thread Omar Sandoval
Signed-off-by: Omar Sandoval osan...@osandov.com --- Alright, here's one more go at it. v7: Add arguments to kernel doc for printk wrappers, use ##__VA_ARGS v6: Add header dependencies to rcustring.h v5: Rebase against v3.18-rc3 v4: Don't return anything from the printk wrappers on the assumption

Re: [RFC PATCH v3 7/7] btrfs: enable swap file support

2014-12-12 Thread Omar Sandoval
On Fri, Dec 12, 2014 at 11:51:22AM +0100, David Sterba wrote: On Tue, Dec 09, 2014 at 05:45:48PM -0800, Omar Sandoval wrote: +static void __clear_swapfile_extents(struct inode *inode) +{ + u64 isize = inode-i_size; + struct extent_map *em; + u64 start, len; + + start = 0

Re: [RFC PATCH v3 0/7] btrfs: implement swap file support

2014-12-12 Thread Omar Sandoval
On Fri, Dec 12, 2014 at 11:32:13AM +0100, David Sterba wrote: On Tue, Dec 09, 2014 at 05:45:41PM -0800, Omar Sandoval wrote: After some discussion on the mailing list, I decided that for simplicity and reliability, it's best to simply disallow COW files and files with shared extents (like

[PATCH 5/8] direct-io: don't dirty ITER_BVEC pages on read

2014-12-14 Thread Omar Sandoval
Reads through the iov_iter infrastructure for kernel pages shouldn't be dirtied by the direct I/O code. This is based on Dave Kleikamp's and Ming Lei's previously posted patches. Cc: Ming Lei ming@canonical.com Acked-by: Dave Kleikamp dave.kleik...@oracle.com Signed-off-by: Omar Sandoval

[PATCH 1/8] nfs: follow direct I/O write locking convention

2014-12-14 Thread Omar Sandoval
of direct_IO will expect to have it locked. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/nfs/direct.c | 12 +--- fs/nfs/file.c | 8 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 10bf072..9402b96 100644

[PATCH 0/8] clean up and generalize swap-over-NFS

2014-12-14 Thread Omar Sandoval
-readpage. Using readpage for a swapcache page requires all sorts of messy workarounds (see here for context: https://lkml.org/lkml/2014/11/19/46). Patch 8 updates the documentation accordingly. Thanks! Omar Sandoval (8): nfs: follow direct I/O write locking convention swap: lock i_mutex

[PATCH 2/8] swap: lock i_mutex for swap_writepage direct_IO

2014-12-14 Thread Omar Sandoval
The generic write code locks i_mutex for a direct_IO. Swap-over-NFS doesn't grab the mutex because nfs_direct_IO doesn't expect i_mutex to be held, but most direct_IO implementations do. Signed-off-by: Omar Sandoval osan...@osandov.com --- mm/page_io.c | 3 +++ 1 file changed, 3 insertions

[PATCH 6/8] nfs: don't dirty ITER_BVEC pages read through direct I/O

2014-12-14 Thread Omar Sandoval
As with the generic blockdev code, kernel pages shouldn't be dirtied by the direct I/O path. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/nfs/direct.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 9402b96..a502b3f

[PATCH 8/8] vfs: update swap_{,de}activate documentation

2014-12-14 Thread Omar Sandoval
Parameters were added to swap_activate in the same patch series that introduced it without updating the documentation. Additionally, the documentation claims that non-existent address space operations swap_{in,out} are used for swap I/O, but it's (now) direct_IO. Signed-off-by: Omar Sandoval osan

[PATCH 4/8] iov_iter: add iov_iter_bvec and convert callers

2014-12-14 Thread Omar Sandoval
Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/splice.c | 7 ++- include/linux/uio.h | 2 ++ mm/iov_iter.c | 12 mm/page_io.c| 14 +- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index

[PATCH 3/8] swap: don't add ITER_BVEC flag to direct_IO rw

2014-12-14 Thread Omar Sandoval
. This caters to the least common denominator and avoids a sweeping change of every direct_IO implementation for now. Signed-off-by: Omar Sandoval osan...@osandov.com --- mm/page_io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 1630ac0

[PATCH 7/8] swap: use direct I/O for SWP_FILE swap_readpage

2014-12-14 Thread Omar Sandoval
On Mon, Nov 17, 2014 at 07:48:17AM -0800, Christoph Hellwig wrote: With the new iov_iter infrastructure that supprots direct I/O to kernel pages please get rid of the -readpage hack first. I'm still utterly disapoined that this crap ever got merged. Signed-off-by: Omar Sandoval osan

[PATCH v5] Move BTRFS RCU string to common library

2014-11-07 Thread Omar Sandoval
Signed-off-by: Omar Sandoval osan...@osandov.com --- Chris, could you take a look at this again? It's just been rebased and should be good to go. Thanks! v5: Rebase against v3.18-rc3 v4: Don't return anything from the printk wrappers on the assumption that printk will return void someday v3: Add __rcu

[PATCH v6] Move BTRFS RCU string to common library

2014-11-08 Thread Omar Sandoval
Signed-off-by: Omar Sandoval osan...@osandov.com --- Chris, if you haven't pulled this in yet, Joe Perches pointed out that rcustring.h should include any headers it depends on. The following headers take care of it: #include linux/types.h #include linux/compiler.h #include linux/printk.h #include

Re: [PATCH v6] Move BTRFS RCU string to common library

2014-11-08 Thread Omar Sandoval
On Sat, Nov 08, 2014 at 08:13:37AM -0800, Joe Perches wrote: On Sat, 2014-11-08 at 00:46 -0800, Omar Sandoval wrote: The RCU-friendly string API used internally by BTRFS is generic enough for common use. This doesn't add any new functionality, but instead just moves the code

[RFC PATCH 0/6] btrfs: implement swap file support

2014-11-17 Thread Omar Sandoval
on compressed or inline extents. - Supporting COW swapfiles might come with some weird edge cases? This is something that is probably good for discussion. This functionality is tenuously tested in a virtual machine with some artificial workloads. I'd really appreciate any comments. Omar Sandoval (6

[RFC PATCH 6/6] btrfs: enable swap file support

2014-11-17 Thread Omar Sandoval
Implement the swap file a_ops on btrfs. Activation simply checks for a usable swap file: it must be fully allocated (no holes), support direct I/O (so no compressed or inline extents) and should be nocow (I'm not sure about that last one). Signed-off-by: Omar Sandoval osan...@osandov.com --- fs

[RFC PATCH 1/6] btrfs: convert uses of -mapping and -index to wrappers

2014-11-17 Thread Omar Sandoval
/compression.c does some shuffling around of the -mapping field directly. We can't have a compressed swap file anyways, so I didn't touch that file. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/disk-io.c| 16 +++--- fs/btrfs/extent_io.c | 137

[RFC PATCH 5/6] btrfs: don't mark extents used for swap as up to date

2014-11-17 Thread Omar Sandoval
As pages in the swapcache get shuffled around and repurposed for different pages in the swap file, the EXTENT_UPTODATE flag doesn't apply. This leads to some really weird symptoms in userspace where pages in a process's address space appear to get mixed up. Signed-off-by: Omar Sandoval osan

[RFC PATCH 2/6] btrfs: don't allow -C or +c chattrs on a swap file

2014-11-17 Thread Omar Sandoval
swap_activate will check for a compressed or copy-on-write file; we shouldn't allow it to become either once it has already been activated. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/ioctl.c | 50 +++--- 1 file changed, 31 insertions

[RFC PATCH 4/6] btrfs: don't check the cleancache for swapcache pages

2014-11-17 Thread Omar Sandoval
Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/extent_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 54b2d00..b8dc256 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2904,13 +2904,14

[RFC PATCH 3/6] btrfs: don't set -private on swapcache pages

2014-11-17 Thread Omar Sandoval
Swapcache pages use -private to store the swp_entry_t; overwriting it is sure to cause insanity. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/extent_io.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index

Re: [PATCH 2/8] swap: lock i_mutex for swap_writepage direct_IO

2014-12-18 Thread Omar Sandoval
On Wed, Dec 17, 2014 at 10:03:13PM +, Al Viro wrote: On Wed, Dec 17, 2014 at 10:52:56AM -0800, Christoph Hellwig wrote: On Wed, Dec 17, 2014 at 06:58:32AM -0800, Omar Sandoval wrote: See my previous message. If we use O_DIRECT on the original open, then filesystems that implement bmap

[PATCH] nfs: prevent truncate on active swapfile

2014-12-18 Thread Omar Sandoval
, and not doing so is dangerous. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/nfs/inode.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 4bffe63..9205513 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -506,10 +506,15

Re: [PATCH] nfs: prevent truncate on active swapfile

2014-12-18 Thread Omar Sandoval
On Thu, Dec 18, 2014 at 10:29:18PM -0800, Omar Sandoval wrote: Most filesystems prevent truncation of an active swapfile by way of inode_newsize_ok, called from inode_change_ok. NFS doesn't call either from nfs_setattr, presumably because most of these checks are expected to be done server

[PATCH v2 4/5] swapfile: use -read_iter and -write_iter

2014-12-19 Thread Omar Sandoval
/-write_iter with an ITER_BVEC and let the filesystem take care of it. This will also allow us to easily transition to kernel AIO if that gets merged in the future. Cc: Mel Gorman mgor...@suse.de Signed-off-by: Omar Sandoval osan...@osandov.com --- mm/page_io.c | 30 +++--- mm

[PATCH v2 5/5] vfs: update swap_{,de}activate documentation

2014-12-19 Thread Omar Sandoval
Parameters were added to swap_activate in the same patch series that introduced it without updating the documentation. Additionally, the documentation claims that non-existent address space operations -swap_{in,out} are used for swap I/O, but now we use -{read,write}_iter. Signed-off-by: Omar

[PATCH v2 3/5] nfs: don't dirty ITER_BVEC pages read through direct I/O

2014-12-19 Thread Omar Sandoval
As with the generic blockdev code, kernel pages shouldn't be dirtied by the direct I/O path. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/nfs/direct.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 10bf072..b6ca65c

[PATCH v2 2/5] direct-io: don't dirty ITER_BVEC pages on read

2014-12-19 Thread Omar Sandoval
Reads through the iov_iter infrastructure for kernel pages shouldn't be dirtied by the direct I/O code. This is based on Dave Kleikamp's and Ming Lei's previously posted patches. Cc: Ming Lei ming@canonical.com Acked-by: Dave Kleikamp dave.kleik...@oracle.com Signed-off-by: Omar Sandoval

[PATCH v2 0/5] clean up and generalize swap-over-NFS

2014-12-19 Thread Omar Sandoval
the generic swapfile interface to use -read_iter and -write_iter instead of using -direct_IO directly in response to discussion on the previous submission. It also adds the iov_iter_is_bvec helper to factor out some common checks. Version 1 can be found here: https://lkml.org/lkml/2014/12/15/7 Omar

[PATCH v2 1/5] iov_iter: add ITER_BVEC helpers

2014-12-19 Thread Omar Sandoval
Add iov_iter_is_bvec and iov_iter_bvec and convert callers. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/splice.c | 7 ++- include/linux/uio.h | 7 +++ mm/iov_iter.c | 12 mm/page_io.c| 14 +- 4 files changed, 26 insertions

Re: [PATCH v2 2/5] direct-io: don't dirty ITER_BVEC pages on read

2014-12-21 Thread Omar Sandoval
On Sat, Dec 20, 2014 at 06:01:30AM +, Al Viro wrote: On Fri, Dec 19, 2014 at 07:18:26PM -0800, Omar Sandoval wrote: Reads through the iov_iter infrastructure for kernel pages shouldn't be dirtied by the direct I/O code. This is based on Dave Kleikamp's and Ming Lei's previously

Re: [PATCH 2/8] swap: lock i_mutex for swap_writepage direct_IO

2014-12-21 Thread Omar Sandoval
On Sat, Dec 20, 2014 at 06:51:33AM +, Al Viro wrote: On Mon, Dec 15, 2014 at 08:56:15AM -0800, Christoph Hellwig wrote: On Mon, Dec 15, 2014 at 05:27:05PM +0100, Jan Kara wrote: On Sun 14-12-14 21:26:56, Omar Sandoval wrote: The generic write code locks i_mutex for a direct_IO. Swap

Re: [PATCH v2 4/5] swapfile: use -read_iter and -write_iter

2014-12-21 Thread Omar Sandoval
On Sat, Dec 20, 2014 at 06:13:37AM +, Al Viro wrote: On Fri, Dec 19, 2014 at 07:18:28PM -0800, Omar Sandoval wrote: + ret = swap_file-f_op-read_iter(kiocb, to); + if (ret == PAGE_SIZE) { + SetPageUptodate(page

Re: [PATCH 1/8] nfs: follow direct I/O write locking convention

2014-12-15 Thread Omar Sandoval
On Mon, Dec 15, 2014 at 07:49:20AM -0500, Trond Myklebust wrote: On Mon, Dec 15, 2014 at 12:26 AM, Omar Sandoval osan...@osandov.com wrote: The generic callers of direct_IO lock i_mutex before doing a write. NFS doesn't use the generic write code, so it doesn't follow this convention

Re: [PATCH 3/8] swap: don't add ITER_BVEC flag to direct_IO rw

2014-12-15 Thread Omar Sandoval
On Mon, Dec 15, 2014 at 06:16:02AM +, Al Viro wrote: On Sun, Dec 14, 2014 at 09:26:57PM -0800, Omar Sandoval wrote: The rw argument to direct_IO has some ill-defined semantics. Some filesystems (e.g., ext4, FAT) decide whether they're doing a write with rw == WRITE, but others (e.g

Re: [PATCH 2/8] swap: lock i_mutex for swap_writepage direct_IO

2014-12-15 Thread Omar Sandoval
On Mon, Dec 15, 2014 at 08:56:15AM -0800, Christoph Hellwig wrote: On Mon, Dec 15, 2014 at 05:27:05PM +0100, Jan Kara wrote: On Sun 14-12-14 21:26:56, Omar Sandoval wrote: The generic write code locks i_mutex for a direct_IO. Swap-over-NFS doesn't grab the mutex because nfs_direct_IO

Re: [PATCH 2/8] swap: lock i_mutex for swap_writepage direct_IO

2014-12-16 Thread Omar Sandoval
On Tue, Dec 16, 2014 at 12:35:43AM -0800, Christoph Hellwig wrote: On Mon, Dec 15, 2014 at 02:11:00PM -0800, Omar Sandoval wrote: Ok, I got the swap code working with -read_iter/-write_iter without too much trouble. I wanted to double check before I submit if there's any gotchas involved

Re: [PATCH 2/8] swap: lock i_mutex for swap_writepage direct_IO

2014-12-17 Thread Omar Sandoval
On Wed, Dec 17, 2014 at 12:24:37AM -0800, Christoph Hellwig wrote: On Wed, Dec 17, 2014 at 08:20:21AM +, Al Viro wrote: Where the hell would those other references come from? We open the damn thing in sys_swapon(), never put it into descriptor tables, etc. and the only reason why we

Re: [PATCH] net sched: text ematch: zero out ts_state before using it

2014-10-09 Thread Omar Sandoval
On Thu, Oct 09, 2014 at 02:48:54PM -0700, Cong Wang wrote: On Thu, Oct 9, 2014 at 9:05 AM, Omar Sandoval osan...@osandov.com wrote: textsearch_find zeroes out the offset, but the control buffer (which may or may not matter in this case) needs to be zeroed out as well. Why

[PATCH 0/3] btrfs: fix RCU string sparse noise

2014-11-30 Thread Omar Sandoval
use of RCU in the BTRFS_IOC_DEV_INFO ioctl. The third refactors the volume code's usage of rcu_string, fixing a questionable RCU or two in the process. This patch series applies to Chris' integration branch. Thanks! Omar Sandoval (3): rcustring: clean up botched __rcu annotations btrfs: fix

[PATCH 3/3] btrfs: refactor btrfs_device-name updates

2014-11-30 Thread Omar Sandoval
on. This introduces some helper functions that factor out this functionality. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/volumes.c | 93 +- fs/btrfs/volumes.h | 2 +- 2 files changed, 65 insertions(+), 30 deletions(-) diff --git a/fs/btrfs

[PATCH 1/3] rcustring: clean up botched __rcu annotations

2014-11-30 Thread Omar Sandoval
The rcu_string returned by rcu_string_strdup isn't technically under RCU yet, and it makes more sense not to treat it as such. Additionally, an rcu_string passed to rcu_string_free should already be rcu_dereferenced and therefore not in the __rcu address space. Signed-off-by: Omar Sandoval osan

[PATCH 2/3] btrfs: fix suspicious RCU in BTRFS_IOC_DEV_INFO

2014-11-30 Thread Omar Sandoval
A naked read of the value of an RCU pointer isn't safe. Put the whole access in an RCU critical section, not just the pointer dereference. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/ioctl.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs

Re: [PATCH 3/3] btrfs: refactor btrfs_device-name updates

2014-11-30 Thread Omar Sandoval
On Sun, Nov 30, 2014 at 10:26:43AM -0500, Pranith Kumar wrote: On Sun, Nov 30, 2014 at 3:26 AM, Omar Sandoval osan...@osandov.com wrote: The rcu_string API introduced some new sparse errors but also revealed existing ones. First of all, the name in struct btrfs_device should be annotated

Re: [PATCH 2/3] btrfs: fix suspicious RCU in BTRFS_IOC_DEV_INFO

2014-11-30 Thread Omar Sandoval
On Sun, Nov 30, 2014 at 10:11:41AM -0500, Pranith Kumar wrote: On Sun, Nov 30, 2014 at 3:26 AM, Omar Sandoval osan...@osandov.com wrote: A naked read of the value of an RCU pointer isn't safe. Put the whole access in an RCU critical section, not just the pointer dereference. Signed-off

[PATCH v8 0/3] Introduce RCU string API

2014-12-07 Thread Omar Sandoval
v5: Rebase against v3.18-rc3 v4: Don't return anything from the printk wrappers on the assumption that printk will return void someday v3: Add __rcu annotation to relevant functions, add Paul's ack and Josh's review Omar Sandoval (3): Move BTRFS RCU string to common library btrfs: refactor

[PATCH v8 2/3] btrfs: refactor btrfs_device-name updates

2014-12-07 Thread Omar Sandoval
on. This introduces some helper functions that factor out this functionality. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/volumes.c | 93 +- fs/btrfs/volumes.h | 2 +- 2 files changed, 65 insertions(+), 30 deletions(-) diff --git a/fs/btrfs

[PATCH v8 3/3] btrfs: fix suspicious RCU in BTRFS_IOC_DEV_INFO

2014-12-07 Thread Omar Sandoval
A naked read of the value of an RCU pointer isn't safe. Put the whole access in an RCU critical section, not just the pointer dereference. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/ioctl.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs

[PATCH v8 1/3] Move BTRFS RCU string to common library

2014-12-07 Thread Omar Sandoval
Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/check-integrity.c | 6 +-- fs/btrfs/dev-replace.c | 19 - fs/btrfs/disk-io.c | 6 +-- fs/btrfs/extent_io.c | 4 +- fs/btrfs/ioctl.c | 4 +- fs/btrfs/raid56.c | 2 +- fs/btrfs/rcu-string.h

[RFC PATCH v3 6/7] btrfs: add EXTENT_FLAG_SWAPFILE

2014-12-09 Thread Omar Sandoval
Extents mapping a swap file should remain pinned in memory in order to avoid doing allocations to look up an extent when we're already low on memory. Rather than overloading EXTENT_FLAG_PINNED, add a new flag specifically for this purpose. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs

[RFC PATCH v3 0/7] btrfs: implement swap file support

2014-12-09 Thread Omar Sandoval
a surprising inconsistency for users (in my opinion). As with before, this functionality is tenuously tested in a virtual machine with some artificial workloads, but it works for me. I'm pretty happy with the results on my end, so please comment away. Thanks! Omar Sandoval (7): direct-io

[RFC PATCH v3 7/7] btrfs: enable swap file support

2014-12-09 Thread Omar Sandoval
of allocations for a COW when we're already low on memory 2. Pins the extent maps in memory with EXTENT_FLAG_SWAPFILE Deactivation unpins all of the extent maps. Signed-off-by: Omar Sandoval osan...@osandov.com --- fs/btrfs/inode.c | 131 +++ 1 file changed

  1   2   3   4   5   6   7   8   >