Skip to content

Commit

Permalink
ext4: write superblock only once on unmount
Browse files Browse the repository at this point in the history
In some rather rare cases it is possible that ext4 may the superblock
to the media twice. This patch makes sure this does not happen. This
should speed up unmounting in those cases.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
  • Loading branch information
Artem Bityutskiy authored and Theodore Ts'o committed Mar 22, 2012
1 parent 1b8b975 commit a8e25a8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,6 @@ static void ext4_put_super(struct super_block *sb)
destroy_workqueue(sbi->dio_unwritten_wq);

lock_super(sb);
if (sb->s_dirt)
ext4_commit_super(sb, 1);

if (sbi->s_journal) {
err = jbd2_journal_destroy(sbi->s_journal);
sbi->s_journal = NULL;
Expand All @@ -855,8 +852,10 @@ static void ext4_put_super(struct super_block *sb)
if (!(sb->s_flags & MS_RDONLY)) {
EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
es->s_state = cpu_to_le16(sbi->s_mount_state);
ext4_commit_super(sb, 1);
}
if (sb->s_dirt || !(sb->s_flags & MS_RDONLY))
ext4_commit_super(sb, 1);

if (sbi->s_proc) {
remove_proc_entry("options", sbi->s_proc);
remove_proc_entry(sb->s_id, ext4_proc_root);
Expand Down

0 comments on commit a8e25a8

Please sign in to comment.