[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dazuko-devel] Bug in dazukofs_lookup()
From: |
Lino Sanfilippo |
Subject: |
[Dazuko-devel] Bug in dazukofs_lookup() |
Date: |
Fri, 10 Jul 2009 15:54:22 +0200 |
User-agent: |
Icedove 1.5.0.14eol (X11/20090105) |
This patch fixes a bug in dazukofs_lookup():
If interpose fails we must not dput() the lower dentry, since at this
time the dentry operations have already been set up. This
includes the d_release() operation which already cares about dput().
This patch also removes some unnecessary lines of code:
- The check for "." and ".." dentries is not needed, since the vfs will
never pass those
dentries down to our lookup function.
- we never have to unhash() a dentry, since after we hashed a dentry via
d_add() (in lookup() or
interpose()), there are no errors possible.
- setting up dentry operations in interpose() is redundant (since
already done in lookup())
The flag passed to interpose() has been renamed, since it indicates if a
dentry should be hashed,
not that it already has been hashed.
Please apply this patch after patch 1 that has been posted yesterday.
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 -rup dazukofs-3.1.0-rc2-Patched/inode.c dazukofs-3.1.0-rc2-Patched2/inode.c
--- dazukofs-3.1.0-rc2-Patched/inode.c 2009-07-09 17:34:25.000000000 +0200
+++ dazukofs-3.1.0-rc2-Patched2/inode.c 2009-07-10 15:47:55.000000000 +0200
@@ -74,7 +74,7 @@ static int dazukofs_inode_set(struct ino
* Returns 0 on success.
*/
int dazukofs_interpose(struct dentry *lower_dentry, struct dentry *dentry,
- struct super_block *sb, int already_hashed)
+ struct super_block *sb, int hash)
{
struct inode *inode;
struct inode *lower_inode = igrab(lower_dentry->d_inode);
@@ -122,9 +122,7 @@ int dazukofs_interpose(struct dentry *lo
lower_inode->i_rdev);
}
- dentry->d_op = &dazukofs_dops;
-
- if (already_hashed)
+ if (hash)
d_add(dentry, inode);
else
d_instantiate(dentry, inode);
@@ -156,19 +154,6 @@ static struct dentry *dazukofs_lookup(st
struct vfsmount *lower_mnt;
int err = 0;
- /* check for "." or ".." (they are not relevant here) */
- if (dentry->d_name.len == 1) {
- if (dentry->d_name.name[0] == '.') {
- d_drop(dentry);
- goto out;
- }
- } else if (dentry->d_name.len == 2) {
- if (dentry->d_name.name[0] == '.' &&
- dentry->d_name.name[1] == '.') {
- d_drop(dentry);
- goto out;
- }
- }
dentry->d_op = &dazukofs_dops;
@@ -180,7 +165,6 @@ static struct dentry *dazukofs_lookup(st
mutex_unlock(&lower_dentry_parent->d_inode->i_mutex);
if (IS_ERR(lower_dentry)) {
err = PTR_ERR(lower_dentry);
- d_drop(dentry);
goto out;
}
@@ -191,9 +175,11 @@ static struct dentry *dazukofs_lookup(st
GFP_KERNEL));
if (!get_dentry_private(dentry)) {
err = -ENOMEM;
- goto out_dput;
+ dput(lower_dentry);
+ goto out;
}
-
+ /* from now lower dentry and lower mount are released in
+ * d_release() */
fsstack_copy_attr_atime(dir, lower_dentry_parent->d_inode);
lower_mnt = mntget(get_lower_mnt(dentry->d_parent));
@@ -206,15 +192,8 @@ static struct dentry *dazukofs_lookup(st
d_add(dentry, NULL);
goto out;
}
-
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);
out:
return ERR_PTR(err);
}
Nur in dazukofs-3.1.0-rc2-Patched: .inode.c.swp.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dazuko-devel] Bug in dazukofs_lookup(),
Lino Sanfilippo <=