All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Zhang Yi <yi.zhang@huawei.com>
Cc: Jan Kara <jack@suse.cz>,
	linux-ext4@vger.kernel.org, tytso@mit.edu,
	adilger.kernel@dilger.ca, yukuai3@huawei.com
Subject: Re: [PATCH] ext4: silence the warning when evicting inode with dioread_nolock
Date: Mon, 27 Jun 2022 13:38:22 +0200	[thread overview]
Message-ID: <20220627113822.g55mttsy2nx6yuyr@quack3.lan> (raw)
In-Reply-To: <22096be1-d77a-a7e4-cb72-6378e76ae6cd@huawei.com>

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@suse.com>
SUSE Labs, CR

      reply	other threads:[~2022-06-27 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24  7:04 [PATCH] ext4: silence the warning when evicting inode with dioread_nolock Zhang Yi
2022-06-24 12:51 ` Jan Kara
2022-06-25  9:33   ` Zhang Yi
2022-06-27 11:38     ` Jan Kara [this message]

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=20220627113822.g55mttsy2nx6yuyr@quack3.lan \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.