fuse: add list of writable files to fuse_inode
Each WRITE request must carry a valid file descriptor. When a page is written back from a memory mapping, the file through which the page was dirtied is not available, so a new mechananism is needed to find a suitable file in ->writepage(s). A list of fuse_files is added to fuse_inode. The file is removed from the list in fuse_release(). This patch is in preparation for writable mmap support. 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>
This commit is contained in:
committed by
Linus Torvalds
parent
a9ff4f8705
commit
93a8c3cd9e
@ -56,6 +56,7 @@ struct fuse_file *fuse_file_alloc(void)
|
||||
kfree(ff);
|
||||
ff = NULL;
|
||||
}
|
||||
INIT_LIST_HEAD(&ff->write_entry);
|
||||
atomic_set(&ff->count, 0);
|
||||
}
|
||||
return ff;
|
||||
@ -150,12 +151,18 @@ int fuse_release_common(struct inode *inode, struct file *file, int isdir)
|
||||
{
|
||||
struct fuse_file *ff = file->private_data;
|
||||
if (ff) {
|
||||
struct fuse_conn *fc = get_fuse_conn(inode);
|
||||
|
||||
fuse_release_fill(ff, get_node_id(inode), file->f_flags,
|
||||
isdir ? FUSE_RELEASEDIR : FUSE_RELEASE);
|
||||
|
||||
/* Hold vfsmount and dentry until release is finished */
|
||||
ff->reserved_req->vfsmount = mntget(file->f_path.mnt);
|
||||
ff->reserved_req->dentry = dget(file->f_path.dentry);
|
||||
|
||||
spin_lock(&fc->lock);
|
||||
list_del(&ff->write_entry);
|
||||
spin_unlock(&fc->lock);
|
||||
/*
|
||||
* Normally this will send the RELEASE request,
|
||||
* however if some asynchronous READ or WRITE requests
|
||||
|
Reference in New Issue
Block a user