Skip to content

Commit 358ab79

Browse files
Vasant Hegdempe
authored andcommitted
powerpc/powernv/dump: Handle multiple writes to ack attribute
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(). Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201017164236.264713-1-hegdevasant@linux.vnet.ibm.com
1 parent 0a43ae3 commit 358ab79

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

arch/powerpc/platforms/powernv/opal-dump.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,14 @@ static ssize_t dump_ack_store(struct dump_obj *dump_obj,
8888
const char *buf,
8989
size_t count)
9090
{
91-
dump_send_ack(dump_obj->id);
92-
sysfs_remove_file_self(&dump_obj->kobj, &attr->attr);
93-
kobject_put(&dump_obj->kobj);
91+
/*
92+
* Try to self remove this attribute. If we are successful,
93+
* delete the kobject itself.
94+
*/
95+
if (sysfs_remove_file_self(&dump_obj->kobj, &attr->attr)) {
96+
dump_send_ack(dump_obj->id);
97+
kobject_put(&dump_obj->kobj);
98+
}
9499
return count;
95100
}
96101

0 commit comments

Comments
 (0)