[f2fs-dev] [PATCH 9/9] Revert "ext4: fix wrong gfp type under transaction"

2016-12-16 Thread Michal Hocko
From: Michal Hocko This reverts commit 216553c4b7f3e3e2beb4981cddca9b2027523928. Now that the transaction context uses memalloc_nofs_save and all allocations within the this context inherit GFP_NOFS automatically, there is no reason to mark specific allocations explicitly. This patch should not

Re: [f2fs-dev] [PATCH 2/9 v2] xfs: introduce and use KM_NOLOCKDEP to silence reclaim lockdep false positives

2016-12-16 Thread Brian Foster
On Fri, Dec 16, 2016 at 04:40:41PM +0100, Michal Hocko wrote: > Updated patch after Mike noticed a BUG_ON when KM_NOLOCKDEP is used. > --- > From 1497e713e11639157aef21cae29052cb3dc7ab44 Mon Sep 17 00:00:00 2001 > From: Michal Hocko > Date: Thu, 15 Dec 2016 13:06:43 +0100 > Subject: [PATCH] xfs: i

[f2fs-dev] [PATCH 5/9 v2] xfs: use memalloc_nofs_{save, restore} instead of memalloc_noio*

2016-12-16 Thread Michal Hocko
On Fri 16-12-16 11:38:11, Brian Foster wrote: > On Thu, Dec 15, 2016 at 03:07:11PM +0100, Michal Hocko wrote: [...] > > @@ -459,7 +459,7 @@ _xfs_buf_map_pages( > > break; > > vm_unmap_aliases(); > > } while (retried++ <= 1); > > -

Re: [f2fs-dev] [PATCH 2/9 v2] xfs: introduce and use KM_NOLOCKDEP to silence reclaim lockdep false positives

2016-12-16 Thread Michal Hocko
On Fri 16-12-16 11:37:50, Brian Foster wrote: > On Fri, Dec 16, 2016 at 04:40:41PM +0100, Michal Hocko wrote: > > Updated patch after Mike noticed a BUG_ON when KM_NOLOCKDEP is used. > > --- > > From 1497e713e11639157aef21cae29052cb3dc7ab44 Mon Sep 17 00:00:00 2001 > > From: Michal Hocko > > Date:

Re: [f2fs-dev] [PATCH 5/9] xfs: use memalloc_nofs_{save, restore} instead of memalloc_noio*

2016-12-16 Thread Brian Foster
On Thu, Dec 15, 2016 at 03:07:11PM +0100, Michal Hocko wrote: > From: Michal Hocko > > kmem_zalloc_large and _xfs_buf_map_pages use memalloc_noio_{save,restore} > API to prevent from reclaim recursion into the fs because vmalloc can > invoke unconditional GFP_KERNEL allocations and these function

[f2fs-dev] [DEBUG PATCH 1/2] mm, debug: report when GFP_NO{FS, IO} is used explicitly from memalloc_no{fs, io}_{save, restore} context

2016-12-16 Thread Michal Hocko
From: Michal Hocko THIS PATCH IS FOR TESTING ONLY AND NOT MEANT TO HIT LINUS TREE It is desirable to reduce the direct GFP_NO{FS,IO} usage at minimum and prefer scope usage defined by memalloc_no{fs,io}_{save,restore} API. Let's help this process and add a debugging tool to catch when an explic

[f2fs-dev] [PATCH 0/9 v2] scope GFP_NOFS api

2016-12-16 Thread Michal Hocko
Hi, I have posted the previous version here [1]. Since then I have added a support to suppress reclaim lockdep warnings (__GFP_NOLOCKDEP) to allow removing GFP_NOFS usage motivated by the lockdep false positives. On top of that I've tried to convert few KM_NOFS usages to use the new flag in the xfs

[f2fs-dev] [DEBUG PATCH 0/2] debug explicit GFP_NO{FS, IO} usage from the scope context

2016-12-16 Thread Michal Hocko
Hi, I've forgot to add the following two patches which should help to identify explicit GFP_NO{FS,IO} usage from withing a scope context. Such a usage can be changed to the full GFP_KERNEL because all the calls from within the NO{FS,IO} scope will drop the __GFP_FS resp. __GFP_IO automatically and

[f2fs-dev] [PATCH 7/9] jbd2: make the whole kjournald2 kthread NOFS safe

2016-12-16 Thread Michal Hocko
From: Michal Hocko kjournald2 is central to the transaction commit processing. As such any potential allocation from this kernel thread has to be GFP_NOFS. Make sure to mark the whole kernel thread GFP_NOFS by the memalloc_nofs_save. Suggested-by: Jan Kara Signed-off-by: Michal Hocko --- fs/j

Re: [f2fs-dev] [PATCH 3/9] xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS

2016-12-16 Thread Brian Foster
On Thu, Dec 15, 2016 at 03:07:09PM +0100, Michal Hocko wrote: > From: Michal Hocko > > xfs has defined PF_FSTRANS to declare a scope GFP_NOFS semantic quite > some time ago. We would like to make this concept more generic and use > it for other filesystems as well. Let's start by giving the flag

[f2fs-dev] [PATCH 2/9 v2] xfs: introduce and use KM_NOLOCKDEP to silence reclaim lockdep false positives

2016-12-16 Thread Michal Hocko
Updated patch after Mike noticed a BUG_ON when KM_NOLOCKDEP is used. --- >From 1497e713e11639157aef21cae29052cb3dc7ab44 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Thu, 15 Dec 2016 13:06:43 +0100 Subject: [PATCH] xfs: introduce and use KM_NOLOCKDEP to silence reclaim lockdep false positives

[f2fs-dev] [PATCH 1/9] lockdep: allow to disable reclaim lockup detection

2016-12-16 Thread Michal Hocko
From: Michal Hocko The current implementation of the reclaim lockup detection can lead to false positives and those even happen and usually lead to tweak the code to silence the lockdep by using GFP_NOFS even though the context can use __GFP_FS just fine. See http://lkml.kernel.org/r/201605120803

Re: [f2fs-dev] [PATCH 0/9 v2] scope GFP_NOFS api

2016-12-16 Thread Mike Galbraith
On Fri, 2016-12-16 at 16:35 +0100, Michal Hocko wrote: > On Fri 16-12-16 16:05:58, Mike Galbraith wrote: > > On Thu, 2016-12-15 at 15:07 +0100, Michal Hocko wrote: > > > Hi, > > > I have posted the previous version here [1]. Since then I have added a > > > support to suppress reclaim lockdep warnin

[f2fs-dev] [PATCH 4/9] mm: introduce memalloc_nofs_{save, restore} API

2016-12-16 Thread Michal Hocko
From: Michal Hocko GFP_NOFS context is used for the following 5 reasons currently - to prevent from deadlocks when the lock held by the allocation context would be needed during the memory reclaim - to prevent from stack overflows during the reclaim because the

[f2fs-dev] [PATCH 6/9] jbd2: mark the transaction context with the scope GFP_NOFS context

2016-12-16 Thread Michal Hocko
From: Michal Hocko now that we have memalloc_nofs_{save,restore} api we can mark the whole transaction context as implicitly GFP_NOFS. All allocations will automatically inherit GFP_NOFS this way. This means that we do not have to mark any of those requests with GFP_NOFS and moreover all the ext4

Re: [f2fs-dev] [PATCH 0/9 v2] scope GFP_NOFS api

2016-12-16 Thread Michal Hocko
On Fri 16-12-16 16:05:58, Mike Galbraith wrote: > On Thu, 2016-12-15 at 15:07 +0100, Michal Hocko wrote: > > Hi, > > I have posted the previous version here [1]. Since then I have added a > > support to suppress reclaim lockdep warnings (__GFP_NOLOCKDEP) to allow > > removing GFP_NOFS usage motivat

[f2fs-dev] [PATCH 8/9] Revert "ext4: avoid deadlocks in the writeback path by using sb_getblk_gfp"

2016-12-16 Thread Michal Hocko
From: Michal Hocko This reverts commit c45653c341f5c8a0ce19c8f0ad4678640849cb86 because sb_getblk_gfp is not really needed as sb_getblk __getblk_gfp __getblk_slow grow_buffers grow_dev_page gfp_mask = mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS) | gfp so __GF

[f2fs-dev] [DEBUG PATCH 2/2] silent warnings which we cannot do anything about

2016-12-16 Thread Michal Hocko
From: Michal Hocko THIS PATCH IS FOR TESTING ONLY AND NOT MEANT TO HIT LINUS TREE There are some code paths used by all the filesystems which we cannot change to drop the GFP_NOFS, yet they generate a lot of warnings. Provide {disable,enable}_scope_gfp_check to silence those. alloc_page_buffers

Re: [f2fs-dev] [PATCH 0/9 v2] scope GFP_NOFS api

2016-12-16 Thread Mike Galbraith
On Thu, 2016-12-15 at 15:07 +0100, Michal Hocko wrote: > Hi, > I have posted the previous version here [1]. Since then I have added a > support to suppress reclaim lockdep warnings (__GFP_NOLOCKDEP) to allow > removing GFP_NOFS usage motivated by the lockdep false positives. On top > of that I've t

[f2fs-dev] [PATCH 2/9] xfs: introduce and use KM_NOLOCKDEP to silence reclaim lockdep false positives

2016-12-16 Thread Michal Hocko
From: Michal Hocko Now that the page allocator offers __GFP_NOLOCKDEP let's introduce KM_NOLOCKDEP alias for the xfs allocation APIs. While we are at it also change KM_NOFS users introduced by b17cb364dbbb ("xfs: fix missing KM_NOFS tags to keep lockdep happy") and use the new flag for them inste

[f2fs-dev] [PATCH 5/9] xfs: use memalloc_nofs_{save, restore} instead of memalloc_noio*

2016-12-16 Thread Michal Hocko
From: Michal Hocko kmem_zalloc_large and _xfs_buf_map_pages use memalloc_noio_{save,restore} API to prevent from reclaim recursion into the fs because vmalloc can invoke unconditional GFP_KERNEL allocations and these functions might be called from the NOFS contexts. The memalloc_noio_save will en

[f2fs-dev] [PATCH 3/9] xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS

2016-12-16 Thread Michal Hocko
From: Michal Hocko xfs has defined PF_FSTRANS to declare a scope GFP_NOFS semantic quite some time ago. We would like to make this concept more generic and use it for other filesystems as well. Let's start by giving the flag a more genric name PF_MEMALLOC_NOFS which is in line with an exiting PF_

Re: [f2fs-dev] [PATCH 3/3] fscrypt: consolidate fscrypt_has_permitted_context() checks

2016-12-16 Thread Eric Biggers
On Fri, Dec 16, 2016 at 01:22:51PM +0100, Richard Weinberger wrote: > On 15.12.2016 20:19, Eric Biggers wrote: > > From: Eric Biggers > > > > Now that fscrypt_has_permitted_context() compares the fscrypt_context > > rather than the fscrypt_info when needed, it is no longer necessary to > > delay

Re: [f2fs-dev] [PATCH 2/3] fscrypt: fix renaming and linking special files

2016-12-16 Thread Richard Weinberger
On 15.12.2016 20:19, Eric Biggers wrote: > From: Eric Biggers > > Attempting to link a device node, named pipe, or socket file into an > encrypted directory through rename(2) or link(2) always failed with > EPERM. This happened because fscrypt_permitted_context() saw that the > file was unencryp

Re: [f2fs-dev] [PATCH 3/3] fscrypt: consolidate fscrypt_has_permitted_context() checks

2016-12-16 Thread Richard Weinberger
On 15.12.2016 20:19, Eric Biggers wrote: > From: Eric Biggers > > Now that fscrypt_has_permitted_context() compares the fscrypt_context > rather than the fscrypt_info when needed, it is no longer necessary to > delay fscrypt_has_permitted_context() from ->lookup() to ->open() for > regular files,

Re: [f2fs-dev] [PATCH 1/3] fscrypt: fix loophole in one-encryption-policy-per-tree enforcement

2016-12-16 Thread Richard Weinberger
On 15.12.2016 20:19, Eric Biggers wrote: > From: Eric Biggers > > Filesystem encryption is designed to enforce that all files in an > encrypted directory tree use the same encryption policy. Operations > that violate this constraint are supposed to fail with EPERM. There was > one case that was

[f2fs-dev] [PATCH 2/2] f2fs: add a case of no need to read a page in write begin

2016-12-16 Thread Yunlei He
If the range we write cover the whole valid data in the last page, we do not need to read it. Signed-off-by: Yunlei He --- fs/f2fs/data.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index b90fb01..d9f7339 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c

[f2fs-dev] [PATCH 1/2] f2fs: fix a missing discard prefree segments

2016-12-16 Thread Yunlei He
If userspace issue a fstrim with a range not involve prefree segments, it will reuse these segments without discard. This patch fix it. Signed-off-by: Yunlei He --- fs/f2fs/segment.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.

[f2fs-dev] [patch] f2fs: remove unneeded condition

2016-12-16 Thread Dan Carpenter
We checked that "inode" is not an error pointer earlier so there is no need to check again here. Signed-off-by: Dan Carpenter diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 56c19b0610a8..290a9d7060ef 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -321,9 +321,9 @@ static struct dentr