Unionfs: restructure unionfs_setattr and fix truncation order
authorHugh Dickins <hugh@veritas.com>
Thu, 10 Jan 2008 11:56:50 +0000 (06:56 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:03:29 +0000 (19:03 -0400)
commitf50a4d45f840a6f607ef53bae335ce1548cce926
treec27a8fd78414a357dcb7a30f8a4d3e851698795f
parent43701a1e42a8c3a895dab9b359768b8f13c527e9
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