| .. | .. |
|---|
| 1981 | 1981 | } |
|---|
| 1982 | 1982 | |
|---|
| 1983 | 1983 | if (unlikely(copied < len) && wc->w_target_page) { |
|---|
| 1984 | + loff_t new_isize; |
|---|
| 1985 | + |
|---|
| 1984 | 1986 | if (!PageUptodate(wc->w_target_page)) |
|---|
| 1985 | 1987 | copied = 0; |
|---|
| 1986 | 1988 | |
|---|
| 1987 | | - ocfs2_zero_new_buffers(wc->w_target_page, start+copied, |
|---|
| 1988 | | - start+len); |
|---|
| 1989 | + new_isize = max_t(loff_t, i_size_read(inode), pos + copied); |
|---|
| 1990 | + if (new_isize > page_offset(wc->w_target_page)) |
|---|
| 1991 | + ocfs2_zero_new_buffers(wc->w_target_page, start+copied, |
|---|
| 1992 | + start+len); |
|---|
| 1993 | + else { |
|---|
| 1994 | + /* |
|---|
| 1995 | + * When page is fully beyond new isize (data copy |
|---|
| 1996 | + * failed), do not bother zeroing the page. Invalidate |
|---|
| 1997 | + * it instead so that writeback does not get confused |
|---|
| 1998 | + * put page & buffer dirty bits into inconsistent |
|---|
| 1999 | + * state. |
|---|
| 2000 | + */ |
|---|
| 2001 | + block_invalidatepage(wc->w_target_page, 0, PAGE_SIZE); |
|---|
| 2002 | + } |
|---|
| 1989 | 2003 | } |
|---|
| 1990 | 2004 | if (wc->w_target_page) |
|---|
| 1991 | 2005 | flush_dcache_page(wc->w_target_page); |
|---|