void fuse_chan_free(struct fuse_chan *fch)
{
+ WARN_ON(!list_empty(&fch->devices));
kfree(fch);
}
EXPORT_SYMBOL_GPL(fuse_chan_free);
struct fuse_chan *fuse_chan_new(void)
{
- return kzalloc_obj(struct fuse_chan);
+ struct fuse_chan *fch = kzalloc_obj(struct fuse_chan);
+ if (!fch)
+ return NULL;
+
+ INIT_LIST_HEAD(&fch->devices);
+
+ return fch;
}
EXPORT_SYMBOL_GPL(fuse_chan_new);
*/
fc->connected = 0;
} else {
- list_add_tail(&fud->entry, &fc->devices);
+ list_add_tail(&fud->entry, &fc->chan->devices);
fuse_conn_get(fc);
}
spin_unlock(&fc->lock);
return;
}
- list_for_each_entry(fud, &fc->devices, entry) {
+ list_for_each_entry(fud, &fc->chan->devices, entry) {
struct fuse_pqueue *fpq = &fud->pq;
spin_lock(&fpq->lock);
spin_unlock(&fc->bg_lock);
fuse_set_initialized(fc);
- list_for_each_entry(fud, &fc->devices, entry) {
+ list_for_each_entry(fud, &fc->chan->devices, entry) {
struct fuse_pqueue *fpq = &fud->pq;
spin_lock(&fpq->lock);
spin_lock(&fc->lock);
list_del(&fud->entry);
/* Are we the last open device? */
- last = list_empty(&fc->devices);
+ last = list_empty(&fc->chan->devices);
spin_unlock(&fc->lock);
if (last) {
struct fuse_chan {
/** Input queue */
struct fuse_iqueue iq;
+
+ /** List of device instances belonging to this connection */
+ struct list_head devices;
};
#define FUSE_PQ_HASH_BITS 8
/** Processing queue */
struct fuse_pqueue pq;
- /** list entry on fc->devices */
+ /** list entry on fch->devices */
struct list_head entry;
};
init_waitqueue_head(&fc->blocked_waitq);
INIT_LIST_HEAD(&fc->bg_queue);
INIT_LIST_HEAD(&fc->entry);
- INIT_LIST_HEAD(&fc->devices);
atomic_set(&fc->num_waiting, 0);
fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND;
fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD;
void fuse_free_conn(struct fuse_conn *fc)
{
- WARN_ON(!list_empty(&fc->devices));
kfree(fc);
}
EXPORT_SYMBOL_GPL(fuse_free_conn);
spin_unlock(&fc->lock);
return;
}
- list_for_each_entry(fud, &fc->devices, entry) {
+ list_for_each_entry(fud, &fc->chan->devices, entry) {
fpq = &fud->pq;
spin_lock(&fpq->lock);
if (fuse_request_expired(fc, &fpq->io) ||