aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2007-10-17 02:31:00 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:43:03 -0400
commitc756e0a4d79202535774806f148026e40466a5eb (patch)
treeaa769ecfe2204e2e1969108d2c391b88b95e983b /fs/fuse/dir.c
parentde5e3dec421c44c999071b8f7e0580ad2ade92ae (diff)
fuse: add reference counting to fuse_file
Make lifetime of 'struct fuse_file' independent from 'struct file' by adding a reference counter and destructor. This will enable asynchronous page writeback, where it cannot be guaranteed, that the file is not released while a request with this file handle is being served. The actual RELEASE request is only sent when there are no more references to the fuse_file. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index bd5a772d8ccf..35e5cabb3b8c 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -288,12 +288,11 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
288static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff, 288static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff,
289 u64 nodeid, int flags) 289 u64 nodeid, int flags)
290{ 290{
291 struct fuse_req *req; 291 fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE);
292 292 ff->reserved_req->force = 1;
293 req = fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE); 293 request_send(fc, ff->reserved_req);
294 req->force = 1; 294 fuse_put_request(fc, ff->reserved_req);
295 request_send(fc, req); 295 kfree(ff);
296 fuse_put_request(fc, req);
297} 296}
298 297
299/* 298/*
@@ -859,6 +858,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
859 struct page *page; 858 struct page *page;
860 struct inode *inode = file->f_path.dentry->d_inode; 859 struct inode *inode = file->f_path.dentry->d_inode;
861 struct fuse_conn *fc = get_fuse_conn(inode); 860 struct fuse_conn *fc = get_fuse_conn(inode);
861 struct fuse_file *ff = file->private_data;
862 struct fuse_req *req; 862 struct fuse_req *req;
863 863
864 if (is_bad_inode(inode)) 864 if (is_bad_inode(inode))
@@ -875,7 +875,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
875 } 875 }
876 req->num_pages = 1; 876 req->num_pages = 1;
877 req->pages[0] = page; 877 req->pages[0] = page;
878 fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR); 878 fuse_read_fill(req, ff, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
879 request_send(fc, req); 879 request_send(fc, req);
880 nbytes = req->out.args[0].size; 880 nbytes = req->out.args[0].size;
881 err = req->out.h.error; 881 err = req->out.h.error;