--- zzzz-none-000/linux-2.6.19.2/fs/fuse/dev.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/fs/fuse/dev.c 2008-07-04 09:37:55.000000000 +0000 @@ -19,7 +19,7 @@ MODULE_ALIAS_MISCDEV(FUSE_MINOR); -static kmem_cache_t *fuse_req_cachep; +static struct kmem_cache *fuse_req_cachep; static struct fuse_conn *fuse_get_conn(struct file *file) { @@ -41,7 +41,7 @@ struct fuse_req *fuse_request_alloc(void) { - struct fuse_req *req = kmem_cache_alloc(fuse_req_cachep, SLAB_KERNEL); + struct fuse_req *req = kmem_cache_alloc(fuse_req_cachep, GFP_KERNEL); if (req) fuse_request_init(req); return req; @@ -482,6 +482,9 @@ { unsigned long offset; int err; +#ifdef DCACHE_BUG + struct vm_area_struct *vma; +#endif unlock_request(cs->fc, cs->req); fuse_copy_finish(cs); @@ -493,14 +496,24 @@ cs->nr_segs --; } down_read(¤t->mm->mmap_sem); + + +#ifndef DCACHE_BUG err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0, - &cs->pg, NULL); + &cs->pg, NULL); +#else + err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0, + &cs->pg, &vma); +#endif up_read(¤t->mm->mmap_sem); if (err < 0) return err; BUG_ON(err != 1); offset = cs->addr % PAGE_SIZE; cs->mapaddr = kmap_atomic(cs->pg, KM_USER0); +#ifdef DCACHE_BUG + flush_cache_page(vma, cs->addr, page_to_pfn(cs->pg)); +#endif cs->buf = cs->mapaddr + offset; cs->len = min(PAGE_SIZE - offset, cs->seglen); cs->seglen -= cs->len; @@ -815,29 +828,36 @@ struct fuse_out_header oh; struct fuse_copy_state cs; struct fuse_conn *fc = fuse_get_conn(iocb->ki_filp); - if (!fc) + + if (!fc) { return -EPERM; +} fuse_copy_init(&cs, fc, 0, NULL, iov, nr_segs); - if (nbytes < sizeof(struct fuse_out_header)) + if (nbytes < sizeof(struct fuse_out_header)) { return -EINVAL; + } err = fuse_copy_one(&cs, &oh, sizeof(oh)); - if (err) + if (err) { goto err_finish; + } err = -EINVAL; if (!oh.unique || oh.error <= -1000 || oh.error > 0 || - oh.len != nbytes) + oh.len != nbytes) { goto err_finish; + } spin_lock(&fc->lock); err = -ENOENT; - if (!fc->connected) + if (!fc->connected) { goto err_unlock; + } req = request_find(fc, oh.unique); - if (!req) + if (!req) { goto err_unlock; + } if (req->aborted) { spin_unlock(&fc->lock); @@ -849,8 +869,9 @@ /* Is it an interrupt reply? */ if (req->intr_unique == oh.unique) { err = -EINVAL; - if (nbytes != sizeof(struct fuse_out_header)) + if (nbytes != sizeof(struct fuse_out_header)) { goto err_unlock; + } if (oh.error == -ENOSYS) fc->no_interrupt = 1;