[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190918100627.GB25056@quack2.suse.cz>
Date: Wed, 18 Sep 2019 12:06:27 +0200
From: Jan Kara <jack@...e.cz>
To: "Theodore Y. Ts'o" <tytso@....edu>
Cc: yangerkun <yangerkun@...wei.com>, jack@...e.cz,
linux-ext4@...r.kernel.org, yi.zhang@...wei.com, houtao1@...wei.com
Subject: Re: [PATCH] ext4: fix a bug in ext4_wait_for_tail_page_commit
On Tue 17-09-19 11:31:40, Theodore Y. Ts'o wrote:
> On Tue, Sep 17, 2019 at 04:48:14PM +0800, yangerkun wrote:
> > No need to wait when offset equals to 0. And it will trigger a bug since
> > the latter __ext4_journalled_invalidatepage can free the buffers but leave
> > page still dirty.
>
> That's only true if the block size == the page size, no? If the
> offset is zero and the block size is 1k, we still need to wait.
> Shouldn't the better fix be:
>
> > - if (offset > PAGE_SIZE - i_blocksize(inode))
> > + if (offset >= PAGE_SIZE - i_blocksize(inode))
No, what yangerkun wrote is correct. We don't have to wait for commit when
offset == 0 - truncate_inode_pages() should just happily process such page.
Also '>' in the above condition is correct. offset == PAGE_SIZE -
i_blocksize(inode) means one full block is getting truncated from the page
and we need to wait in that case to avoid jbd2_journal_invalidatepage()
failing with EBUSY when called from truncate_inode_pages().
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists