aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-08-08 13:23:19 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-08-08 13:23:19 -0400
commitf4387149ec71fed11535b49400bad17d22fdc935 (patch)
tree749c7fa407a835a731d4fbb33c54ff71cf46e799 /fs/gfs2
parentcc346d555f2c3eb4a63b2df6bf9c9947f0a92a01 (diff)
[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/gfs2')
-rw-r--r--fs/gfs2/ops_address.c8
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,
131static int gfs2_writepage(struct page *page, struct writeback_control *wbc) 131static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
132{ 132{
133 struct inode *inode = page->mapping->host; 133 struct inode *inode = page->mapping->host;
134 struct gfs2_inode *ip = GFS2_I(page->mapping->host); 134 struct gfs2_inode *ip = GFS2_I(inode);
135 struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host); 135 struct gfs2_sbd *sdp = GFS2_SB(inode);
136 loff_t i_size = i_size_read(inode); 136 loff_t i_size = i_size_read(inode);
137 pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT; 137 pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
138 unsigned offset; 138 unsigned offset;
@@ -158,6 +158,10 @@ static int gfs2_writepage(struct page *page, struct writeback_control *wbc)
158 error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0); 158 error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
159 if (error) 159 if (error)
160 goto out_ignore; 160 goto out_ignore;
161 if (!page_has_buffers(page)) {
162 create_empty_buffers(page, inode->i_sb->s_blocksize,
163 (1 << BH_Dirty)|(1 << BH_Uptodate));
164 }
161 gfs2_page_add_databufs(ip, page, 0, sdp->sd_vfs->s_blocksize-1); 165 gfs2_page_add_databufs(ip, page, 0, sdp->sd_vfs->s_blocksize-1);
162 done_trans = 1; 166 done_trans = 1;
163 } 167 }