diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/ops_address.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 90c287932d58..30c15622174f 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -197,7 +197,19 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) | |||
197 | void *kaddr; | 197 | void *kaddr; |
198 | int error; | 198 | int error; |
199 | 199 | ||
200 | BUG_ON(page->index); | 200 | /* |
201 | * Due to the order of unstuffing files and ->nopage(), we can be | ||
202 | * asked for a zero page in the case of a stuffed file being extended, | ||
203 | * so we need to supply one here. It doesn't happen often. | ||
204 | */ | ||
205 | if (unlikely(page->index)) { | ||
206 | kaddr = kmap_atomic(page, KM_USER0); | ||
207 | memset(kaddr, 0, PAGE_CACHE_SIZE); | ||
208 | kunmap_atomic(kaddr, KM_USER0); | ||
209 | flush_dcache_page(page); | ||
210 | SetPageUptodate(page); | ||
211 | return 0; | ||
212 | } | ||
201 | 213 | ||
202 | error = gfs2_meta_inode_buffer(ip, &dibh); | 214 | error = gfs2_meta_inode_buffer(ip, &dibh); |
203 | if (error) | 215 | if (error) |
@@ -208,9 +220,8 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page) | |||
208 | ip->i_di.di_size); | 220 | ip->i_di.di_size); |
209 | memset(kaddr + ip->i_di.di_size, 0, PAGE_CACHE_SIZE - ip->i_di.di_size); | 221 | memset(kaddr + ip->i_di.di_size, 0, PAGE_CACHE_SIZE - ip->i_di.di_size); |
210 | kunmap_atomic(kaddr, KM_USER0); | 222 | kunmap_atomic(kaddr, KM_USER0); |
211 | 223 | flush_dcache_page(page); | |
212 | brelse(dibh); | 224 | brelse(dibh); |
213 | |||
214 | SetPageUptodate(page); | 225 | SetPageUptodate(page); |
215 | 226 | ||
216 | return 0; | 227 | return 0; |