+2007-05-02 Miklos Szeredi <miklos@szeredi.hu>
+
+ * kernel: sync with mainline:
+
+ * Use invalidate_mapping_pages() if available
+
+ * Fix BUG when invalid file type is supplied in mount. Patch by
+ Timo Savola
+
2007-04-27 Miklos Szeredi <miklos@szeredi.hu>
* libfuse: call umount(8) directly instead of fusermount if
-AC_INIT(fuse, 2.7.0-pre1)
+AC_INIT(fuse, 2.7.0-rc1)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(include/config.h)
-AC_INIT(fuse-kernel, 2.7.0-pre1)
+AC_INIT(fuse-kernel, 2.7.0-rc1)
AC_CONFIG_HEADERS([config.h])
AC_PROG_INSTALL
{
struct qstr q;
- q.name = name;
+ q.name = (const unsigned char *) name;
q.len = strlen(name);
q.hash = full_name_hash(q.name, q.len);
return d_alloc(parent, &q);
struct fuse_conn *fc,
const char *name,
int mode, int nlink,
+#ifdef KERNEL_2_6_21_PLUS
+ const struct inode_operations *iop,
+#else
struct inode_operations *iop,
+#endif
#ifdef KERNEL_2_6_17_PLUS
const struct file_operations *fop
#else
MODULE_ALIAS_MISCDEV(FUSE_MINOR);
#endif
-static kmem_cache_t *fuse_req_cachep;
+static struct kmem_cache *fuse_req_cachep;
static struct fuse_conn *fuse_get_conn(struct file *file)
{
.d_revalidate = fuse_dentry_revalidate,
};
-static int valid_mode(int m)
+int fuse_valid_type(int m)
{
return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) ||
S_ISBLK(m) || S_ISFIFO(m) || S_ISSOCK(m);
fuse_put_request(fc, req);
/* Zero nodeid is same as -ENOENT, but with valid timeout */
if (!err && outarg.nodeid &&
- (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode)))
+ (invalid_nodeid(outarg.nodeid) ||
+ !fuse_valid_type(outarg.attr.mode)))
err = -EIO;
if (!err && outarg.nodeid) {
inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
if (outarg->open_flags & FOPEN_DIRECT_IO)
file->f_op = &fuse_direct_io_file_operations;
if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
+#ifdef KERNEL_2_6_21_PLUS
+ invalidate_mapping_pages(inode->i_mapping, 0, -1);
+#else
invalidate_inode_pages(inode->i_mapping);
+#endif
ff->fh = outarg->fh;
file->private_data = ff;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
# define KERNEL_2_6_19_PLUS
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)
+# define KERNEL_2_6_21_PLUS
+#endif
#if defined(__arm__) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#define DCACHE_BUG
#endif
+#ifndef KERNEL_2_6_15_PLUS
+#define kmem_cache kmem_cache_s
+#endif
#include "config.h"
#endif /* FUSE_MAINLINE */
* Remove connection from control filesystem
*/
void fuse_ctl_remove_conn(struct fuse_conn *fc);
+
+/**
+ * Is file type valid?
+ */
+int fuse_valid_type(int m);
MODULE_LICENSE("GPL");
#endif
-static kmem_cache_t *fuse_inode_cachep;
+static struct kmem_cache *fuse_inode_cachep;
struct list_head fuse_conn_list;
DEFINE_MUTEX(fuse_mutex);
{
struct fuse_conn *fc = get_fuse_conn(inode);
if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size)
+#ifdef KERNEL_2_6_21_PLUS
+ invalidate_mapping_pages(inode->i_mapping, 0, -1);
+#else
invalidate_inode_pages(inode->i_mapping);
+#endif
inode->i_ino = attr->ino;
inode->i_mode = (inode->i_mode & S_IFMT) + (attr->mode & 07777);
case OPT_ROOTMODE:
if (match_octal(&args[0], &value))
return 0;
+ if (!fuse_valid_type(value))
+ return 0;
d->rootmode = value;
d->rootmode_present = 1;
break;
static decl_subsys(fuse, NULL, NULL);
static decl_subsys(connections, NULL, NULL);
-static void fuse_inode_init_once(void *foo, kmem_cache_t *cachep,
+static void fuse_inode_init_once(void *foo, struct kmem_cache *cachep,
unsigned long flags)
{
struct inode * inode = foo;