kernel-ark/fs/nfs
Konstantin Khlebnikov b9ea25152e page_writeback: clean up mess around cancel_dirty_page()
This patch replaces cancel_dirty_page() with a helper function
account_page_cleaned() which only updates counters.  It's called from
truncate_complete_page() and from try_to_free_buffers() (hack for ext3).
Page is locked in both cases, page-lock protects against concurrent
dirtiers: see commit 2d6d7f9828 ("mm: protect set_page_dirty() from
ongoing truncation").

Delete_from_page_cache() shouldn't be called for dirty pages, they must
be handled by caller (either written or truncated).  This patch treats
final dirty accounting fixup at the end of __delete_from_page_cache() as
a debug check and adds WARN_ON_ONCE() around it.  If something removes
dirty pages without proper handling that might be a bug and unwritten
data might be lost.

Hugetlbfs has no dirty pages accounting, ClearPageDirty() is enough
here.

cancel_dirty_page() in nfs_wb_page_cancel() is redundant.  This is
helper for nfs_invalidate_page() and it's called only in case complete
invalidation.

The mess was started in v2.6.20 after commits 46d2277c79 ("Clean up
and make try_to_free_buffers() not race with dirty pages") and
3e67c0987d ("truncate: clear page dirtiness before running
try_to_free_buffers()") first was reverted right in v2.6.20 in commit
ecdfc9787f ("Resurrect 'try_to_free_buffers()' VM hackery"), second in
v2.6.25 commit a2b345642f ("Fix dirty page accounting leak with ext3
data=journal").

Custom fixes were introduced between these points.  NFS in v2.6.23, commit
1b3b4a1a2d ("NFS: Fix a write request leak in nfs_invalidate_page()").
Kludge in __delete_from_page_cache() in v2.6.24, commit 3a6927906f ("Do
dirty page accounting when removing a page from the page cache").  Since
v2.6.25 all of them are redundant.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-14 16:49:01 -07:00
..
blocklayout pnfs: release lseg in pnfs_generic_pg_cleanup 2015-02-03 11:06:44 -08:00
filelayout pnfs: Refactor the *_layout_mark_request_commit to use pnfs_layout_mark_request_commit 2015-02-18 07:20:35 -08:00
flexfilelayout pnfs: Refactor the *_layout_mark_request_commit to use pnfs_layout_mark_request_commit 2015-02-18 07:20:35 -08:00
objlayout nfs: add nfs_pgio_current_mirror helper 2015-02-03 11:06:48 -08:00
cache_lib.c
cache_lib.h
callback_proc.c NFSv4.1: Don't set up a backchannel if the server didn't agree to do so 2015-02-18 12:30:47 -08:00
callback_xdr.c NFSv4.1: Convert open-coded array allocation calls to kmalloc_array() 2015-02-11 19:02:52 -05:00
callback.c nfs: don't call blocking operations while !TASK_RUNNING 2015-01-30 20:39:50 -05:00
callback.h
client.c NFSv4: Fix a race in NFSv4.1 server trunking discovery 2015-03-03 20:42:23 -05:00
delegation.c NFSv4: Ensure we skip delegations that are already being returned 2015-03-02 18:09:15 -05:00
delegation.h NFSv4: Fix races between nfs_remove_bad_delegation() and delegation return 2014-11-12 17:19:04 -05:00
dir.c NFS: Don't require a filehandle to refresh the inode in nfs_prime_dcache() 2015-03-01 23:23:07 -05:00
direct.c NFS: struct nfs_commit_info.lock must always point to inode->i_lock 2015-02-13 21:03:16 -05:00
dns_resolve.c NFS: Enabling v4.2 should not recompile nfsd and lockd 2013-11-19 16:20:40 -05:00
dns_resolve.h
file.c NFS: Don't write enable new pages while an invalidation is proceeding 2015-03-03 13:58:08 -05:00
fscache-index.c NFS: Fabricate fscache server index key correctly 2014-09-25 21:25:18 -04:00
fscache.c nfs: define nfs_inc_fscache_stats and using it as possible 2014-11-24 20:08:47 -05:00
fscache.h
getroot.c switch d_materialise_unique() users to d_splice_alias() 2014-11-19 13:01:20 -05:00
idmap.c pnfs/flexfiles: Add the FlexFile Layout Driver 2015-02-03 11:06:52 -08:00
inode.c NFS: Don't write enable new pages while an invalidation is proceeding 2015-03-03 13:58:08 -05:00
internal.h NFS: Add attribute update barriers to NFS writebacks 2015-03-01 23:23:06 -05:00
iostat.h nfs: define nfs_inc_fscache_stats and using it as possible 2014-11-24 20:08:47 -05:00
Kconfig pnfs/flexfiles: Add the FlexFile Layout Driver 2015-02-03 11:06:52 -08:00
Makefile pnfs/flexfiles: Add the FlexFile Layout Driver 2015-02-03 11:06:52 -08:00
mount_clnt.c
namespace.c
netns.h pnfs/blocklayout: serialize GETDEVICEINFO calls 2014-11-12 14:22:52 -05:00
nfs2super.c
nfs2xdr.c nfs: save server READ/WRITE/COMMIT status 2015-02-03 11:06:40 -08:00
nfs3_fs.h nfsv3: introduce nfs3_set_ds_client 2015-02-03 11:06:34 -08:00
nfs3acl.c NFSv3: Fix missing includes of nfs3_fs.h 2014-09-25 16:28:53 -04:00
nfs3client.c nfs: set hostname when creating nfsv3 ds connection 2015-02-03 11:06:38 -08:00
nfs3proc.c NFS: Add attribute update barriers to NFS writebacks 2015-03-01 23:23:06 -05:00
nfs3super.c nfsv3: introduce nfs3_set_ds_client 2015-02-03 11:06:34 -08:00
nfs3xdr.c NFSv3: Use the readdir fileid as the mounted-on-fileid 2015-03-01 23:23:07 -05:00
nfs4_fs.h Merge branch 'flexfiles' 2015-02-03 16:01:27 -05:00
nfs4client.c NFSv4: Fix a race in NFSv4.1 server trunking discovery 2015-03-03 20:42:23 -05:00
nfs4file.c nfs: Add DEALLOCATE support 2014-11-25 16:38:32 -05:00
nfs4getroot.c
nfs4namespace.c NFSv4: test SECINFO RPC_AUTH_GSS pseudoflavors for support 2014-06-24 18:46:58 -04:00
nfs4proc.c NFSv4.1: Clear the old state by our client id before establishing a new lease 2015-03-03 21:52:30 -05:00
nfs4renewd.c NFSv4.1: Fix an NFSv4.1 state renewal regression 2014-09-30 17:18:42 -04:00
nfs4session.c NFSv4.1: Don't set up a backchannel if the server didn't agree to do so 2015-02-18 12:30:47 -08:00
nfs4session.h NFSv4.1: Clear the old state by our client id before establishing a new lease 2015-03-03 21:52:30 -05:00
nfs4state.c NFSv4.1: Clear the old state by our client id before establishing a new lease 2015-03-03 21:52:30 -05:00
nfs4super.c Merge branch 'for-3.20/bdi' of git://git.kernel.dk/linux-block 2015-02-12 13:50:21 -08:00
nfs4sysctl.c nfs: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
nfs4trace.c
nfs4trace.h nfs: merge nfs_pgio_data into _header 2014-06-24 18:47:00 -04:00
nfs4xdr.c NFSv4.1: Clean up bind_conn_to_session 2015-02-18 13:11:09 -08:00
nfs42.h nfs: Add DEALLOCATE support 2014-11-25 16:38:32 -05:00
nfs42proc.c nfs: Add DEALLOCATE support 2014-11-25 16:38:32 -05:00
nfs42xdr.c nfs: Add DEALLOCATE support 2014-11-25 16:38:32 -05:00
nfs.h
nfsroot.c NFS: a couple off by ones 2015-01-30 20:43:30 -05:00
nfstrace.c
nfstrace.h NFS: fix the handling of NFS_INO_INVALID_DATA flag in nfs_revalidate_mapping 2014-01-27 15:35:56 -05:00
pagelist.c NFS client updates for Linux 3.20 2015-02-11 17:14:54 -08:00
pnfs_dev.c pnfs: remove GETDEVICELIST implementation 2014-09-12 13:20:54 -04:00
pnfs_nfs.c pnfs: Refactor the *_layout_mark_request_commit to use pnfs_layout_mark_request_commit 2015-02-18 07:20:35 -08:00
pnfs.c pnfs: delete an unintended goto 2015-02-10 08:41:23 -05:00
pnfs.h pnfs: Refactor the *_layout_mark_request_commit to use pnfs_layout_mark_request_commit 2015-02-18 07:20:35 -08:00
proc.c NFS: Add attribute update barriers to NFS writebacks 2015-03-01 23:23:06 -05:00
read.c nfs: add mirroring support to pgio layer 2015-02-03 11:06:45 -08:00
super.c Merge branch 'for-3.20/bdi' of git://git.kernel.dk/linux-block 2015-02-12 13:50:21 -08:00
symlink.c
sysctl.c nfs: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
unlink.c nfs: emit a fsnotify_nameremove call in sillyrename codepath 2014-03-17 15:14:17 -04:00
write.c page_writeback: clean up mess around cancel_dirty_page() 2015-04-14 16:49:01 -07:00