[patch 07/10] mm + fs: store shadow entries in page cache

2014-02-03 Thread Johannes Weiner
Reclaim will be leaving shadow entries in the page cache radix tree
upon evicting the real page.  As those pages are found from the LRU,
an iput() can lead to the inode being freed concurrently.  At this
point, reclaim must no longer install shadow pages because the inode
freeing code needs to ensure the page tree is really empty.

Add an address_space flag, AS_EXITING, that the inode freeing code
sets under the tree lock before doing the final truncate.  Reclaim
will check for this flag before installing shadow pages.

Signed-off-by: Johannes Weiner 
Reviewed-by: Rik van Riel 
Reviewed-by: Minchan Kim 
---
 Documentation/filesystems/porting   |  6 +--
 drivers/staging/lustre/lustre/llite/llite_lib.c |  2 +-
 fs/9p/vfs_inode.c   |  2 +-
 fs/affs/inode.c |  2 +-
 fs/afs/inode.c  |  2 +-
 fs/bfs/inode.c  |  2 +-
 fs/block_dev.c  |  4 +-
 fs/btrfs/inode.c|  2 +-
 fs/cifs/cifsfs.c|  2 +-
 fs/coda/inode.c |  2 +-
 fs/ecryptfs/super.c |  2 +-
 fs/exofs/inode.c|  2 +-
 fs/ext2/inode.c |  2 +-
 fs/ext3/inode.c |  2 +-
 fs/ext4/inode.c |  4 +-
 fs/f2fs/inode.c |  2 +-
 fs/fat/inode.c  |  2 +-
 fs/freevxfs/vxfs_inode.c|  2 +-
 fs/fuse/inode.c |  2 +-
 fs/gfs2/super.c |  2 +-
 fs/hfs/inode.c  |  2 +-
 fs/hfsplus/super.c  |  2 +-
 fs/hostfs/hostfs_kern.c |  2 +-
 fs/hpfs/inode.c |  2 +-
 fs/inode.c  |  4 +-
 fs/jffs2/fs.c   |  2 +-
 fs/jfs/inode.c  |  4 +-
 fs/kernfs/inode.c   |  2 +-
 fs/logfs/readwrite.c|  2 +-
 fs/minix/inode.c|  2 +-
 fs/ncpfs/inode.c|  2 +-
 fs/nfs/inode.c  |  2 +-
 fs/nfs/nfs4super.c  |  2 +-
 fs/nilfs2/inode.c   |  6 +--
 fs/ntfs/inode.c |  2 +-
 fs/ocfs2/inode.c|  4 +-
 fs/omfs/inode.c |  2 +-
 fs/proc/inode.c |  2 +-
 fs/reiserfs/inode.c |  2 +-
 fs/sysv/inode.c |  2 +-
 fs/ubifs/super.c|  2 +-
 fs/udf/inode.c  |  4 +-
 fs/ufs/inode.c  |  2 +-
 fs/xfs/xfs_super.c  |  2 +-
 include/linux/fs.h  |  1 +
 include/linux/mm.h  |  1 +
 include/linux/pagemap.h | 13 +-
 mm/filemap.c| 33 ---
 mm/truncate.c   | 54 +++--
 mm/vmscan.c |  2 +-
 50 files changed, 147 insertions(+), 65 deletions(-)

diff --git a/Documentation/filesystems/porting 
b/Documentation/filesystems/porting
index fe2b7ae6f962..0f3a1390bf00 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -295,9 +295,9 @@ in the beginning of ->setattr unconditionally.
->clear_inode() and ->delete_inode() are gone; ->evict_inode() should
 be used instead.  It gets called whenever the inode is evicted, whether it has
 remaining links or not.  Caller does *not* evict the pagecache or 
inode-associated
-metadata buffers; getting rid of those is responsibility of method, as it had
-been for ->delete_inode(). Caller makes sure async writeback cannot be running
-for the inode while (or after) ->evict_inode() is called.
+metadata buffers; the method has to use truncate_inode_pages_final() to get rid
+of those. Caller makes sure async writeback cannot be running for the inode 
while
+(or after) ->evict_inode() is called.
 
->drop_inode() returns int now; it's called on final iput() with
 inode->i_lock held and it returns true if filesystems wants the inode to be
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 6cfdb9e4b74b..fc6aac3cfe00 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1877,7 +1877,7 @@ void ll_delete_inode(struct inode *inode)

[patch 07/10] mm + fs: store shadow entries in page cache

2014-02-03 Thread Johannes Weiner
Reclaim will be leaving shadow entries in the page cache radix tree
upon evicting the real page.  As those pages are found from the LRU,
an iput() can lead to the inode being freed concurrently.  At this
point, reclaim must no longer install shadow pages because the inode
freeing code needs to ensure the page tree is really empty.

Add an address_space flag, AS_EXITING, that the inode freeing code
sets under the tree lock before doing the final truncate.  Reclaim
will check for this flag before installing shadow pages.

Signed-off-by: Johannes Weiner han...@cmpxchg.org
Reviewed-by: Rik van Riel r...@redhat.com
Reviewed-by: Minchan Kim minc...@kernel.org
---
 Documentation/filesystems/porting   |  6 +--
 drivers/staging/lustre/lustre/llite/llite_lib.c |  2 +-
 fs/9p/vfs_inode.c   |  2 +-
 fs/affs/inode.c |  2 +-
 fs/afs/inode.c  |  2 +-
 fs/bfs/inode.c  |  2 +-
 fs/block_dev.c  |  4 +-
 fs/btrfs/inode.c|  2 +-
 fs/cifs/cifsfs.c|  2 +-
 fs/coda/inode.c |  2 +-
 fs/ecryptfs/super.c |  2 +-
 fs/exofs/inode.c|  2 +-
 fs/ext2/inode.c |  2 +-
 fs/ext3/inode.c |  2 +-
 fs/ext4/inode.c |  4 +-
 fs/f2fs/inode.c |  2 +-
 fs/fat/inode.c  |  2 +-
 fs/freevxfs/vxfs_inode.c|  2 +-
 fs/fuse/inode.c |  2 +-
 fs/gfs2/super.c |  2 +-
 fs/hfs/inode.c  |  2 +-
 fs/hfsplus/super.c  |  2 +-
 fs/hostfs/hostfs_kern.c |  2 +-
 fs/hpfs/inode.c |  2 +-
 fs/inode.c  |  4 +-
 fs/jffs2/fs.c   |  2 +-
 fs/jfs/inode.c  |  4 +-
 fs/kernfs/inode.c   |  2 +-
 fs/logfs/readwrite.c|  2 +-
 fs/minix/inode.c|  2 +-
 fs/ncpfs/inode.c|  2 +-
 fs/nfs/inode.c  |  2 +-
 fs/nfs/nfs4super.c  |  2 +-
 fs/nilfs2/inode.c   |  6 +--
 fs/ntfs/inode.c |  2 +-
 fs/ocfs2/inode.c|  4 +-
 fs/omfs/inode.c |  2 +-
 fs/proc/inode.c |  2 +-
 fs/reiserfs/inode.c |  2 +-
 fs/sysv/inode.c |  2 +-
 fs/ubifs/super.c|  2 +-
 fs/udf/inode.c  |  4 +-
 fs/ufs/inode.c  |  2 +-
 fs/xfs/xfs_super.c  |  2 +-
 include/linux/fs.h  |  1 +
 include/linux/mm.h  |  1 +
 include/linux/pagemap.h | 13 +-
 mm/filemap.c| 33 ---
 mm/truncate.c   | 54 +++--
 mm/vmscan.c |  2 +-
 50 files changed, 147 insertions(+), 65 deletions(-)

diff --git a/Documentation/filesystems/porting 
b/Documentation/filesystems/porting
index fe2b7ae6f962..0f3a1390bf00 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -295,9 +295,9 @@ in the beginning of -setattr unconditionally.
-clear_inode() and -delete_inode() are gone; -evict_inode() should
 be used instead.  It gets called whenever the inode is evicted, whether it has
 remaining links or not.  Caller does *not* evict the pagecache or 
inode-associated
-metadata buffers; getting rid of those is responsibility of method, as it had
-been for -delete_inode(). Caller makes sure async writeback cannot be running
-for the inode while (or after) -evict_inode() is called.
+metadata buffers; the method has to use truncate_inode_pages_final() to get rid
+of those. Caller makes sure async writeback cannot be running for the inode 
while
+(or after) -evict_inode() is called.
 
-drop_inode() returns int now; it's called on final iput() with
 inode-i_lock held and it returns true if filesystems wants the inode to be
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 6cfdb9e4b74b..fc6aac3cfe00 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1877,7 +1877,7 @@ void