Unionfs: restructure unionfs_setattr and fix truncation order
authorHugh Dickins <hugh@veritas.com>
Fri, 28 Dec 2007 18:41:39 +0000 (13:41 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 12 Aug 2011 02:37:13 +0000 (22:37 -0400)
commit4c57e4d3455898e28b26319ffbb7cbf3b048e502
tree61d35806a6a4f143173bdf9cf2ff4e9c973de0df
parent7b96af8b889bdf140e3ee8d6cf1ce3b61be171ec
Unionfs: restructure unionfs_setattr and fix truncation order

Restructure the code to move the lower notify_change out of the loop in
unionfs_setattr.  Cleanup and simplify the code.  Then fix the truncation
order which fsx-linux in a unionfs on tmpfs found.  Then handle copyup
properly.

When shrinking a file, unionfs_setattr needs to vmtruncate the upper level
before notifying change to the lower level, to eliminate those dirty pages
beyond new eof which otherwise drift down to the lower level's writepage,
writing beyond its eof (and later uncovered when the file is expanded).

Also truncate the upper level first when expanding, in the case when
the upper level's s_maxbytes is more limiting than the lower level's.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/inode.c