From: Corey Minyard <cminyard@mvista.com>
To: chenchacha <chen.chenchacha@foxmail.com>
Cc: minyard@acm.org, openipmi-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] ipmi: Limit the number of message a user may have outstanding
Date: Wed, 30 Mar 2022 09:58:38 -0500 [thread overview]
Message-ID: <20220330145838.GY3458@minyard.net> (raw)
In-Reply-To: <tencent_508F9F7681360F657D131FF97D2C53506208@qq.com>
On Wed, Mar 30, 2022 at 10:44:50PM +0800, chenchacha wrote:
> > @@ -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?
Oh wait, yeah, I screwed that up. I added the first decrement later,
after I "noticed" it was missing. I should add a comment there.
Thanks.
-corey
>
> --
> Chen Guanqiao
next prev parent reply other threads:[~2022-03-30 14:58 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
2022-03-30 14:58 ` Corey Minyard [this message]
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=20220330145838.GY3458@minyard.net \
--to=cminyard@mvista.com \
--cc=chen.chenchacha@foxmail.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