kernel: sync with mainline...

This commit is contained in:
Miklos Szeredi 2007-05-02 17:48:09 +00:00
parent 79b6209843
commit b318b3d69b
9 changed files with 43 additions and 8 deletions

View File

@ -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

View 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)

View 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

View 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

View 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)
{

View 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,

View 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;
}

View File

@ -41,10 +41,16 @@
#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);

View 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;