[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220627113822.g55mttsy2nx6yuyr@quack3.lan>
Date: Mon, 27 Jun 2022 13:38:22 +0200
From: Jan Kara <jack@...e.cz>
To: Zhang Yi <yi.zhang@...wei.com>
Cc: Jan Kara <jack@...e.cz>, linux-ext4@...r.kernel.org, tytso@....edu,
adilger.kernel@...ger.ca, yukuai3@...wei.com
Subject: Re: [PATCH] ext4: silence the warning when evicting inode with
dioread_nolock
On Sat 25-06-22 17:33:50, Zhang Yi wrote:
> > probably we should add:
> >
> > WARN_ON_ONCE(!list_empty(&inode->i_io_list));
> >
> > to the no_delete: case of ext4_evict_inode()? Race like you mention above
> > does not seem possible for that case but seeing the complicated
> > interactions I'd rather have the assertion in place.
> >
>
> For the no_delete case, I did some tests and IIUC, it's true that the race could
> not happen, because inode_lru_isolate() make sure inode->i_data.nrpages is zero
> before adding inode into the freeable list, so the evict() procedure could not be
> invoked before the page cache have been dropped (it could only happened after
> ext4_end_io_end() has been finished).
>
> We don't have a !list_empty(&inode->i_io_list) check for the no_delete case now.
> But I am not quite get the purpose of adding it, do you want to detect inode
> use-after-free issue in advance?
Yes, I wanted to check that we didn't accidentally dirty the inode
somewhere on the eviction path which would cause use-after-free issues
which are always hard to debug...
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists