Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
Pull fuse updates from Miklos Szeredi: "Support for pid namespaces from Seth and refcount_t work from Elena" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse: fuse: Add support for pid namespaces fuse: convert fuse_conn.count from atomic_t to refcount_t fuse: convert fuse_req.count from atomic_t to refcount_t fuse: convert fuse_file.count from atomic_t to refcount_t
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/exportfs.h>
|
||||
#include <linux/posix_acl.h>
|
||||
#include <linux/pid_namespace.h>
|
||||
|
||||
MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
|
||||
MODULE_DESCRIPTION("Filesystem in Userspace");
|
||||
@@ -601,7 +602,7 @@ void fuse_conn_init(struct fuse_conn *fc)
|
||||
memset(fc, 0, sizeof(*fc));
|
||||
spin_lock_init(&fc->lock);
|
||||
init_rwsem(&fc->killsb);
|
||||
atomic_set(&fc->count, 1);
|
||||
refcount_set(&fc->count, 1);
|
||||
atomic_set(&fc->dev_count, 1);
|
||||
init_waitqueue_head(&fc->blocked_waitq);
|
||||
init_waitqueue_head(&fc->reserved_req_waitq);
|
||||
@@ -619,14 +620,16 @@ void fuse_conn_init(struct fuse_conn *fc)
|
||||
fc->connected = 1;
|
||||
fc->attr_version = 1;
|
||||
get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key));
|
||||
fc->pid_ns = get_pid_ns(task_active_pid_ns(current));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fuse_conn_init);
|
||||
|
||||
void fuse_conn_put(struct fuse_conn *fc)
|
||||
{
|
||||
if (atomic_dec_and_test(&fc->count)) {
|
||||
if (refcount_dec_and_test(&fc->count)) {
|
||||
if (fc->destroy_req)
|
||||
fuse_request_free(fc->destroy_req);
|
||||
put_pid_ns(fc->pid_ns);
|
||||
fc->release(fc);
|
||||
}
|
||||
}
|
||||
@@ -634,7 +637,7 @@ EXPORT_SYMBOL_GPL(fuse_conn_put);
|
||||
|
||||
struct fuse_conn *fuse_conn_get(struct fuse_conn *fc)
|
||||
{
|
||||
atomic_inc(&fc->count);
|
||||
refcount_inc(&fc->count);
|
||||
return fc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fuse_conn_get);
|
||||
|
Reference in New Issue
Block a user