diff options
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r-- | fs/reiserfs/inode.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 12dfdcfbee3d..52f1e2136546 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -39,14 +39,10 @@ void reiserfs_delete_inode(struct inode *inode) | |||
39 | 39 | ||
40 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ | 40 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ |
41 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ | 41 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ |
42 | mutex_lock(&inode->i_mutex); | ||
43 | |||
44 | reiserfs_delete_xattrs(inode); | 42 | reiserfs_delete_xattrs(inode); |
45 | 43 | ||
46 | if (journal_begin(&th, inode->i_sb, jbegin_count)) { | 44 | if (journal_begin(&th, inode->i_sb, jbegin_count)) |
47 | mutex_unlock(&inode->i_mutex); | ||
48 | goto out; | 45 | goto out; |
49 | } | ||
50 | reiserfs_update_inode_transaction(inode); | 46 | reiserfs_update_inode_transaction(inode); |
51 | 47 | ||
52 | err = reiserfs_delete_object(&th, inode); | 48 | err = reiserfs_delete_object(&th, inode); |
@@ -57,12 +53,8 @@ void reiserfs_delete_inode(struct inode *inode) | |||
57 | if (!err) | 53 | if (!err) |
58 | DQUOT_FREE_INODE(inode); | 54 | DQUOT_FREE_INODE(inode); |
59 | 55 | ||
60 | if (journal_end(&th, inode->i_sb, jbegin_count)) { | 56 | if (journal_end(&th, inode->i_sb, jbegin_count)) |
61 | mutex_unlock(&inode->i_mutex); | ||
62 | goto out; | 57 | goto out; |
63 | } | ||
64 | |||
65 | mutex_unlock(&inode->i_mutex); | ||
66 | 58 | ||
67 | /* check return value from reiserfs_delete_object after | 59 | /* check return value from reiserfs_delete_object after |
68 | * ending the transaction | 60 | * ending the transaction |
@@ -2348,6 +2340,7 @@ static int reiserfs_write_full_page(struct page *page, | |||
2348 | unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; | 2340 | unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; |
2349 | int error = 0; | 2341 | int error = 0; |
2350 | unsigned long block; | 2342 | unsigned long block; |
2343 | sector_t last_block; | ||
2351 | struct buffer_head *head, *bh; | 2344 | struct buffer_head *head, *bh; |
2352 | int partial = 0; | 2345 | int partial = 0; |
2353 | int nr = 0; | 2346 | int nr = 0; |
@@ -2395,10 +2388,19 @@ static int reiserfs_write_full_page(struct page *page, | |||
2395 | } | 2388 | } |
2396 | bh = head; | 2389 | bh = head; |
2397 | block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); | 2390 | block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); |
2391 | last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; | ||
2398 | /* first map all the buffers, logging any direct items we find */ | 2392 | /* first map all the buffers, logging any direct items we find */ |
2399 | do { | 2393 | do { |
2400 | if ((checked || buffer_dirty(bh)) && (!buffer_mapped(bh) || | 2394 | if (block > last_block) { |
2401 | (buffer_mapped(bh) | 2395 | /* |
2396 | * This can happen when the block size is less than | ||
2397 | * the page size. The corresponding bytes in the page | ||
2398 | * were zero filled above | ||
2399 | */ | ||
2400 | clear_buffer_dirty(bh); | ||
2401 | set_buffer_uptodate(bh); | ||
2402 | } else if ((checked || buffer_dirty(bh)) && | ||
2403 | (!buffer_mapped(bh) || (buffer_mapped(bh) | ||
2402 | && bh->b_blocknr == | 2404 | && bh->b_blocknr == |
2403 | 0))) { | 2405 | 0))) { |
2404 | /* not mapped yet, or it points to a direct item, search | 2406 | /* not mapped yet, or it points to a direct item, search |