On Wed 09-03-16 17:09:46, Daeho Jeong wrote: > Now, in ext4, there is a race condition between changing inode journal > mode and ext4_writepages(). While ext4_writepages() is executed on > a non-journalled mode inode, the inode's journal mode could be enabled > by ioctl() and then, some pages dirtied after switching the journal > mode will be still exposed to ext4_writepages() in non-journaled mode. > To resolve this problem, we use fs-wide per-cpu rw semaphore by > Jan Kara's suggestion because we don't want to waste ext4_inode_info's > space for this extra rare case. > > Signed-off-by: Daeho Jeong <daeho.jeong@xxxxxxxxxxx> > Signed-off-by: Jan Kara <jack@xxxxxxx> The patch is almost fine except for one small issue: > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c > index 9ecfb76..1176142 100644 > --- a/fs/ext4/inode.c > +++ b/fs/ext4/inode.c > @@ -2476,6 +2476,7 @@ static int ext4_writepages(struct address_space *mapping, > struct blk_plug plug; > bool give_up_on_write = false; > > + percpu_down_read(&sbi->s_journal_flag_rwsem); > trace_ext4_writepages(inode, wbc); You need to change how dax_writeback_mapping_range() is called a few lines below so that it also exits via out_writepages: and not directly. Honza -- Jan Kara <jack@xxxxxxxx> 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