dazuko-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dazuko-devel] Bug in dazukofs_open()


From: Lino Sanfilippo
Subject: [Dazuko-devel] Bug in dazukofs_open()
Date: Thu, 27 Nov 2008 17:14:53 +0100
User-agent: IceDove 1.5.0.14eol (X11/20080724)



Hi John,

while I was working with dazukoFS I encountered some strange problems with files that had been blocked by an application via dazuko before. If such a file has been deleted it was not possible to create a file (i.e. by touching it) with the same name where it has been located before. The error message was :"File exists", though an "ls" did not show it anymore.

It was also impossible to unmount the underlying device (i.e. a usb stick). The error message was:
"device is busy".

I found out that the reason for these problems is a bug in dazukofs_open():

If dazuko_check_access() returns with an error code, the usage counters of lower_dentry and lower_mnt that had been incremented before, are not decremented again. This prevents the underlaying filesystem from removing the corresponding dentry and inode. I created a patch (for 3.00-rc3 with linux-2.6.26 patch) that resolves that problem. It also eliminates a bug in the error handling part of init_events().
The patch is applied to this mail.

Yet another thing:
Will dazukoFS support additional file access events in future, i.e. for "on close"?


Greetings,
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 -ru dazukofs-3.0.0-rc3/event.c dazukofs-3.0.0-rc3PATCH/event.c
--- dazukofs-3.0.0-rc3/event.c  2008-10-25 00:07:07.000000000 +0200
+++ dazukofs-3.0.0-rc3PATCH/event.c     2008-11-27 15:38:03.000000000 +0100
@@ -124,11 +124,11 @@
        return 0;
 
 error_out:
-       if (!dazukofs_group_cachep)
+       if (dazukofs_group_cachep)
                kmem_cache_destroy(dazukofs_group_cachep);
-       if (!dazukofs_event_container_cachep)
+       if (dazukofs_event_container_cachep)
                kmem_cache_destroy(dazukofs_event_container_cachep);
-       if (!dazukofs_event_cachep)
+       if (dazukofs_event_cachep)
                kmem_cache_destroy(dazukofs_event_cachep);
        return -ENOMEM;
 }
diff -ru dazukofs-3.0.0-rc3/file.c dazukofs-3.0.0-rc3PATCH/file.c
--- dazukofs-3.0.0-rc3/file.c   2008-10-09 21:35:26.000000000 +0200
+++ dazukofs-3.0.0-rc3PATCH/file.c      2008-11-27 15:42:12.000000000 +0100
@@ -233,27 +233,33 @@
        struct dentry *lower_dentry = dget(GET_LOWER_DENTRY(dentry));
        struct vfsmount *lower_mnt = mntget(GET_LOWER_MNT(dentry));
        struct file *lower_file;
-       int err = 0;
+       int err;
 
        err = dazukofs_check_access(file->f_dentry, file->f_vfsmnt);
        if (err)
-               goto out;
+               goto out_put;
 
        SET_FILE_INFO(file, kmem_cache_zalloc(dazukofs_file_info_cachep,
                      GFP_KERNEL));
        if (!GET_FILE_INFO(file)) {
                err = -ENOMEM;
-               goto out;
+               goto out_put;
        }
 
        lower_file = dentry_open(lower_dentry, lower_mnt, file->f_flags);
        if (IS_ERR(lower_file)) {
+               /* dput() and mntput() already done by dentry_open() */
                err = PTR_ERR(lower_file);
-               goto out;
+               goto out_err;
        }
 
        SET_LOWER_FILE(file, lower_file);
-out:
+
+       return 0;
+out_put:
+       mntput(lower_mnt);
+       dput(lower_dentry);
+out_err:
        return err;
 }
 
Nur in dazukofs-3.0.0-rc3PATCH/: modules.order.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]