diff options
author | Steven Whitehouse | 2006-08-08 19:23:19 +0200 |
---|---|---|
committer | Steven Whitehouse | 2006-08-08 19:23:19 +0200 |
commit | f4387149ec71fed11535b49400bad17d22fdc935 (patch) | |
tree | 749c7fa407a835a731d4fbb33c54ff71cf46e799 /fs | |
parent | [DLM] fix userland unlock (diff) | |
download | kernel-qcow2-linux-f4387149ec71fed11535b49400bad17d22fdc935.tar.gz kernel-qcow2-linux-f4387149ec71fed11535b49400bad17d22fdc935.tar.xz kernel-qcow2-linux-f4387149ec71fed11535b49400bad17d22fdc935.zip |
[GFS2] Fix lack of buffers in writepage bug
In some cases we can enter write page without there being buffers
attached to the page. In this case the function to add gfs2_bufdata
to the buffers fails sliently causing further failures down the
stack.
This fix ensures that we always add buffers in writepage if they
didn't already exist (mmap is one way to trigger this).
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/ops_address.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index bdd4d6b48721..45afd0508689 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c @@ -131,8 +131,8 @@ static int get_block_noalloc(struct inode *inode, sector_t lblock, static int gfs2_writepage(struct page *page, struct writeback_control *wbc) { struct inode *inode = page->mapping->host; - struct gfs2_inode *ip = GFS2_I(page->mapping->host); - struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host); + struct gfs2_inode *ip = GFS2_I(inode); + struct gfs2_sbd *sdp = GFS2_SB(inode); loff_t i_size = i_size_read(inode); pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; unsigned offset; @@ -158,6 +158,10 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc) error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0); if (error) goto out_ignore; + if (!page_has_buffers(page)) { + create_empty_buffers(page, inode->i_sb->s_blocksize, + (1 << BH_Dirty)|(1 << BH_Uptodate)); + } gfs2_page_add_databufs(ip, page, 0, sdp->sd_vfs->s_blocksize-1); done_trans = 1; } |