mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chenchacha <chen.chenchacha@foxmail.com>
To: minyard@acm.org
Cc: openipmi-developer@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, Corey Minyard <cminyard@mvista.com>
Subject: Re: [PATCH 2/4] ipmi: Limit the number of message a user may have outstanding
Date: Wed, 30 Mar 2022 22:44:50 +0800	[thread overview]
Message-ID: <tencent_508F9F7681360F657D131FF97D2C53506208@qq.com> (raw)
In-Reply-To: <20220329183340.471474-3-minyard@acm.org>

> @@ -2298,6 +2309,14 @@ static int i_ipmi_request(struct ipmi_user     *user,
>   	struct ipmi_recv_msg *recv_msg;
>   	int rv = 0;
>   
> +	if (user) {
> +		if (atomic_add_return(1, &user->nr_msgs) > max_msgs_per_user) {
> +			atomic_dec(&user->nr_msgs);
> +			rv = -EBUSY;
> +			goto out;
> +		}
> +	}
> +
> @@ -2369,6 +2388,8 @@ static int i_ipmi_request(struct ipmi_user     *user,
>   	rcu_read_unlock();
>   
>   out:
> +	if (rv && user)
> +		atomic_dec(&user->nr_msgs);
>   	return rv;
>   }

If the number of msg is greater than the limit, the nr_msgs will be 
decrease twice.

Should it be returned directory?

--
Chen Guanqiao

  reply	other threads:[~2022-03-30 14:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 18:33 [PATCH 0/4] ipmi: add limits on users and messages minyard
2022-03-29 18:33 ` [PATCH 1/4] ipmi: Add a limit on the number of users that may use IPMI minyard
2022-03-29 18:33 ` [PATCH 2/4] ipmi: Limit the number of message a user may have outstanding minyard
2022-03-30 14:44   ` chenchacha [this message]
2022-03-30 14:58     ` Corey Minyard
2022-03-29 18:33 ` [PATCH 3/4] ipmi: Add a sysfs interface to view the number of users minyard
2022-03-29 18:33 ` [PATCH 4/4] ipmi: Add a sysfs count of total outstanding messages for an interface minyard
2022-03-30 14:46 ` [PATCH 0/4] ipmi: add limits on users and messages chenchacha

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=tencent_508F9F7681360F657D131FF97D2C53506208@qq.com \
    --to=chen.chenchacha@foxmail.com \
    --cc=cminyard@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®