Skip to content

Commit 1cf2968

Browse files
committed
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: jbd2: fix race between write_metadata_buffer and get_write_access ext4: Fix ext4_mb_initialize_context() to initialize all fields ext4: fix null handler of ioctls in no journal mode ext4: Fix buffer head reference leak in no-journal mode ext4: Move __ext4_journalled_writepage() to avoid forward declaration ext4: Fix mmap/truncate race when blocksize < pagesize && !nodellaoc ext4: Fix mmap/truncate race when blocksize < pagesize && delayed allocation ext4: Don't look at buffer_heads outside i_size. ext4: Fix goal inum check in the inode allocator ext4: fix no journal corruption with locale-gen ext4: Calculate required journal credits for inserting an extent properly ext4: Fix truncation of symlinks after failed write jbd2: Fix a race between checkpointing code and journal_get_write_access() ext4: Use rcu_barrier() on module unload. ext4: naturally align struct ext4_allocation_request ext4: mark several more functions in mballoc.c as noinline ext4: Fix potential reclaim deadlock when truncating partial block jbd2: Remove GFP_ATOMIC kmalloc from inside spinlock critical region ext4: Fix type warning on 64-bit platforms in tracing events header
2 parents 4a390e0 + 96577c4 commit 1cf2968

11 files changed

Lines changed: 235 additions & 393 deletions

File tree

‎fs/ext4/ext4.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,20 @@ typedef unsigned int ext4_group_t;
9393
struct ext4_allocation_request {
9494
/* target inode for block we're allocating */
9595
struct inode *inode;
96+
/* how many blocks we want to allocate */
97+
unsigned int len;
9698
/* logical block in target inode */
9799
ext4_lblk_t logical;
98-
/* phys. target (a hint) */
99-
ext4_fsblk_t goal;
100100
/* the closest logical allocated block to the left */
101101
ext4_lblk_t lleft;
102-
/* phys. block for ^^^ */
103-
ext4_fsblk_t pleft;
104102
/* the closest logical allocated block to the right */
105103
ext4_lblk_t lright;
106-
/* phys. block for ^^^ */
104+
/* phys. target (a hint) */
105+
ext4_fsblk_t goal;
106+
/* phys. block for the closest logical allocated block to the left */
107+
ext4_fsblk_t pleft;
108+
/* phys. block for the closest logical allocated block to the right */
107109
ext4_fsblk_t pright;
108-
/* how many blocks we want to allocate */
109-
unsigned int len;
110110
/* flags. see above EXT4_MB_HINT_* */
111111
unsigned int flags;
112112
};

‎fs/ext4/ext4_jbd2.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ int __ext4_journal_forget(const char *where, handle_t *handle,
4343
ext4_journal_abort_handle(where, __func__, bh,
4444
handle, err);
4545
}
46+
else
47+
brelse(bh);
4648
return err;
4749
}
4850

@@ -57,6 +59,8 @@ int __ext4_journal_revoke(const char *where, handle_t *handle,
5759
ext4_journal_abort_handle(where, __func__, bh,
5860
handle, err);
5961
}
62+
else
63+
brelse(bh);
6064
return err;
6165
}
6266

‎fs/ext4/ext4_jbd2.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ int __ext4_journal_get_undo_access(const char *where, handle_t *handle,
131131
int __ext4_journal_get_write_access(const char *where, handle_t *handle,
132132
struct buffer_head *bh);
133133

134+
/* When called with an invalid handle, this will still do a put on the BH */
134135
int __ext4_journal_forget(const char *where, handle_t *handle,
135136
struct buffer_head *bh);
136137

138+
/* When called with an invalid handle, this will still do a put on the BH */
137139
int __ext4_journal_revoke(const char *where, handle_t *handle,
138140
ext4_fsblk_t blocknr, struct buffer_head *bh);
139141

@@ -281,10 +283,10 @@ static inline int ext4_should_order_data(struct inode *inode)
281283

282284
static inline int ext4_should_writeback_data(struct inode *inode)
283285
{
284-
if (EXT4_JOURNAL(inode) == NULL)
285-
return 0;
286286
if (!S_ISREG(inode->i_mode))
287287
return 0;
288+
if (EXT4_JOURNAL(inode) == NULL)
289+
return 1;
288290
if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL)
289291
return 0;
290292
if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)

‎fs/ext4/extents.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,7 @@ int ext4_ext_calc_credits_for_single_extent(struct inode *inode, int nrblocks,
19771977
*/
19781978
/* 1 bitmap, 1 block group descriptor */
19791979
ret = 2 + EXT4_META_TRANS_BLOCKS(inode->i_sb);
1980+
return ret;
19801981
}
19811982
}
19821983

‎fs/ext4/ialloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode,
833833
if (!goal)
834834
goal = sbi->s_inode_goal;
835835

836-
if (goal && goal < le32_to_cpu(sbi->s_es->s_inodes_count)) {
836+
if (goal && goal <= le32_to_cpu(sbi->s_es->s_inodes_count)) {
837837
group = (goal - 1) / EXT4_INODES_PER_GROUP(sb);
838838
ino = (goal - 1) % EXT4_INODES_PER_GROUP(sb);
839839
ret2 = 0;

0 commit comments

Comments
 (0)