mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Hillf Danton" <hillf.zj@alibaba-inc.com>
To: "'xiaomin1'" <xiaoming.wang@intel.com>
Cc: "'Zhang Dongxing'" <dongxing.zhang@intel.com>, <arnd@arndb.de>,
	<gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>,
	"Chuansheng Liu" <chuansheng.liu@intel.com>
Subject: Re: [PATCH] move file->f_op->open out of mutex (misc_mtx) in misc_open
Date: Mon, 05 Jan 2015 17:14:05 +0800	[thread overview]
Message-ID: <023c01d028c7$f4838f90$dd8aaeb0$@alibaba-inc.com> (raw)

> 
> misc_mtx was used to mutex misc_list.
> But file->f_op->open may be blocked by downloading
> firmware in some devices' open.
> So move file->f_op->open out of mutex (misc_mtx)
> in misc_open to avoid this block.
> It also make code more efficiency.
> 
> Signed-off-by: Zhang Dongxing <dongxing.zhang@intel.com>
> Signed-off-by: xiaoming wang <xiaoming.wang@intel.com>
> ---
>  drivers/char/misc.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/misc.c b/drivers/char/misc.c
> index ffa97d2..289c59e 100644
> --- a/drivers/char/misc.c
> +++ b/drivers/char/misc.c
> @@ -144,7 +144,8 @@ static int misc_open(struct inode * inode, struct file * file)
>  	replace_fops(file, new_fops);
>  	if (file->f_op->open) {
>  		file->private_data = c;
> -		err = file->f_op->open(inode,file);
> +		mutex_unlock(&misc_mtx);
> +		return file->f_op->open(inode,file);
>  	}
What if unregister breaks in while opening?

>  fail:
>  	mutex_unlock(&misc_mtx);
> --
> 1.7.9.5


             reply	other threads:[~2015-01-05  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05  9:14 Hillf Danton [this message]
2015-01-06  0:34 xiaomin1
2015-01-05 13:58 ` One Thousand Gnomes
2015-01-09 22:47 ` Greg KH

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='023c01d028c7$f4838f90$dd8aaeb0$@alibaba-inc.com' \
    --to=hillf.zj@alibaba-inc.com \
    --cc=arnd@arndb.de \
    --cc=chuansheng.liu@intel.com \
    --cc=dongxing.zhang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiaoming.wang@intel.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

Powered by JetHome