diff options
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 2 | ||||
-rw-r--r-- | fs/fuse/file.c | 8 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 8 | ||||
-rw-r--r-- | fs/fuse/inode.c | 1 |
4 files changed, 15 insertions, 4 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 9e7c5385699f..16ae55d347bb 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -408,7 +408,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | |||
408 | goto out_put_forget_req; | 408 | goto out_put_forget_req; |
409 | 409 | ||
410 | err = -ENOMEM; | 410 | err = -ENOMEM; |
411 | ff = fuse_file_alloc(); | 411 | ff = fuse_file_alloc(fc); |
412 | if (!ff) | 412 | if (!ff) |
413 | goto out_put_request; | 413 | goto out_put_request; |
414 | 414 | ||
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index baed06ea7622..a28ced678d38 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -46,7 +46,7 @@ static int fuse_send_open(struct inode *inode, struct file *file, int isdir, | |||
46 | return err; | 46 | return err; |
47 | } | 47 | } |
48 | 48 | ||
49 | struct fuse_file *fuse_file_alloc(void) | 49 | struct fuse_file *fuse_file_alloc(struct fuse_conn *fc) |
50 | { | 50 | { |
51 | struct fuse_file *ff; | 51 | struct fuse_file *ff; |
52 | ff = kmalloc(sizeof(struct fuse_file), GFP_KERNEL); | 52 | ff = kmalloc(sizeof(struct fuse_file), GFP_KERNEL); |
@@ -58,6 +58,9 @@ struct fuse_file *fuse_file_alloc(void) | |||
58 | } else { | 58 | } else { |
59 | INIT_LIST_HEAD(&ff->write_entry); | 59 | INIT_LIST_HEAD(&ff->write_entry); |
60 | atomic_set(&ff->count, 0); | 60 | atomic_set(&ff->count, 0); |
61 | spin_lock(&fc->lock); | ||
62 | ff->kh = ++fc->khctr; | ||
63 | spin_unlock(&fc->lock); | ||
61 | } | 64 | } |
62 | } | 65 | } |
63 | return ff; | 66 | return ff; |
@@ -108,6 +111,7 @@ void fuse_finish_open(struct inode *inode, struct file *file, | |||
108 | 111 | ||
109 | int fuse_open_common(struct inode *inode, struct file *file, int isdir) | 112 | int fuse_open_common(struct inode *inode, struct file *file, int isdir) |
110 | { | 113 | { |
114 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
111 | struct fuse_open_out outarg; | 115 | struct fuse_open_out outarg; |
112 | struct fuse_file *ff; | 116 | struct fuse_file *ff; |
113 | int err; | 117 | int err; |
@@ -120,7 +124,7 @@ int fuse_open_common(struct inode *inode, struct file *file, int isdir) | |||
120 | if (err) | 124 | if (err) |
121 | return err; | 125 | return err; |
122 | 126 | ||
123 | ff = fuse_file_alloc(); | 127 | ff = fuse_file_alloc(fc); |
124 | if (!ff) | 128 | if (!ff) |
125 | return -ENOMEM; | 129 | return -ENOMEM; |
126 | 130 | ||
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 4fc5131f5c9d..86f013303828 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -100,6 +100,9 @@ struct fuse_file { | |||
100 | /** Request reserved for flush and release */ | 100 | /** Request reserved for flush and release */ |
101 | struct fuse_req *reserved_req; | 101 | struct fuse_req *reserved_req; |
102 | 102 | ||
103 | /** Kernel file handle guaranteed to be unique */ | ||
104 | u64 kh; | ||
105 | |||
103 | /** File handle used by userspace */ | 106 | /** File handle used by userspace */ |
104 | u64 fh; | 107 | u64 fh; |
105 | 108 | ||
@@ -322,6 +325,9 @@ struct fuse_conn { | |||
322 | /** The list of requests under I/O */ | 325 | /** The list of requests under I/O */ |
323 | struct list_head io; | 326 | struct list_head io; |
324 | 327 | ||
328 | /** The next unique kernel file handle */ | ||
329 | u64 khctr; | ||
330 | |||
325 | /** Number of requests currently in the background */ | 331 | /** Number of requests currently in the background */ |
326 | unsigned num_background; | 332 | unsigned num_background; |
327 | 333 | ||
@@ -499,7 +505,7 @@ void fuse_read_fill(struct fuse_req *req, struct file *file, | |||
499 | */ | 505 | */ |
500 | int fuse_open_common(struct inode *inode, struct file *file, int isdir); | 506 | int fuse_open_common(struct inode *inode, struct file *file, int isdir); |
501 | 507 | ||
502 | struct fuse_file *fuse_file_alloc(void); | 508 | struct fuse_file *fuse_file_alloc(struct fuse_conn *fc); |
503 | void fuse_file_free(struct fuse_file *ff); | 509 | void fuse_file_free(struct fuse_file *ff); |
504 | void fuse_finish_open(struct inode *inode, struct file *file, | 510 | void fuse_finish_open(struct inode *inode, struct file *file, |
505 | struct fuse_file *ff, struct fuse_open_out *outarg); | 511 | struct fuse_file *ff, struct fuse_open_out *outarg); |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index fa474989ec76..0e15bc221d23 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -485,6 +485,7 @@ static struct fuse_conn *new_conn(struct super_block *sb) | |||
485 | fc->bdi.unplug_io_fn = default_unplug_io_fn; | 485 | fc->bdi.unplug_io_fn = default_unplug_io_fn; |
486 | /* fuse does it's own writeback accounting */ | 486 | /* fuse does it's own writeback accounting */ |
487 | fc->bdi.capabilities = BDI_CAP_NO_ACCT_WB; | 487 | fc->bdi.capabilities = BDI_CAP_NO_ACCT_WB; |
488 | fc->khctr = 0; | ||
488 | fc->dev = sb->s_dev; | 489 | fc->dev = sb->s_dev; |
489 | err = bdi_init(&fc->bdi); | 490 | err = bdi_init(&fc->bdi); |
490 | if (err) | 491 | if (err) |