Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 155743
b: refs/heads/master
c: 9eaaa2d
h: refs/heads/master
i:
  155741: 65e42db
  155739: 2ecf81c
  155735: 4055f97
  155727: 1fd4d77
  155711: 8fbcd45
v: v3
  • Loading branch information
Jan Kara committed Jul 15, 2009
1 parent 31edc61 commit 15da71c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7447a668a3860b66b3c9db86fdea91e355ba59ac
refs/heads/master: 9eaaa2d5759837402ec5eee13b2a97921808c3eb
19 changes: 10 additions & 9 deletions trunk/fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1193,15 +1193,16 @@ static int ext3_write_begin(struct file *file, struct address_space *mapping,
* i_size_read because we hold i_mutex.
*
* Add inode to orphan list in case we crash before truncate
* finishes.
* finishes. Do this only if ext3_can_truncate() agrees so
* that orphan processing code is happy.
*/
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext3_can_truncate(inode))
ext3_orphan_add(handle, inode);
ext3_journal_stop(handle);
unlock_page(page);
page_cache_release(page);
if (pos + len > inode->i_size)
vmtruncate(inode, inode->i_size);
ext3_truncate(inode);
}
if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries))
goto retry;
Expand Down Expand Up @@ -1287,7 +1288,7 @@ static int ext3_ordered_write_end(struct file *file,
* There may be allocated blocks outside of i_size because
* we failed to copy some data. Prepare for truncate.
*/
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext3_can_truncate(inode))
ext3_orphan_add(handle, inode);
ret2 = ext3_journal_stop(handle);
if (!ret)
Expand All @@ -1296,7 +1297,7 @@ static int ext3_ordered_write_end(struct file *file,
page_cache_release(page);

if (pos + len > inode->i_size)
vmtruncate(inode, inode->i_size);
ext3_truncate(inode);
return ret ? ret : copied;
}

Expand All @@ -1315,14 +1316,14 @@ static int ext3_writeback_write_end(struct file *file,
* There may be allocated blocks outside of i_size because
* we failed to copy some data. Prepare for truncate.
*/
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext3_can_truncate(inode))
ext3_orphan_add(handle, inode);
ret = ext3_journal_stop(handle);
unlock_page(page);
page_cache_release(page);

if (pos + len > inode->i_size)
vmtruncate(inode, inode->i_size);
ext3_truncate(inode);
return ret ? ret : copied;
}

Expand Down Expand Up @@ -1358,7 +1359,7 @@ static int ext3_journalled_write_end(struct file *file,
* There may be allocated blocks outside of i_size because
* we failed to copy some data. Prepare for truncate.
*/
if (pos + len > inode->i_size)
if (pos + len > inode->i_size && ext3_can_truncate(inode))
ext3_orphan_add(handle, inode);
EXT3_I(inode)->i_state |= EXT3_STATE_JDATA;
if (inode->i_size > EXT3_I(inode)->i_disksize) {
Expand All @@ -1375,7 +1376,7 @@ static int ext3_journalled_write_end(struct file *file,
page_cache_release(page);

if (pos + len > inode->i_size)
vmtruncate(inode, inode->i_size);
ext3_truncate(inode);
return ret ? ret : copied;
}

Expand Down

0 comments on commit 15da71c

Please sign in to comment.