On Mon 04-04-11 20:31:41, Yongqiang Yang wrote: > >> Reported-by: Amir Goldstein <amir73il@xxxxxxxxxxxx> > >> Signed-off-by: Yongqiang Yang <xiaoqiangnk@xxxxxxxxx> > >> --- > >> fs/ext4/super.c | 49 ++++++++++++++++++++++++++++++++++++++----------- > >> 1 files changed, 38 insertions(+), 11 deletions(-) > >> > >> diff --git a/fs/ext4/super.c b/fs/ext4/super.c > >> index ccfa686..f35b53e 100644 > >> --- a/fs/ext4/super.c > >> +++ b/fs/ext4/super.c > >> @@ -242,27 +242,49 @@ static void ext4_put_nojournal(handle_t *handle) > >> * journal_end calls result in the superblock being marked dirty, so > >> * that sync() will call the filesystem's write_super callback if > >> * appropriate. > >> + * > >> + * To avoid j_barrier hold in userspace when a user calls freeze(), > >> + * ext4 prevents a new handle from being started by s_frozen, which > >> + * is in an upper layer. > >> */ > >> handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) > >> { > >> journal_t *journal; > >> + handle_t *handle; > >> > >> if (sb->s_flags & MS_RDONLY) > >> return ERR_PTR(-EROFS); > >> > >> - vfs_check_frozen(sb, SB_FREEZE_TRANS); > >> - /* Special case here: if the journal has aborted behind our > >> - * backs (eg. EIO in the commit thread), then we still need to > >> - * take the FS itself readonly cleanly. */ > >> journal = EXT4_SB(sb)->s_journal; > >> - if (journal) { > >> - if (is_journal_aborted(journal)) { > >> - ext4_abort(sb, "Detected aborted journal"); > >> - return ERR_PTR(-EROFS); > >> - } > >> - return jbd2_journal_start(journal, nblocks); > >> + if (!journal) > >> + /* > >> + * Under no-journal mode, vfs_check_frozen() is not neeed. > >> + */ > > Why is this? Previously we waited also in the nojournal case and I don't > > see anything that would stop modifications in the nojournal case after your > > change... > > I think that ext4 in the nojournal case should do as filesystems > without journal, such as ext2. ext4_ext_truncate() upwrite But ext2 does not support filesystem freezing... > i_data_sem only if ext4_journal_extend() fails before > ext4_journal_restart() is called, ext4_journal_extend() however always > succeeds in nojournal case. OK, but again, I'm failing to see how i_data_sem behavior is relevant for waiting if a filesystem is frozen... So to be clear I believe we must do vfs_check_frozen() even in nojournal case if and only if the handle reference count is 0 (it's stored directly in current->journal_info in nojournal mode). Honza -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html