diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2007-10-17 08:31:00 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 17:43:03 +0200 |
commit | c756e0a4d79202535774806f148026e40466a5eb (patch) | |
tree | aa769ecfe2204e2e1969108d2c391b88b95e983b /fs/fuse/dir.c | |
parent | fuse: fix reserved request wake up (diff) | |
download | linux-c756e0a4d79202535774806f148026e40466a5eb.tar.xz linux-c756e0a4d79202535774806f148026e40466a5eb.zip |
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.c | 14 |
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, static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff, u64 nodeid, int flags) { - struct fuse_req *req; - - req = fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE); - req->force = 1; - request_send(fc, req); - fuse_put_request(fc, req); + fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE); + ff->reserved_req->force = 1; + request_send(fc, ff->reserved_req); + fuse_put_request(fc, ff->reserved_req); + kfree(ff); } /* @@ -859,6 +858,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir) struct page *page; struct inode *inode = file->f_path.dentry->d_inode; struct fuse_conn *fc = get_fuse_conn(inode); + struct fuse_file *ff = file->private_data; struct fuse_req *req; if (is_bad_inode(inode)) @@ -875,7 +875,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir) } req->num_pages = 1; req->pages[0] = page; - fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR); + fuse_read_fill(req, ff, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR); request_send(fc, req); nbytes = req->out.args[0].size; err = req->out.h.error; |