Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1254983
| From | James Simmons <jsimmons@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/5] staging:lustre: kg_sem semaphore handling is incorrectly |
| Date | 2015-10-23 22:10 +0200 |
| Message-ID | <qmQP0-3lW-31@gated-at.bofh.it> (permalink) |
| References | <qmQFk-2UZ-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
During the removal of the cfs wrappers the kg_sem semaphore
was handled incorrectly. We need to take a write lock when
writing data to the kkuc_groups. The libcfs_kkuc_group_foreach
needs to only take a read lock. This makes use match the
OpenSFS development branch.
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
.../lustre/lustre/libcfs/kernel_user_comm.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
index d9b7c6b..48df275 100644
--- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
+++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
@@ -184,7 +184,7 @@ int libcfs_kkuc_group_put(int group, void *payload)
int rc = 0;
int one_success = 0;
- down_read(&kg_sem);
+ down_write(&kg_sem);
list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
if (reg->kr_fp != NULL) {
rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
@@ -196,7 +196,7 @@ int libcfs_kkuc_group_put(int group, void *payload)
}
}
}
- up_read(&kg_sem);
+ up_write(&kg_sem);
/* don't return an error if the message has been delivered
* at least to one agent */
@@ -228,12 +228,12 @@ int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
if (kkuc_groups[group].next == NULL)
return 0;
- down_write(&kg_sem);
+ down_read(&kg_sem);
list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
if (reg->kr_fp != NULL)
rc = cb_func(reg->kr_data, cb_arg);
}
- up_write(&kg_sem);
+ up_read(&kg_sem);
return rc;
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] staging:lustre: split kernel comm between user and kernel James Simmons <jsimmons@infradead.org> - 2015-10-23 22:00 +0200
[PATCH] staging:lustre: Prevent duplicate CT registrations James Simmons <jsimmons@infradead.org> - 2015-10-23 22:10 +0200
Re: [PATCH] staging:lustre: Prevent duplicate CT registrations Dan Carpenter <dan.carpenter@oracle.com> - 2015-10-26 10:00 +0100
[PATCH 1/5] staging:lustre: kg_sem semaphore handling is incorrectly James Simmons <jsimmons@infradead.org> - 2015-10-23 22:10 +0200
[PATCH 4/5] staging:lustre: split kernel comm between user and kernel James Simmons <jsimmons@infradead.org> - 2015-10-23 22:10 +0200
[PATCH] staging:lustre: move kernel_user_comm.c from libcfs to lustre James Simmons <jsimmons@infradead.org> - 2015-10-23 22:10 +0200
[PATCH 5/5] staging:lustre: Update license and copyright for kernel comm James Simmons <jsimmons@infradead.org> - 2015-10-23 22:10 +0200
Re: [PATCH 0/5] staging:lustre: split kernel comm between user and kernel Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-25 09:40 +0100
csiph-web