+ /* writeback uses inode->i_size to determine how far out
+ * its cached pages go. ll_truncate gets a PW lock, canceling
+ * our lock, _after_ it has updated i_size. this can confuse
+ * us into zero extending the file to the newly truncated
+ * size, and this has bad implications for a racing o_append.
+ * if we're extending our size we need to flush the pages
+ * with the correct i_size before vmtruncate stomps on
+ * the new i_size. again, this can only find pages to
+ * purge if the PW lock that generated them is still held.
+ */
+ if ( attr->ia_size > inode->i_size ) {
+ filemap_fdatasync(inode->i_mapping);
+ filemap_fdatawait(inode->i_mapping);
+ }