diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-13 16:53:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-13 16:53:54 -0400 |
commit | 19c6e12c07ceab2ff5d5ec97354b893ab386c41c (patch) | |
tree | 47ac6b968c5b725f25cd3c0ee34f8cc7cd4c9617 /fs/reiserfs | |
parent | 954e6e03c61d233eae810f8da65270c224fe2fa4 (diff) | |
parent | 4d9bcaddacf23861c5ee088b0c03e7034c3d59d6 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull ext2, udf, reiserfs fixes from Jan Kara:
"Several ext2, udf, and reiserfs fixes"
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
ext2: Fix memory leak when truncate races ext2_get_blocks
reiserfs: fix race in prealloc discard
reiserfs: don't preallocate blocks for extended attributes
udf: Convert udf_disk_stamp_to_time() to use mktime64()
udf: Use time64_to_tm for timestamp conversion
udf: Fix deadlock between writeback and udf_setsize()
udf: Use i_size_read() in udf_adinicb_writepage()
udf: Fix races with i_size changes during readpage
udf: Remove unused UDF_DEFAULT_BLOCKSIZE
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/bitmap.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index dc198bc64c61..edc8ef78b63f 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
@@ -513,9 +513,17 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th, | |||
513 | "inode has negative prealloc blocks count."); | 513 | "inode has negative prealloc blocks count."); |
514 | #endif | 514 | #endif |
515 | while (ei->i_prealloc_count > 0) { | 515 | while (ei->i_prealloc_count > 0) { |
516 | reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block); | 516 | b_blocknr_t block_to_free; |
517 | ei->i_prealloc_block++; | 517 | |
518 | /* | ||
519 | * reiserfs_free_prealloc_block can drop the write lock, | ||
520 | * which could allow another caller to free the same block. | ||
521 | * We can protect against it by modifying the prealloc | ||
522 | * state before calling it. | ||
523 | */ | ||
524 | block_to_free = ei->i_prealloc_block++; | ||
518 | ei->i_prealloc_count--; | 525 | ei->i_prealloc_count--; |
526 | reiserfs_free_prealloc_block(th, inode, block_to_free); | ||
519 | dirty = 1; | 527 | dirty = 1; |
520 | } | 528 | } |
521 | if (dirty) | 529 | if (dirty) |
@@ -1128,7 +1136,7 @@ static int determine_prealloc_size(reiserfs_blocknr_hint_t * hint) | |||
1128 | hint->prealloc_size = 0; | 1136 | hint->prealloc_size = 0; |
1129 | 1137 | ||
1130 | if (!hint->formatted_node && hint->preallocate) { | 1138 | if (!hint->formatted_node && hint->preallocate) { |
1131 | if (S_ISREG(hint->inode->i_mode) | 1139 | if (S_ISREG(hint->inode->i_mode) && !IS_PRIVATE(hint->inode) |
1132 | && hint->inode->i_size >= | 1140 | && hint->inode->i_size >= |
1133 | REISERFS_SB(hint->th->t_super)->s_alloc_options. | 1141 | REISERFS_SB(hint->th->t_super)->s_alloc_options. |
1134 | preallocmin * hint->inode->i_sb->s_blocksize) | 1142 | preallocmin * hint->inode->i_sb->s_blocksize) |