LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mahesh J Salgaonkar <mahesh@linux.ibm.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Oliver O'Halloran <oohall@gmail.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/opal_elog: Handle multiple writes to ack attribute
Date: Wed, 14 Oct 2020 12:44:35 +0530	[thread overview]
Message-ID: <20201014071435.dylsc72ucfsckhqe@in.ibm.com> (raw)
In-Reply-To: <20201014064813.109515-1-aneesh.kumar@linux.ibm.com>

On 2020-10-14 12:18:13 Wed, Aneesh Kumar K.V wrote:
> Even though we use self removing sysfs helper, we still need
> to make sure we do the final kobject delete conditionally.
> sysfs_remove_file_self() will handle parallel calls to remove
> the sysfs attribute file and returns true only in the caller
> that removed the attribute file. The other parallel callers
> are returned false. Do the final kobject delete checking
> the return value of sysfs_remove_file_self().
> 
> Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
> Cc: Oliver O'Halloran <oohall@gmail.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>  arch/powerpc/platforms/powernv/opal-elog.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/opal-elog.c b/arch/powerpc/platforms/powernv/opal-elog.c
> index 5e33b1fc67c2..37b380eef41a 100644
> --- a/arch/powerpc/platforms/powernv/opal-elog.c
> +++ b/arch/powerpc/platforms/powernv/opal-elog.c
> @@ -72,9 +72,14 @@ static ssize_t elog_ack_store(struct elog_obj *elog_obj,
>  			      const char *buf,
>  			      size_t count)
>  {
> -	opal_send_ack_elog(elog_obj->id);
> -	sysfs_remove_file_self(&elog_obj->kobj, &attr->attr);
> -	kobject_put(&elog_obj->kobj);
> +	/*
> +	 * Try to self remove this attribute. If we are successful,
> +	 * delete the kobject itself.
> +	 */
> +	if (sysfs_remove_file_self(&elog_obj->kobj, &attr->attr)) {
> +		opal_send_ack_elog(elog_obj->id);
> +		kobject_put(&elog_obj->kobj);
> +	}
>  	return count;
>  }

Looks good.

Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>

Thanks,
-Mahesh.


  reply	other threads:[~2020-10-14  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  6:48 [PATCH] powerpc/opal_elog: Handle multiple writes to ack attribute Aneesh Kumar K.V
2020-10-14  7:14 ` Mahesh J Salgaonkar [this message]
2020-10-16 11:32 ` Michael Ellerman

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=20201014071435.dylsc72ucfsckhqe@in.ibm.com \
    --to=mahesh@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oohall@gmail.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