public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: chengzhihao1 <chengzhihao1@huawei.com>
Cc: libaokun <libaokun1@huawei.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	yukuai3 <yukuai3@huawei.com>, Hulk Robot <hulkci@huawei.com>
Subject: Re: [PATCH -next V3] ubi: fix race condition between ctrl_cdev_ioctl and ubi_cdev_ioctl
Date: Thu, 30 Dec 2021 22:32:27 +0100 (CET)	[thread overview]
Message-ID: <1652249414.215435.1640899947744.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <b8f6bbf3-cca4-9bfa-f70a-393f04edd21f@huawei.com>

----- Ursprüngliche Mail -----
> Von: "chengzhihao1" <chengzhihao1@huawei.com>
> kernfs_drain() will wait 'root->deactivate_waitq' if
> atomic_read(&kn->active) not equals to KN_DEACTIVATED_BIAS.
> 
> The UBI seq_show callback is invoked with avtive cnt taken:
> vfs_read
>   kernfs_fop_read_iter
>     seq_read_iter
>       m->op->start (kernfs_seq_start)   // kernfs_get_active(of->kn)
>       kernfs_seq_show
>         dev_attribute_show [ubi]
>       m->op->stop (kernfs_seq_stop)     // kernfs_put_active(of->kn)
> 
> The kernfs_drain() is stuck at wait_event() until sysfs reading
> finished, in my local test.

You are right. This means UBI does this extra check in vain.
Maybe even since ever.

Thanks,
//richard

  reply	other threads:[~2021-12-30 21:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05  9:30 [PATCH -next V3] ubi: fix race condition between ctrl_cdev_ioctl and ubi_cdev_ioctl Baokun Li
2021-12-21 12:33 ` libaokun (A)
2021-12-23 21:06   ` Richard Weinberger
2021-12-28  7:48     ` Zhihao Cheng
2021-12-30 21:32       ` Richard Weinberger [this message]
2021-12-28 12:40     ` libaokun (A)

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=1652249414.215435.1640899947744.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=chengzhihao1@huawei.com \
    --cc=hulkci@huawei.com \
    --cc=libaokun1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=vigneshr@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox