[Xenomai-git] Philippe Gerum : copperplate/registry: protect locked sections traversing cancellation points
Module: xenomai-forge Branch: next Commit: 53e104fbc6b262dd1d8bb093e36cf7f5c711e9d3 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=53e104fbc6b262dd1d8bb093e36cf7f5c711e9d3 Author: Philippe Gerum Date: Mon Apr 21 16:37:19 2014 +0200 copperplate/registry: protect locked sections traversing cancellation points All fs methods invoking user-defined handlers may reach cancellation points indirectly, so protect all locks held across those calls against asynchronous cancellation of the registry thread (although this should never happen under normal circumstances). --- lib/copperplate/registry.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/copperplate/registry.c b/lib/copperplate/registry.c index b3ef2ed..1606cd7 100644 --- a/lib/copperplate/registry.c +++ b/lib/copperplate/registry.c @@ -367,7 +367,8 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -395,6 +396,7 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) ret = __bt(fsobj->ops->open(fsobj, priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } @@ -407,7 +409,8 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -423,6 +426,7 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) __STD(free(priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/registry: protect locked sections traversing cancellation points
Module: xenomai-forge Branch: next Commit: de87de4abadb6e1a016fb094ef958fba78b5d3ea URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=de87de4abadb6e1a016fb094ef958fba78b5d3ea Author: Philippe Gerum Date: Mon Apr 21 16:37:19 2014 +0200 copperplate/registry: protect locked sections traversing cancellation points All fs methods invoking user-defined handlers may reach cancellation points indirectly, so protect all locks held across those calls against asynchronous cancellation of the registry thread (although this should never happen under normal circumstances). --- lib/copperplate/registry.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/copperplate/registry.c b/lib/copperplate/registry.c index b3ef2ed..1606cd7 100644 --- a/lib/copperplate/registry.c +++ b/lib/copperplate/registry.c @@ -367,7 +367,8 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -395,6 +396,7 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) ret = __bt(fsobj->ops->open(fsobj, priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } @@ -407,7 +409,8 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -423,6 +426,7 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) __STD(free(priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/registry: protect locked sections traversing cancellation points
Module: xenomai-forge Branch: rtdm-api-waitqueues Commit: 9f232b8c814af11c166cf3875bb2fc475293cecb URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=9f232b8c814af11c166cf3875bb2fc475293cecb Author: Philippe Gerum Date: Mon Apr 21 16:37:19 2014 +0200 copperplate/registry: protect locked sections traversing cancellation points All fs methods invoking user-defined handlers may reach cancellation points indirectly, so protect all locks held across those calls against asynchronous cancellation of the registry thread (although this should never happen under normal circumstances). --- lib/copperplate/registry.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/copperplate/registry.c b/lib/copperplate/registry.c index b3ef2ed..1606cd7 100644 --- a/lib/copperplate/registry.c +++ b/lib/copperplate/registry.c @@ -367,7 +367,8 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -395,6 +396,7 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) ret = __bt(fsobj->ops->open(fsobj, priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } @@ -407,7 +409,8 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -423,6 +426,7 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) __STD(free(priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : copperplate/registry: protect locked sections traversing cancellation points
Module: xenomai-forge Branch: next Commit: 9f232b8c814af11c166cf3875bb2fc475293cecb URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=9f232b8c814af11c166cf3875bb2fc475293cecb Author: Philippe Gerum Date: Mon Apr 21 16:37:19 2014 +0200 copperplate/registry: protect locked sections traversing cancellation points All fs methods invoking user-defined handlers may reach cancellation points indirectly, so protect all locks held across those calls against asynchronous cancellation of the registry thread (although this should never happen under normal circumstances). --- lib/copperplate/registry.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/copperplate/registry.c b/lib/copperplate/registry.c index b3ef2ed..1606cd7 100644 --- a/lib/copperplate/registry.c +++ b/lib/copperplate/registry.c @@ -367,7 +367,8 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -395,6 +396,7 @@ static int regfs_open(const char *path, struct fuse_file_info *fi) ret = __bt(fsobj->ops->open(fsobj, priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } @@ -407,7 +409,8 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) int ret = 0; void *priv; - read_lock_nocancel(&p->lock); + push_cleanup_lock(&p->lock); + read_lock(&p->lock); hobj = pvhash_search(&p->files, path, strlen(path)); if (hobj == NULL) { @@ -423,6 +426,7 @@ static int regfs_release(const char *path, struct fuse_file_info *fi) __STD(free(priv)); done: read_unlock(&p->lock); + pop_cleanup_lock(&p->lock); return __bt(ret); } ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git