From: Jan Kara <jack@suse.cz>
To: Daeho Jeong <daeho.jeong@samsung.com>
Cc: tytso@mit.edu, jack@suse.cz, linux-ext4@vger.kernel.org
Subject: Re: [PATCH v3 2/3] ext4: fix races between changing inode journal mode and ext4_writepages
Date: Thu, 10 Mar 2016 11:04:03 +0100 [thread overview]
Message-ID: <20160310100403.GF5026@quack.suse.cz> (raw)
In-Reply-To: <1457510987-31726-2-git-send-email-daeho.jeong@samsung.com>
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@samsung.com>
> Signed-off-by: Jan Kara <jack@suse.cz>
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@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2016-03-10 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 8:09 [PATCH v3 1/3] ext4: handle unwritten or delalloc buffers before enabling per-file data journaling Daeho Jeong
2016-03-09 8:09 ` [PATCH v3 2/3] ext4: fix races between changing inode journal mode and ext4_writepages Daeho Jeong
2016-03-10 10:04 ` Jan Kara [this message]
2016-03-09 8:09 ` [PATCH v3 3/3] ext4: enable again per-file data journaling on delalloc mode Daeho Jeong
-- strict thread matches above, loose matches on Subject: below --
2016-03-10 22:20 [PATCH v3 2/3] ext4: fix races between changing inode journal mode and ext4_writepages Daeho Jeong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160310100403.GF5026@quack.suse.cz \
--to=jack@suse.cz \
--cc=daeho.jeong@samsung.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).