Commit 1d9a8a47 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
  fuse: implement nonseekable open
  fuse: add include protectors
  fuse: config description improvement
  fuse: add missing fuse_request_free
  fuse: fix SEEK_END incorrectness
parents f07767fd a7c1b990
...@@ -403,7 +403,7 @@ config AUTOFS4_FS ...@@ -403,7 +403,7 @@ config AUTOFS4_FS
N here. N here.
config FUSE_FS config FUSE_FS
tristate "Filesystem in Userspace support" tristate "FUSE (Filesystem in Userspace) support"
help help
With FUSE it is possible to implement a fully functional filesystem With FUSE it is possible to implement a fully functional filesystem
in a userspace program. in a userspace program.
......
...@@ -101,6 +101,8 @@ void fuse_finish_open(struct inode *inode, struct file *file, ...@@ -101,6 +101,8 @@ void fuse_finish_open(struct inode *inode, struct file *file,
file->f_op = &fuse_direct_io_file_operations; file->f_op = &fuse_direct_io_file_operations;
if (!(outarg->open_flags & FOPEN_KEEP_CACHE)) if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
invalidate_inode_pages2(inode->i_mapping); invalidate_inode_pages2(inode->i_mapping);
if (outarg->open_flags & FOPEN_NONSEEKABLE)
nonseekable_open(inode, file);
ff->fh = outarg->fh; ff->fh = outarg->fh;
file->private_data = fuse_file_get(ff); file->private_data = fuse_file_get(ff);
} }
...@@ -1448,6 +1450,9 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -1448,6 +1450,9 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
switch (origin) { switch (origin) {
case SEEK_END: case SEEK_END:
retval = fuse_update_attributes(inode, NULL, file, NULL);
if (retval)
return retval;
offset += i_size_read(inode); offset += i_size_read(inode);
break; break;
case SEEK_CUR: case SEEK_CUR:
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
See the file COPYING. See the file COPYING.
*/ */
#ifndef _FS_FUSE_I_H
#define _FS_FUSE_I_H
#include <linux/fuse.h> #include <linux/fuse.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/mount.h> #include <linux/mount.h>
...@@ -655,3 +658,5 @@ void fuse_set_nowrite(struct inode *inode); ...@@ -655,3 +658,5 @@ void fuse_set_nowrite(struct inode *inode);
void fuse_release_nowrite(struct inode *inode); void fuse_release_nowrite(struct inode *inode);
u64 fuse_get_attr_version(struct fuse_conn *fc); u64 fuse_get_attr_version(struct fuse_conn *fc);
#endif /* _FS_FUSE_I_H */
...@@ -865,7 +865,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) ...@@ -865,7 +865,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
if (is_bdev) { if (is_bdev) {
fc->destroy_req = fuse_request_alloc(); fc->destroy_req = fuse_request_alloc();
if (!fc->destroy_req) if (!fc->destroy_req)
goto err_put_root; goto err_free_init_req;
} }
mutex_lock(&fuse_mutex); mutex_lock(&fuse_mutex);
...@@ -895,6 +895,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) ...@@ -895,6 +895,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
err_unlock: err_unlock:
mutex_unlock(&fuse_mutex); mutex_unlock(&fuse_mutex);
err_free_init_req:
fuse_request_free(init_req); fuse_request_free(init_req);
err_put_root: err_put_root:
dput(root_dentry); dput(root_dentry);
......
...@@ -17,8 +17,14 @@ ...@@ -17,8 +17,14 @@
* - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
* - add blksize field to fuse_attr * - add blksize field to fuse_attr
* - add file flags field to fuse_read_in and fuse_write_in * - add file flags field to fuse_read_in and fuse_write_in
*
* 7.10
* - add nonseekable open flag
*/ */
#ifndef _LINUX_FUSE_H
#define _LINUX_FUSE_H
#include <asm/types.h> #include <asm/types.h>
#include <linux/major.h> #include <linux/major.h>
...@@ -26,7 +32,7 @@ ...@@ -26,7 +32,7 @@
#define FUSE_KERNEL_VERSION 7 #define FUSE_KERNEL_VERSION 7
/** Minor version number of this interface */ /** Minor version number of this interface */
#define FUSE_KERNEL_MINOR_VERSION 9 #define FUSE_KERNEL_MINOR_VERSION 10
/** The node ID of the root inode */ /** The node ID of the root inode */
#define FUSE_ROOT_ID 1 #define FUSE_ROOT_ID 1
...@@ -98,9 +104,11 @@ struct fuse_file_lock { ...@@ -98,9 +104,11 @@ struct fuse_file_lock {
* *
* FOPEN_DIRECT_IO: bypass page cache for this open file * FOPEN_DIRECT_IO: bypass page cache for this open file
* FOPEN_KEEP_CACHE: don't invalidate the data cache on open * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
* FOPEN_NONSEEKABLE: the file is not seekable
*/ */
#define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_DIRECT_IO (1 << 0)
#define FOPEN_KEEP_CACHE (1 << 1) #define FOPEN_KEEP_CACHE (1 << 1)
#define FOPEN_NONSEEKABLE (1 << 2)
/** /**
* INIT request/reply flags * INIT request/reply flags
...@@ -409,3 +417,5 @@ struct fuse_dirent { ...@@ -409,3 +417,5 @@ struct fuse_dirent {
#define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1))
#define FUSE_DIRENT_SIZE(d) \ #define FUSE_DIRENT_SIZE(d) \
FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
#endif /* _LINUX_FUSE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment