kernel: sync with mainline...
authorMiklos Szeredi <miklos@szeredi.hu>
Wed, 2 May 2007 17:48:09 +0000 (17:48 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Wed, 2 May 2007 17:48:09 +0000 (17:48 +0000)
ChangeLog
configure.in
kernel/configure.ac
kernel/control.c
kernel/dev.c
kernel/dir.c
kernel/file.c
kernel/fuse_i.h
kernel/inode.c

index a69815813bf5fecdbf96bc67f27effe7003f44e4..b4bddacde367d0868542c7ec1ea653c365ae0ecf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
index d722d16fa87156a2c1087fda065ba365dbfc600e..5c34ef1a60926e5e882f14d13d520428d3590187 100644 (file)
@@ -1,4 +1,4 @@
-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)
index 115c42891ba81aefd7ef645f128a1429b69db81e..0427afd169cdcae5341f8634925d9108fc7139a4 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(fuse-kernel, 2.7.0-pre1)
+AC_INIT(fuse-kernel, 2.7.0-rc1)
 AC_CONFIG_HEADERS([config.h])
 
 AC_PROG_INSTALL
index 6b86fc01efc94c729c2ff08d6c9e54f885eb455f..5ffe6ba7387dbf0b95531c71a66bd7edc48faae5 100644 (file)
@@ -77,7 +77,7 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name)
 {
        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);
@@ -87,7 +87,11 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent,
                                          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
index 773b9237ae5b49789c64973afa6a5844b3b472b3..aaef08239be308f35b26e8a108c73ba8ecfe26d2 100644 (file)
@@ -21,7 +21,7 @@
 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)
 {
index 32e6003f7a9ce89966227afa68cefc75cd143931..121a35004303710c1931bafb2bb25660f21d92df 100644 (file)
@@ -195,7 +195,7 @@ static struct dentry_operations fuse_dentry_operations = {
        .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);
@@ -250,7 +250,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
        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,
index e7b52c528d59aaac16845e7a2f3fb6cabf9106e6..fc03b1e7a5d8cec67e5ba5cb6b54832135affa23 100644 (file)
@@ -75,7 +75,11 @@ void fuse_finish_open(struct inode *inode, struct file *file,
        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;
 }
index 6d084e2c574d53b6aed75692440c17ba80a36bf2..b9a9ac37a560805e9c40dbabd85edb0e78a9536c 100644 (file)
 #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 */
@@ -617,3 +623,8 @@ int fuse_ctl_add_conn(struct fuse_conn *fc);
  * Remove connection from control filesystem
  */
 void fuse_ctl_remove_conn(struct fuse_conn *fc);
+
+/**
+ * Is file type valid?
+ */
+int fuse_valid_type(int m);
index 9cdf5b1411292d25368071a948a256ecd101dc8d..e52942784a1243337b36b55aa397710fabcfe334 100644 (file)
@@ -24,7 +24,7 @@ MODULE_DESCRIPTION("Filesystem in Userspace");
 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);
 
@@ -124,7 +124,11 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
 {
        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);
@@ -360,6 +364,8 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev)
                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;
@@ -805,7 +811,7 @@ static decl_subsys(fs, NULL, NULL);
 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;