Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113394
b: refs/heads/master
c: 7ffe1ea
h: refs/heads/master
v: v3
  • Loading branch information
Hidehiro Kawai authored and Theodore Ts'o committed Oct 11, 2008
1 parent 91b0c74 commit 284512f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 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: 44519faf22ad6ce924ad0352d3dc200d9e0b66e8
refs/heads/master: 7ffe1ea8949c75ecffb7a4d988bb881a9fa62fbe
12 changes: 8 additions & 4 deletions trunk/fs/ext4/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
case EXT4_IOC_GROUP_EXTEND: {
ext4_fsblk_t n_blocks_count;
struct super_block *sb = inode->i_sb;
int err;
int err, err2;

if (!capable(CAP_SYS_RESOURCE))
return -EPERM;
Expand All @@ -206,16 +206,18 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)

err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count);
jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
jbd2_journal_flush(EXT4_SB(sb)->s_journal);
err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
if (err == 0)
err = err2;
mnt_drop_write(filp->f_path.mnt);

return err;
}
case EXT4_IOC_GROUP_ADD: {
struct ext4_new_group_data input;
struct super_block *sb = inode->i_sb;
int err;
int err, err2;

if (!capable(CAP_SYS_RESOURCE))
return -EPERM;
Expand All @@ -230,8 +232,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)

err = ext4_group_add(sb, &input);
jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
jbd2_journal_flush(EXT4_SB(sb)->s_journal);
err2 = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
if (err == 0)
err = err2;
mnt_drop_write(filp->f_path.mnt);

return err;
Expand Down
23 changes: 19 additions & 4 deletions trunk/fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ static void ext4_put_super(struct super_block *sb)
ext4_mb_release(sb);
ext4_ext_release(sb);
ext4_xattr_put_super(sb);
jbd2_journal_destroy(sbi->s_journal);
if (jbd2_journal_destroy(sbi->s_journal) < 0)
ext4_abort(sb, __func__, "Couldn't clean up the journal");
sbi->s_journal = NULL;
if (!(sb->s_flags & MS_RDONLY)) {
EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
Expand Down Expand Up @@ -2853,7 +2854,9 @@ static void ext4_mark_recovery_complete(struct super_block *sb,
journal_t *journal = EXT4_SB(sb)->s_journal;

jbd2_journal_lock_updates(journal);
jbd2_journal_flush(journal);
if (jbd2_journal_flush(journal) < 0)
goto out;

lock_super(sb);
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER) &&
sb->s_flags & MS_RDONLY) {
Expand All @@ -2862,6 +2865,8 @@ static void ext4_mark_recovery_complete(struct super_block *sb,
ext4_commit_super(sb, es, 1);
}
unlock_super(sb);

out:
jbd2_journal_unlock_updates(journal);
}

Expand Down Expand Up @@ -2962,7 +2967,13 @@ static void ext4_write_super_lockfs(struct super_block *sb)

/* Now we set up the journal barrier. */
jbd2_journal_lock_updates(journal);
jbd2_journal_flush(journal);

/*
* We don't want to clear needs_recovery flag when we failed
* to flush the journal.
*/
if (jbd2_journal_flush(journal) < 0)
return;

/* Journal blocked and flushed, clear needs_recovery flag. */
EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
Expand Down Expand Up @@ -3402,8 +3413,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
* otherwise be livelocked...
*/
jbd2_journal_lock_updates(EXT4_SB(sb)->s_journal);
jbd2_journal_flush(EXT4_SB(sb)->s_journal);
err = jbd2_journal_flush(EXT4_SB(sb)->s_journal);
jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal);
if (err) {
path_put(&nd.path);
return err;
}
}

err = vfs_quota_on_path(sb, type, format_id, &nd.path);
Expand Down

0 comments on commit 284512f

Please sign in to comment.