patch for vanilla kernel 2.6.24

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

patch for vanilla kernel 2.6.24

Lino Sanfilippo


Geschäftsführender Gesellschafter: Tjark Auerbach
Sitz der Gesellschaft: Tettnang
Handelsregister: Amtsgericht Ulm, HRB 630992
ALLGEMEINE GESCHÄFTSBEDINGUNGEN
Es gelten unsere Allgemeinen Geschäftsbedingungen
(AGB). Sie finden sie in der jeweils gültigen Fassung
im Internet unter http://www.avira.de/agb
***************************************************
diff -x CVS -rup dazukofs-3.0.0/CHANGELOG dazukofs-3.0.0-rc4_2.6.24/CHANGELOG
--- dazukofs-3.0.0/CHANGELOG 2009-02-22 17:51:22.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/CHANGELOG 2008-12-12 16:32:44.000000000 +0100
@@ -2,11 +2,6 @@
  DazukoFS CHANGELOG
 ====================
 
-3.0.0 (2009-02-22)
-- added define for version number output
-- added patches for various other kernels
-
-
 3.0.0-rc4 (2008-11-30)
 - fix incorrect dentry/vfsmnt referencing when access denied
 - fix improper cleanup in several error handling conditions
diff -x CVS -rup dazukofs-3.0.0/ctrl_dev.c dazukofs-3.0.0-rc4_2.6.24/ctrl_dev.c
--- dazukofs-3.0.0/ctrl_dev.c 2009-02-22 17:45:20.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/ctrl_dev.c 2008-12-12 16:32:44.000000000 +0100
@@ -183,7 +183,7 @@ int dazukofs_ctrl_dev_init(int dev_major
 
  /* create control device */
  dev = device_create(dazukofs_class, NULL, MKDEV(dev_major, dev_minor),
-    NULL, "%s.ctrl", DEVICE_NAME);
+    "%s.ctrl", DEVICE_NAME);
  if (IS_ERR(dev)) {
  err = PTR_ERR(dev);
  goto error_out2;
diff -x CVS -rup dazukofs-3.0.0/dazukofs_fs.h dazukofs-3.0.0-rc4_2.6.24/dazukofs_fs.h
--- dazukofs-3.0.0/dazukofs_fs.h 2009-02-22 17:43:11.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/dazukofs_fs.h 2009-07-03 18:01:00.000000000 +0200
@@ -3,7 +3,7 @@
    Copyright (C) 1997-2004 Erez Zadok
    Copyright (C) 2001-2004 Stony Brook University
    Copyright (C) 2004-2007 International Business Machines Corp.
-   Copyright (C) 2008-2009 John Ogness
+   Copyright (C) 2008 John Ogness
      Author: John Ogness <[hidden email]>
 
    This program is free software; you can redistribute it and/or
@@ -24,8 +24,6 @@
 #ifndef __DAZUKOFS_FS_H
 #define __DAZUKOFS_FS_H
 
-#define DAZUKOFS_VERSION "3.0.0"
-
 extern struct kmem_cache *dazukofs_dentry_info_cachep;
 extern struct kmem_cache *dazukofs_file_info_cachep;
 extern struct file_operations dazukofs_main_fops;
diff -x CVS -rup dazukofs-3.0.0/dentry.c dazukofs-3.0.0-rc4_2.6.24/dentry.c
--- dazukofs-3.0.0/dentry.c 2009-02-22 17:44:22.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/dentry.c 2008-12-12 16:41:34.000000000 +0100
@@ -65,19 +65,19 @@ static int dazukofs_d_revalidate(struct
 
  lower_mnt = GET_LOWER_MNT(dentry);
 
- vfsmount_save = nd->path.mnt;
- dentry_save = nd->path.dentry;
+ vfsmount_save = nd->mnt;
+ dentry_save = nd->dentry;
 
- nd->path.mnt = mntget(lower_mnt);
- nd->path.dentry = dget(lower_dentry);
+ nd->mnt = mntget(lower_mnt);
+ nd->dentry = dget(lower_dentry);
 
  valid = lower_dentry->d_op->d_revalidate(lower_dentry, nd);
 
  mntput(lower_mnt);
  dput(lower_dentry);
 
- nd->path.mnt = vfsmount_save;
- nd->path.dentry = dentry_save;
+ nd->mnt = vfsmount_save;
+ nd->dentry = dentry_save;
 
  /* update the inode, even if d_revalidate() != 1 */
  if (dentry->d_inode) {
diff -x CVS -rup dazukofs-3.0.0/event.c dazukofs-3.0.0-rc4_2.6.24/event.c
--- dazukofs-3.0.0/event.c 2009-02-22 17:44:03.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/event.c 2009-07-03 18:55:51.000000000 +0200
@@ -23,7 +23,6 @@
 #include <linux/file.h>
 #include <linux/fs.h>
 #include <linux/mount.h>
-#include <linux/freezer.h>
 
 #include "dev.h"
 #include "dazukofs_fs.h"
@@ -162,16 +161,23 @@ static int capture_group_count(int *cach
  return err;
 }
 
-static int get_group_count(void)
+static int get_group_count_interruptible(void)
 {
  int cache = 0;
- int ret = wait_event_freezable(__group_count_queue,
-       capture_group_count(&cache) == 0);
+ int ret = wait_event_interruptible(__group_count_queue,
+           capture_group_count(&cache) == 0);
  if (ret == 0)
  ret = __group_count;
  return ret;
 }
 
+static int get_group_count(void)
+{
+ int cache = 0;
+ wait_event(__group_count_queue, capture_group_count(&cache) == 0);
+ return __group_count;
+}
+
 static void put_group_count(void)
 {
  mutex_lock(&group_count_mutex);
@@ -399,7 +405,7 @@ int dazukofs_add_group(const char *name,
  int already_exists;
  int available_id = 0;
  struct dazukofs_group *grp;
- int grp_count = get_group_count();
+ int grp_count = get_group_count_interruptible();
 
  if (grp_count < 0) {
  ret = grp_count;
@@ -447,7 +453,7 @@ int dazukofs_remove_group(const char *na
  int ret = 0;
  struct dazukofs_group *grp;
  struct list_head *pos;
- int grp_count = get_group_count();
+ int grp_count = get_group_count_interruptible();
 
  if (grp_count < 0) {
  ret = grp_count;
@@ -701,11 +707,10 @@ int dazukofs_check_access(struct dentry
 {
  struct dazukofs_event_container *ec_array[GROUP_COUNT];
  struct dazukofs_event *evt;
- int grp_count = get_group_count();
- int err;
+ int grp_count;
+ int err = 0;
 
- if (grp_count < 0)
- return grp_count;
+ grp_count = get_group_count();
 
  if (check_access_precheck(grp_count)) {
  put_group_count();
@@ -713,32 +718,29 @@ int dazukofs_check_access(struct dentry
  }
 
  /* at this point, the access should be handled */
-
  if (allocate_event_and_containers(&evt, ec_array, grp_count)) {
  put_group_count();
- err = -ENOMEM;
- goto out;
+ return -ENOMEM;
  }
-
  evt->dentry = dget(dentry);
  evt->mnt = mntget(mnt);
  evt->pid = current->pid;
-
  assign_event_to_groups(evt, ec_array);
 
  put_group_count();
 
- /* wait until event completely processed or signal */
- err = wait_event_freezable(evt->queue, event_assigned(evt) == 0);
+ /* wait until event completely processed */
+ wait_event(evt->queue, event_assigned(evt) == 0);
 
  if (evt->deny)
  err = -EPERM;
 
  release_event(evt, 0, 0);
-out:
+
  return err;
 }
 
+
 int dazukofs_group_open_tracking(unsigned long group_id)
 {
  struct dazukofs_group *grp;
@@ -928,7 +930,8 @@ static int open_file(struct dazukofs_eve
  /* add myself to be ignored on file open (to avoid recursion) */
  mask_proc(&proc);
 
- ec->file = dentry_open(dget(evt->dentry), mntget(evt->mnt), O_RDONLY);
+ ec->file = dentry_open(dget(evt->dentry), mntget(evt->mnt),
+       O_RDONLY | O_LARGEFILE);
  if (IS_ERR(ec->file)) {
  check_recursion();  /* remove myself from proc_list */
  ret = PTR_ERR(ec->file);
@@ -1004,9 +1007,9 @@ int dazukofs_get_event(unsigned long gro
  }
 
  while (1) {
- ret = wait_event_freezable(grp->queue,
-   is_event_available(grp) ||
-   grp->deprecated);
+ ret = wait_event_interruptible(grp->queue,
+       is_event_available(grp) ||
+       grp->deprecated);
  if (ret != 0)
  break;
 
diff -x CVS -rup dazukofs-3.0.0/file.c dazukofs-3.0.0-rc4_2.6.24/file.c
--- dazukofs-3.0.0/file.c 2009-02-22 17:43:11.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/file.c 2009-07-03 18:52:14.000000000 +0200
@@ -177,10 +177,11 @@ static int dazukofs_open(struct inode *i
  struct file *lower_file;
  int err;
 
- err = dazukofs_check_access(file->f_dentry, file->f_vfsmnt);
- if (err)
- goto error_out1;
-
+ if (S_ISREG(inode->i_mode)) {
+ err = dazukofs_check_access(file->f_dentry, file->f_vfsmnt);
+ if (err)
+ goto error_out1;
+ }
  SET_FILE_INFO(file, kmem_cache_zalloc(dazukofs_file_info_cachep,
       GFP_KERNEL));
  if (!GET_FILE_INFO(file)) {
@@ -272,6 +273,20 @@ out:
  return err;
 }
 
+static int dazukofs_mmap (struct file *file, struct vm_area_struct *vm)
+{
+
+ struct file *lower_file = GET_LOWER_FILE(file);
+
+ /* if lower fs does not support mmap(), we dont call generic_file_readonly_mmap(),
+ * since this would result in calling lower readpage(), which might not be
+ * defined by lower fs if mmap() is not supported*/
+ if (!lower_file->f_op || !lower_file->f_op->mmap)
+ return -ENODEV;
+
+
+ return generic_file_readonly_mmap(file, vm);
+}
 /**
  * Unused operations:
  *   - owner
@@ -295,18 +310,15 @@ out:
 struct file_operations dazukofs_main_fops = {
  .llseek = dazukofs_llseek,
  .read = dazukofs_read,
- .aio_read = generic_file_aio_read,
  .write = dazukofs_write,
- .aio_write = generic_file_aio_write,
  .readdir = dazukofs_readdir,
  .ioctl = dazukofs_ioctl,
- .mmap = generic_file_mmap,
+ .mmap = dazukofs_mmap,
  .open = dazukofs_open,
  .flush = dazukofs_flush,
  .release = dazukofs_release,
  .fsync = dazukofs_fsync,
  .fasync = dazukofs_fasync,
- .splice_read = generic_file_splice_read,
 };
 
 /**
@@ -335,11 +347,10 @@ struct file_operations dazukofs_main_fop
 const struct file_operations dazukofs_dir_fops = {
  .readdir = dazukofs_readdir,
  .ioctl = dazukofs_ioctl,
- .mmap = generic_file_mmap,
+ .mmap = dazukofs_mmap,
  .open = dazukofs_open,
  .flush = dazukofs_flush,
  .release = dazukofs_release,
  .fsync = dazukofs_fsync,
  .fasync = dazukofs_fasync,
- .splice_read = generic_file_splice_read,
 };
diff -x CVS -rup dazukofs-3.0.0/group_dev.c dazukofs-3.0.0-rc4_2.6.24/group_dev.c
--- dazukofs-3.0.0/group_dev.c 2009-02-22 17:45:20.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/group_dev.c 2008-12-12 16:32:44.000000000 +0100
@@ -210,7 +210,7 @@ int dazukofs_group_dev_init(int dev_majo
  /* create group devices */
  for (i = 0; i < GROUP_COUNT; i++) {
  dev = device_create(dazukofs_class, NULL,
-    MKDEV(dev_major, dev_minor_end), NULL,
+    MKDEV(dev_major, dev_minor_end),
     "%s.%d", DEVICE_NAME, i);
  if (IS_ERR(dev)) {
  err = PTR_ERR(dev);
diff -x CVS -rup dazukofs-3.0.0/ign_dev.c dazukofs-3.0.0-rc4_2.6.24/ign_dev.c
--- dazukofs-3.0.0/ign_dev.c 2009-02-22 17:45:20.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/ign_dev.c 2008-12-12 16:32:44.000000000 +0100
@@ -159,7 +159,7 @@ int dazukofs_ign_dev_init(int dev_major,
 
  /* create ignore device */
  dev = device_create(dazukofs_class, NULL, MKDEV(dev_major, dev_minor),
-    NULL, "%s.ign", DEVICE_NAME);
+    "%s.ign", DEVICE_NAME);
  if (IS_ERR(dev)) {
  err = PTR_ERR(dev);
  goto error_out3;
diff -x CVS -rup dazukofs-3.0.0/inode.c dazukofs-3.0.0-rc4_2.6.24/inode.c
--- dazukofs-3.0.0/inode.c 2009-02-22 17:46:02.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/inode.c 2009-07-03 18:40:07.000000000 +0200
@@ -47,12 +47,25 @@ static int dazukofs_inode_test(struct in
 
 static void dazukofs_init_inode(struct inode *inode, struct inode *lower_inode)
 {
- SET_LOWER_INODE(inode, lower_inode);
- inode->i_ino = lower_inode->i_ino;
- inode->i_version++;
- inode->i_op = &dazukofs_main_iops;
- inode->i_fop = &dazukofs_main_fops;
- inode->i_mapping->a_ops = &dazukofs_aops;
+        SET_LOWER_INODE(inode, lower_inode);
+        inode->i_ino = lower_inode->i_ino;
+        inode->i_version++;
+
+        if (S_ISDIR(lower_inode->i_mode)) {
+                inode->i_op = &dazukofs_dir_iops;
+                inode->i_fop = &dazukofs_dir_fops;
+        } else {
+                inode->i_op = &dazukofs_main_iops;
+                inode->i_fop = &dazukofs_main_fops;
+
+                if (S_ISLNK(lower_inode->i_mode))
+                        inode->i_op = &dazukofs_symlink_iops;
+                else  if (special_file(lower_inode->i_mode)) {
+                        init_special_inode(inode, lower_inode->i_mode,
+                                           lower_inode->i_rdev);
+                }
+        }
+        inode->i_mapping->a_ops = &dazukofs_aops;
 }
 
 static int dazukofs_inode_set(struct inode *inode, void *lower_inode)
@@ -61,73 +74,119 @@ static int dazukofs_inode_set(struct ino
  return 0;
 }
 
+
 int dazukofs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
-     struct super_block *sb, int flag)
+     struct super_block *sb, int hash)
 {
  struct inode *inode;
- struct inode *lower_inode = igrab(lower_dentry->d_inode);
- int err = 0;
+ struct inode *lower_inode;
+ int err;
 
- if (!lower_inode) {
- err = -ESTALE;
- goto out;
- }
+ lower_inode = igrab(lower_dentry->d_inode);
 
- if (lower_inode->i_sb != GET_LOWER_SB(sb)) {
- iput(lower_inode);
- err = -EXDEV;
- goto out;
- }
+ if (!lower_inode)
+ return -ESTALE;
 
  inode = iget5_locked(sb, (unsigned long)lower_inode,
      dazukofs_inode_test, dazukofs_inode_set,
      lower_inode);
-
  if (!inode) {
- iput(lower_inode);
  err = -EACCES;
- goto out;
+ goto err;
  }
 
- if (inode->i_state & I_NEW) {
+ if (inode->i_state & I_NEW)
  unlock_new_inode(inode);
  /*
  * This is a new node so we leave the lower_node "in use"
  * and do not call iput().
  */
- } else {
+ else
  /*
  * This is not a new node so we decrement the usage count.
  */
  iput(lower_inode);
- }
 
- if (S_ISLNK(lower_inode->i_mode))
- inode->i_op = &dazukofs_symlink_iops;
- else if (S_ISDIR(lower_inode->i_mode))
- inode->i_op = &dazukofs_dir_iops;
-
- if (S_ISDIR(lower_inode->i_mode))
- inode->i_fop = &dazukofs_dir_fops;
-
- if (special_file(lower_inode->i_mode)) {
- init_special_inode(inode, lower_inode->i_mode,
-   lower_inode->i_rdev);
- }
-
- dentry->d_op = &dazukofs_dops;
 
- if (flag)
+ if (hash)
  d_add(dentry, inode);
  else
  d_instantiate(dentry, inode);
 
  fsstack_copy_attr_all(inode, lower_inode, NULL);
  fsstack_copy_inode_size(inode, lower_inode);
-out:
+
+ return 0;
+err:
+ iput(lower_inode);
  return err;
 }
 
+/* creates a new lower dentry */
+static struct dentry *dazukofs_new_lower_dentry(struct qstr *name,
+ struct dentry *lower_base,
+ struct nameidata *nd)
+{
+ struct dentry *new_dentry;
+ struct dentry *tmp;
+ struct inode *lower_inode;
+
+ lower_inode = lower_base->d_inode;
+ /* XXX: is this check still necessary? (see __lookup_hash())
+   This is (hopely) protected by locked upper inode */
+ if (IS_DEADDIR(lower_inode)) {
+ new_dentry = ERR_PTR(-ENOENT);
+ goto out;
+ }
+ tmp = d_alloc(lower_base, name);
+ if (!tmp) {
+ new_dentry = ERR_PTR(-ENOMEM);
+ goto out;
+ }
+ new_dentry = lower_inode->i_op->lookup(lower_inode, tmp, nd);
+ /* lookup() seemingly is allowed to return its own dentry (which
+ * may indeed be a dentry or only an error). If so
+ * we use it and discard ours. Otherwise we use ours */
+ if (!new_dentry)
+ new_dentry = tmp;
+ else
+ dput(tmp);
+
+out:
+ return new_dentry;
+}
+
+
+/* get lower dentry for given name */
+static struct dentry *dazukofs_lookup_one_lower(struct qstr *name,
+ struct dentry *lower_base,
+ struct vfsmount *lower_mnt)
+{
+ struct dentry *result;
+ struct nameidata nd;
+ int err;
+
+ err = vfs_path_lookup(lower_base, lower_mnt, name->name, 0, &nd);
+
+ if (!err) {
+ /* inode already exists on disk */
+ result = nd.dentry;
+ /* we dont need the mount */
+ mntput(nd.mnt);
+ goto out;
+ }
+ if (err != -ENOENT) { /* this is a REAL error */
+ result = ERR_PTR(err);
+ goto out;
+ }
+ /* create a new (lower) dentry */
+ result = dazukofs_new_lower_dentry(name, lower_base, &nd);
+out:
+ return result;
+
+}
+
+
 /**
  * Description: Called when the VFS needs to look up an inode in a parent
  * directory. The name to look for is found in the dentry. This method
@@ -148,62 +207,48 @@ static struct dentry *dazukofs_lookup(st
  struct dentry *lower_dentry;
  struct dentry *lower_dentry_parent;
  struct vfsmount *lower_mnt;
- int err = 0;
-
- if ((dentry->d_name.len == 1 && !strcmp(dentry->d_name.name, "."))
-    || (dentry->d_name.len == 2 &&
- !strcmp(dentry->d_name.name, ".."))) {
- d_drop(dentry);
- goto out;
- }
-
- dentry->d_op = &dazukofs_dops;
+ int err;
 
  lower_dentry_parent = GET_LOWER_DENTRY(dentry->d_parent);
- lower_dentry = lookup_one_len(dentry->d_name.name, lower_dentry_parent,
-      dentry->d_name.len);
+ /* should be released in d_release() */
+ lower_mnt = mntget(GET_LOWER_MNT(dentry->d_parent));
 
+ lower_dentry = dazukofs_lookup_one_lower(&dentry->d_name,
+ lower_dentry_parent,
+ lower_mnt);
  if (IS_ERR(lower_dentry)) {
- err = PTR_ERR(lower_dentry);
- d_drop(dentry);
- goto out;
+ mntput(lower_mnt);
+ return lower_dentry;
  }
-
  BUG_ON(!atomic_read(&lower_dentry->d_count));
 
+ dentry->d_op = &dazukofs_dops;
  SET_DENTRY_INFO(dentry, kmem_cache_zalloc(dazukofs_dentry_info_cachep,
  GFP_KERNEL));
 
  if (!GET_DENTRY_INFO(dentry)) {
- err = -ENOMEM;
- goto out_dput;
+ mntput(lower_mnt);
+ dput(lower_dentry);
+ return ERR_PTR(-ENOMEM);
  }
-
- lower_mnt = mntget(GET_LOWER_MNT(dentry->d_parent));
-
- fsstack_copy_attr_atime(dir, lower_dentry_parent->d_inode);
-
  SET_LOWER_DENTRY(dentry, lower_dentry, lower_mnt);
-
+ /* from now lower dentry and lower mount are released in
+  d_release of upper dentry */
+ fsstack_copy_attr_atime(dir, lower_dentry_parent->d_inode);
  if (!lower_dentry->d_inode) {
  /*
  * We want to add because we could not find in lower.
  */
  d_add(dentry, NULL);
- goto out;
+ goto ok;
  }
 
  err = dazukofs_interpose(lower_dentry, dentry, dir->i_sb, 1);
- if (err)
- goto out_dput;
- goto out;
-
-out_dput:
- dput(lower_dentry);
- d_drop(dentry);
+ if (err)
+ return ERR_PTR(err);
 
-out:
- return ERR_PTR(err);
+ok:
+ return NULL; /* tell caller to use its own, passed dentry, not ours */
 }
 
 /**
@@ -294,19 +339,19 @@ static int dazukofs_create(struct inode
  mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
   I_MUTEX_PARENT);
 
- vfsmount_save = nd->path.mnt;
- dentry_save = nd->path.dentry;
+ vfsmount_save = nd->mnt;
+ dentry_save = nd->dentry;
 
- nd->path.mnt = mntget(lower_mnt);
- nd->path.dentry = dget(lower_dentry);
+ nd->mnt = mntget(lower_mnt);
+ nd->dentry = dget(lower_dentry);
 
  err = vfs_create(lower_dentry_parent_inode, lower_dentry, mode, nd);
 
  mntput(lower_mnt);
  dput(lower_dentry);
 
- nd->path.mnt = vfsmount_save;
- nd->path.dentry = dentry_save;
+ nd->mnt = vfsmount_save;
+ nd->dentry = dentry_save;
 
  if (err)
  goto out;
@@ -340,7 +385,8 @@ static int dazukofs_symlink(struct inode
  mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
   I_MUTEX_PARENT);
 
- err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, symname);
+ err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, symname,
+  S_IALLUGO);
  if (err)
  goto out;
 
@@ -452,9 +498,37 @@ static void dazukofs_put_link(struct den
  * Description: Called by the VFS to check for access rights on a
  * POSIX-like filesystem.
  */
-static int dazukofs_permission(struct inode *inode, int mask)
+static int dazukofs_permission(struct inode *inode, int mask,
+       struct nameidata *nd)
 {
- return inode_permission(GET_LOWER_INODE(inode), mask);
+ struct vfsmount *lower_mnt = NULL;
+ struct dentry *lower_dentry = NULL;
+ struct vfsmount *vfsmnt_save = NULL;
+ struct dentry *dentry_save = NULL;
+ int err;
+
+ if (nd) {
+ lower_mnt = GET_LOWER_MNT(nd->dentry);
+ lower_dentry = GET_LOWER_DENTRY(nd->dentry);
+
+ vfsmnt_save = nd->mnt;
+ dentry_save = nd->dentry;
+
+ nd->mnt = mntget(lower_mnt);
+ nd->dentry = dget(lower_dentry);
+ }
+
+ err = permission(GET_LOWER_INODE(inode), mask, nd);
+
+ if (nd) {
+ mntput(lower_mnt);
+ dput(lower_dentry);
+
+ nd->mnt = vfsmnt_save;
+ nd->dentry = dentry_save;
+ }
+
+        return err;
 }
 
 /**
@@ -468,14 +542,27 @@ static int dazukofs_setattr(struct dentr
  struct inode *lower_inode = GET_LOWER_INODE(inode);
  int err;
 
- err = notify_change(lower_dentry, ia);
 
- fsstack_copy_attr_all(inode, lower_inode, NULL);
- fsstack_copy_inode_size(inode, lower_inode);
+ if (!lower_inode->i_op || !lower_inode->i_op->setattr)
+ /* XXX: at this point it is too late to handle inodes properly that do NOT
+ specify setattr(). VFS would normally call inode_setattr() in
+ this case. So to force this we jump back to notify_change which will
+ handle this for us. But this is dangerous:
+ The attributes might be modified by notify_change() in a way
+ that results in invalid attributes. This seems to be the case
+ if the inode for which this function is called has the setuid
+ or setgid bit set */
+ err = notify_change(lower_dentry, ia);
+ else
+ err = lower_inode->i_op->setattr(lower_dentry, ia);
+
+ if (!err) {
+ fsstack_copy_attr_all(inode, lower_inode, NULL);
+ fsstack_copy_inode_size(inode, lower_inode);
+ }
 
  return err;
 }
-
 /**
  * Description: Called by the VFS to set an extended attribute for a file.
  * Extended attribute is a name:value pair associated with an inode. This
@@ -496,7 +583,7 @@ static int dazukofs_setxattr(struct dent
 
  if (!lower_dentry_inode->i_op ||
     !lower_dentry_inode->i_op->setxattr) {
- err = -ENOSYS;
+ err = -EOPNOTSUPP;
  goto out;
  }
 
@@ -528,7 +615,7 @@ static ssize_t dazukofs_getxattr(struct
 
  if (!lower_dentry_inode->i_op ||
     !lower_dentry_inode->i_op->getxattr) {
- err = -ENOSYS;
+ err = -EOPNOTSUPP;
  goto out;
  }
 
@@ -557,7 +644,7 @@ static ssize_t dazukofs_listxattr(struct
 
  if (!lower_dentry_inode->i_op ||
     !lower_dentry_inode->i_op->listxattr) {
- err = -ENOSYS;
+ err = -EOPNOTSUPP;
  goto out;
  }
 
@@ -584,7 +671,7 @@ static int dazukofs_removexattr(struct d
 
  if (!lower_dentry_inode->i_op ||
     !lower_dentry_inode->i_op->removexattr) {
- err = -ENOSYS;
+ err = -EOPNOTSUPP;
  goto out;
  }
 
diff -x CVS -rup dazukofs-3.0.0/Makefile dazukofs-3.0.0-rc4_2.6.24/Makefile
--- dazukofs-3.0.0/Makefile 2009-02-22 17:46:02.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/Makefile 2009-05-11 19:50:03.000000000 +0200
@@ -19,6 +19,7 @@ dazukofs_install: dazukofs_modules
 
 clean:
  rm -f Module.symvers
+ rm -f modules.order
  make -C $(DAZUKOFS_KERNEL_SRC) SUBDIRS="`pwd`" clean
 
 .PHONY: dazukofs_modules dazukofs_install clean
diff -x CVS -rup dazukofs-3.0.0/README dazukofs-3.0.0-rc4_2.6.24/README
--- dazukofs-3.0.0/README 2009-02-22 17:38:21.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/README 2008-12-12 16:32:44.000000000 +0100
@@ -21,10 +21,10 @@ NOTE: DazukoFS is completely separate fr
 =================
 
 Below are brief instructions to get DazukoFS compiled and running on a
-system with a Linux 2.6.28 kernel. You may need to manually adjust the
+system with a Linux 2.6.27 kernel. You may need to manually adjust the
 Makefile if you kernel sources are not in the default location.
-(Patches are provided for various other kernels. See the section below
-titled "PATCHING" for more information.)
+(A patch is provided to convert the DazukoFS code to support Linux
+2.6.26.)
 
 compile the kernel module
   # make
@@ -52,25 +52,6 @@ unmount DazukoFS
 
 
 
-==========
- PATCHING
-==========
-
-In the "patches" directory there are patches available to modify the
-DazukoFS code to fit various other kernels. For example, if you are
-running openSUSE 11.1 you can patch the code with the following
-command:
-
-$ patch -p1 < patches/patch-opensuse-11.1
-
-There should not be any errors. If there are errors, then the patch
-is broken and should be reported on the dazuko-devel mailing list.
-
-Once the code has been patched you can build the kernel module as
-described in the section "BUILD / INSTALL" above.
-
-
-
 =========
  TESTING
 =========
@@ -154,9 +135,6 @@ any problems.
  KNOWN ISSUES
 ==============
 
-- The kernel will crash if you attempt to mount DazukoFS to a file instead
-  of a directory. (The various kernel patches handle this error.)
-
 - DazukoFS does not support writing to memory mapped files. This should not
   cause the kernel to crash, but will instead result in the application
   failing to perform the writes (although mmap() will appear to be
diff -x CVS -rup dazukofs-3.0.0/super.c dazukofs-3.0.0-rc4_2.6.24/super.c
--- dazukofs-3.0.0/super.c 2009-02-22 17:46:02.000000000 +0100
+++ dazukofs-3.0.0-rc4_2.6.24/super.c 2009-07-03 18:15:15.000000000 +0200
@@ -35,6 +35,10 @@ static struct kmem_cache *dazukofs_sb_in
 struct kmem_cache *dazukofs_dentry_info_cachep;
 struct kmem_cache *dazukofs_file_info_cachep;
 
+
+#define DAZUKOFS_VERSION "3.0.0-rc4-avira-b2.6"
+
+
 static struct inode *dazukofs_alloc_inode(struct super_block *sb)
 {
  struct dazukofs_inode_info *inodei;
@@ -158,8 +162,8 @@ static int dazukofs_read_super(struct su
  if (err)
  return err;
 
- lower_root = dget(nd.path.dentry);
- lower_mnt = mntget(nd.path.mnt);
+ lower_root = dget(nd.dentry);
+ lower_mnt = mntget(nd.mnt);
 
  if (IS_ERR(lower_root)) {
  err = PTR_ERR(lower_root);
@@ -170,6 +174,10 @@ static int dazukofs_read_super(struct su
  err = -ENOENT;
  goto out_put;
  }
+ if (!S_ISDIR(lower_root->d_inode->i_mode)) {
+ err = -ENOENT;
+ goto out_put;
+ }
 
  SET_LOWER_SB(sb, lower_root->d_sb);
  sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
@@ -184,7 +192,7 @@ out_put:
  dput(lower_root);
  mntput(lower_mnt);
 out:
- path_put(&nd.path);
+ path_release(&nd);
  return err;
 }
 
@@ -213,15 +221,16 @@ static int dazukofs_get_sb(struct file_s
 
 out_abort:
  up_write(&sb->s_umount);
+ dput(sb->s_root);
  deactivate_super(sb);
 out:
  return err;
 }
 
-static void init_once(void *data)
+static void init_once(struct kmem_cache *cachep, void *vptr)
 {
  struct dazukofs_inode_info *inode_info =
- (struct dazukofs_inode_info *)data;
+ (struct dazukofs_inode_info *)vptr;
 
  memset(inode_info, 0, sizeof(struct dazukofs_inode_info));
  inode_init_once(&(inode_info->vfs_inode));
@@ -303,9 +312,10 @@ static struct file_system_type dazukofs_
  .fs_flags = 0,
 };
 
+
 static int __init init_dazukofs_fs(void)
 {
- int err = 0;
+ int err;
 
  err = dazukofs_dev_init();
  if (err)
@@ -319,7 +329,7 @@ static int __init init_dazukofs_fs(void)
  if (err)
  goto error_out3;
 
- printk(KERN_INFO "dazukofs: loaded, version=%s\n", DAZUKOFS_VERSION);
+ printk(KERN_INFO "dazukofs: loaded, version=" DAZUKOFS_VERSION "\n");
  return 0;
 
 error_out3:
@@ -335,7 +345,7 @@ static void __exit exit_dazukofs_fs(void
  unregister_filesystem(&dazukofs_fs_type);
  destroy_caches();
  dazukofs_dev_destroy();
- printk(KERN_INFO "dazukofs: unloaded, version=%s\n", DAZUKOFS_VERSION);
+ printk(KERN_INFO "dazukofs: unloaded, version=" DAZUKOFS_VERSION "\n");
 }
 
 MODULE_AUTHOR("John Ogness");

_______________________________________________
Dazuko-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/dazuko-devel