aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2007-01-29 16:19:54 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-01-30 11:26:45 -0500
commita685e26fff387db350966f88eaad515bf41c4705 (patch)
treeaa32924e5641541df5e178908bf8e88fb9d2f508 /fs
parentff79544754631cf3d237ff47b7d0e7ab2d211fcf (diff)
[PATCH] ufs: alloc metadata null page fix
These series of patches result of UFS1 write support stress testing, like running fsx-linux, untar and build linux kernel etc We pass from ufs::get_block_t to levels below: pointer to the current page, to make possible things like reallocation of blocks on the fly, and we also uses this pointer for indication, what actually we allocate data block or meta data block, but currently we make decision about what we allocate on the wrong level, this may and cause oops if we allocate blocks in some special order. Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ufs/balloc.c5
-rw-r--r--fs/ufs/inode.c14
2 files changed, 13 insertions, 6 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 2e0021e8f366..96ca8453bab6 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -233,7 +233,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk,
233{ 233{
234 unsigned int blk_per_page = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits); 234 unsigned int blk_per_page = 1 << (PAGE_CACHE_SHIFT - inode->i_blkbits);
235 struct address_space *mapping = inode->i_mapping; 235 struct address_space *mapping = inode->i_mapping;
236 pgoff_t index, cur_index = locked_page->index; 236 pgoff_t index, cur_index;
237 unsigned int i, j; 237 unsigned int i, j;
238 struct page *page; 238 struct page *page;
239 struct buffer_head *head, *bh; 239 struct buffer_head *head, *bh;
@@ -241,8 +241,11 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk,
241 UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n", 241 UFSD("ENTER, ino %lu, count %u, oldb %u, newb %u\n",
242 inode->i_ino, count, oldb, newb); 242 inode->i_ino, count, oldb, newb);
243 243
244 BUG_ON(!locked_page);
244 BUG_ON(!PageLocked(locked_page)); 245 BUG_ON(!PageLocked(locked_page));
245 246
247 cur_index = locked_page->index;
248
246 for (i = 0; i < count; i += blk_per_page) { 249 for (i = 0; i < count; i += blk_per_page) {
247 index = (baseblk+i) >> (PAGE_CACHE_SHIFT - inode->i_blkbits); 250 index = (baseblk+i) >> (PAGE_CACHE_SHIFT - inode->i_blkbits);
248 251
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 2fbab0aab688..4295ca91cf85 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -242,7 +242,8 @@ repeat:
242 goal = tmp + uspi->s_fpb; 242 goal = tmp + uspi->s_fpb;
243 tmp = ufs_new_fragments (inode, p, fragment - blockoff, 243 tmp = ufs_new_fragments (inode, p, fragment - blockoff,
244 goal, required + blockoff, 244 goal, required + blockoff,
245 err, locked_page); 245 err,
246 phys != NULL ? locked_page : NULL);
246 } 247 }
247 /* 248 /*
248 * We will extend last allocated block 249 * We will extend last allocated block
@@ -250,7 +251,7 @@ repeat:
250 else if (lastblock == block) { 251 else if (lastblock == block) {
251 tmp = ufs_new_fragments(inode, p, fragment - (blockoff - lastblockoff), 252 tmp = ufs_new_fragments(inode, p, fragment - (blockoff - lastblockoff),
252 fs32_to_cpu(sb, *p), required + (blockoff - lastblockoff), 253 fs32_to_cpu(sb, *p), required + (blockoff - lastblockoff),
253 err, locked_page); 254 err, phys != NULL ? locked_page : NULL);
254 } else /* (lastblock > block) */ { 255 } else /* (lastblock > block) */ {
255 /* 256 /*
256 * We will allocate new block before last allocated block 257 * We will allocate new block before last allocated block
@@ -261,7 +262,8 @@ repeat:
261 goal = tmp + uspi->s_fpb; 262 goal = tmp + uspi->s_fpb;
262 } 263 }
263 tmp = ufs_new_fragments(inode, p, fragment - blockoff, 264 tmp = ufs_new_fragments(inode, p, fragment - blockoff,
264 goal, uspi->s_fpb, err, locked_page); 265 goal, uspi->s_fpb, err,
266 phys != NULL ? locked_page : NULL);
265 } 267 }
266 if (!tmp) { 268 if (!tmp) {
267 if ((!blockoff && *p) || 269 if ((!blockoff && *p) ||
@@ -438,9 +440,11 @@ int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buffer_head
438 * it much more readable: 440 * it much more readable:
439 */ 441 */
440#define GET_INODE_DATABLOCK(x) \ 442#define GET_INODE_DATABLOCK(x) \
441 ufs_inode_getfrag(inode, x, fragment, 1, &err, &phys, &new, bh_result->b_page) 443 ufs_inode_getfrag(inode, x, fragment, 1, &err, &phys, &new,\
444 bh_result->b_page)
442#define GET_INODE_PTR(x) \ 445#define GET_INODE_PTR(x) \
443 ufs_inode_getfrag(inode, x, fragment, uspi->s_fpb, &err, NULL, NULL, NULL) 446 ufs_inode_getfrag(inode, x, fragment, uspi->s_fpb, &err, NULL, NULL,\
447 bh_result->b_page)
444#define GET_INDIRECT_DATABLOCK(x) \ 448#define GET_INDIRECT_DATABLOCK(x) \
445 ufs_inode_getblock(inode, bh, x, fragment, \ 449 ufs_inode_getblock(inode, bh, x, fragment, \
446 &err, &phys, &new, bh_result->b_page) 450 &err, &phys, &new, bh_result->b_page)