aboutsummaryrefslogtreecommitdiff
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
authorSteven Whitehouse <steve@men-an-tol.chygwyn.com>2006-02-15 12:26:19 +0000
committerSteven Whitehouse <steve@chygwyn.com>2006-02-15 12:26:19 +0000
commit5c4e9e036678fae65c9288e1c00a6f33cd447283 (patch)
tree656159da5907b1f763ff7d99c56cc368141d3a76 /fs/gfs2/ops_address.c
parent61a30dcb5866eb7e92796b2988ddb4c94b9f78ac (diff)
[GFS2] Fix a case where we didn't get unstuffing right
There was a bug in the unstuffing logic which caused a crash under certain circumstances. This is now fixed. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 39d03f3f2d5..1ccc2642682 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -220,14 +220,14 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
if (error)
return error;
- kaddr = kmap(page);
+ kaddr = kmap_atomic(page, KM_USER0);
memcpy((char *)kaddr,
dibh->b_data + sizeof(struct gfs2_dinode),
ip->i_di.di_size);
memset((char *)kaddr + ip->i_di.di_size,
0,
PAGE_CACHE_SIZE - ip->i_di.di_size);
- kunmap(page);
+ kunmap_atomic(page, KM_USER0);
brelse(dibh);
@@ -240,9 +240,9 @@ static int zero_readpage(struct page *page)
{
void *kaddr;
- kaddr = kmap(page);
+ kaddr = kmap_atomic(page, KM_USER0);
memset(kaddr, 0, PAGE_CACHE_SIZE);
- kunmap(page);
+ kunmap_atomic(page, KM_USER0);
SetPageUptodate(page);
unlock_page(page);
@@ -364,14 +364,14 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
if (gfs2_is_stuffed(ip)) {
if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
error = gfs2_unstuff_dinode(ip, gfs2_unstuffer_page, page);
- if (error)
- goto out;
- } else if (!PageUptodate(page)) {
+ if (error == 0)
+ goto prepare_write;
+ } else if (!PageUptodate(page))
error = stuffed_readpage(ip, page);
- goto out;
- }
+ goto out;
}
+prepare_write:
error = block_prepare_write(page, from, to, gfs2_get_block);
out: