include/linux/fs.h | 11 ++++----
3 files changed, 54 insertions(+), 24 deletions(-)
-Index: linux-2.4.20-rh/fs/namei.c
+Index: linux-2.4.24/fs/namei.c
===================================================================
---- linux-2.4.20-rh.orig/fs/namei.c 2003-09-04 20:58:33.000000000 +0800
-+++ linux-2.4.20-rh/fs/namei.c 2003-09-04 21:21:20.000000000 +0800
-@@ -101,6 +101,36 @@
-
+--- linux-2.4.24.orig/fs/namei.c 2004-06-24 09:08:27.000000000 +0400
++++ linux-2.4.24/fs/namei.c 2004-06-27 21:32:00.000000000 +0400
+@@ -103,6 +103,38 @@
}
+ EXPORT_SYMBOL(intent_release);
-+static void *lock_dir(struct inode *dir, struct qstr *name)
++void *lock_dir(struct inode *dir, struct qstr *name)
+{
+ unsigned long hash;
+
+ /* lock this hash */
+ return dynlock_lock(&dir->i_dcache_lock, hash, 1, GFP_ATOMIC);
+}
++EXPORT_SYMBOL(lock_dir);
+
-+static void unlock_dir(struct inode *dir, void *lock)
++void unlock_dir(struct inode *dir, void *lock)
+{
+ if (!IS_PDIROPS(dir)) {
+ up(&dir->i_sem);
+ }
+ dynlock_unlock(&dir->i_dcache_lock, lock);
+}
++EXPORT_SYMBOL(unlock_dir);
+
/* In order to reduce some races, while at the same time doing additional
* checking and hopefully speeding things up, we copy filenames to the
* kernel data space before using them..
-@@ -303,10 +333,11 @@
+@@ -307,10 +339,11 @@
struct dentry * result;
struct inode *dir = parent->d_inode;
int counter = 0;
/*
* First re-do the cached lookup just in case it was created
* while we waited for the directory semaphore..
-@@ -329,7 +359,7 @@
+@@ -334,7 +367,7 @@
else
result = dentry;
}
return result;
}
-@@ -337,7 +367,7 @@
+@@ -342,7 +375,7 @@
* Uhhuh! Nasty case: the cache was re-populated while
* we waited on the semaphore. Need to revalidate.
*/
if (result->d_op && result->d_op->d_revalidate) {
if (!result->d_op->d_revalidate(result, flags) && !d_invalidate(result)) {
dput(result);
-@@ -1180,13 +1210,13 @@
+@@ -1174,13 +1207,13 @@
goto exit;
dir = nd->dentry;
- down(&dir->d_inode->i_sem);
+ nd->lock = lock_dir(dir->d_inode, &nd->last);
- dentry = lookup_hash_it(&nd->last, nd->dentry, it);
+ dentry = lookup_hash_it(&nd->last, nd->dentry, nd, it);
do_last:
error = PTR_ERR(dentry);
goto exit;
}
-@@ -1195,7 +1225,7 @@
+@@ -1189,7 +1222,7 @@
if (!dentry->d_inode) {
error = vfs_create_it(dir->d_inode, dentry,
mode & ~current->fs->umask, it);
dput(nd->dentry);
nd->dentry = dentry;
if (error)
-@@ -1209,7 +1239,7 @@
+@@ -1203,7 +1236,7 @@
/*
* It already exists.
*/
error = -EEXIST;
if (flag & O_EXCL)
-@@ -1362,7 +1392,7 @@
+@@ -1350,7 +1383,7 @@
goto exit;
}
dir = nd->dentry;
- down(&dir->d_inode->i_sem);
+ nd->lock = lock_dir(dir->d_inode, &nd->last);
- dentry = lookup_hash_it(&nd->last, nd->dentry, it);
+ dentry = lookup_hash_it(&nd->last, nd->dentry, nd, it);
putname(nd->last.name);
goto do_last;
-@@ -1380,7 +1410,7 @@
+@@ -1368,7 +1401,7 @@
{
struct dentry *dentry;
dentry = ERR_PTR(-EEXIST);
if (nd->last_type != LAST_NORM)
goto fail;
-@@ -1469,7 +1499,7 @@
+@@ -1461,7 +1494,7 @@
}
dput(dentry);
}
out2:
path_release(&nd);
out:
-@@ -1532,7 +1562,7 @@
+@@ -1528,7 +1561,7 @@
mode & ~current->fs->umask);
dput(dentry);
}
out2:
path_release(&nd);
out:
-@@ -1642,14 +1672,14 @@
+@@ -1638,14 +1671,14 @@
if (error != -EOPNOTSUPP)
goto exit1;
}
- down(&nd.dentry->d_inode->i_sem);
+ nd.lock = lock_dir(nd.dentry->d_inode, &nd.last);
- dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
+ dentry = lookup_hash_it(&nd.last, nd.dentry, &nd, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
error = vfs_rmdir(nd.dentry->d_inode, dentry);
exit1:
path_release(&nd);
exit:
-@@ -1708,7 +1738,7 @@
+@@ -1704,7 +1737,7 @@
if (error != -EOPNOTSUPP)
goto exit1;
}
- down(&nd.dentry->d_inode->i_sem);
+ nd.lock = lock_dir(nd.dentry->d_inode, &nd.last);
- dentry = lookup_hash_it(&nd.last, nd.dentry, NULL);
+ dentry = lookup_hash_it(&nd.last, nd.dentry, &nd, NULL);
error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) {
-@@ -1719,7 +1749,7 @@
+@@ -1715,7 +1748,7 @@
exit2:
dput(dentry);
}
exit1:
path_release(&nd);
exit:
-@@ -1789,7 +1819,7 @@
+@@ -1789,7 +1822,7 @@
error = vfs_symlink(nd.dentry->d_inode, dentry, from);
dput(dentry);
}
out2:
path_release(&nd);
out:
-@@ -1881,7 +1911,7 @@
+@@ -1885,7 +1918,7 @@
error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
dput(new_dentry);
}
out_release:
path_release(&nd);
out:
-Index: linux-2.4.20-rh/include/linux/fs.h
+Index: linux-2.4.24/fs/inode.c
+===================================================================
+--- linux-2.4.24.orig/fs/inode.c 2004-06-24 09:08:27.000000000 +0400
++++ linux-2.4.24/fs/inode.c 2004-06-24 09:08:29.000000000 +0400
+@@ -119,6 +119,7 @@
+ mapping->host = inode;
+ mapping->gfp_mask = GFP_HIGHUSER;
+ inode->i_mapping = mapping;
++ dynlock_init(&inode->i_dcache_lock);
+ }
+ return inode;
+ }
+Index: linux-2.4.24/include/linux/fs.h
===================================================================
---- linux-2.4.20-rh.orig/include/linux/fs.h 2003-09-04 20:59:14.000000000 +0800
-+++ linux-2.4.20-rh/include/linux/fs.h 2003-09-04 21:03:46.000000000 +0800
+--- linux-2.4.24.orig/include/linux/fs.h 2004-06-24 09:08:29.000000000 +0400
++++ linux-2.4.24/include/linux/fs.h 2004-06-24 09:08:29.000000000 +0400
@@ -21,6 +21,7 @@
#include <linux/cache.h>
#include <linux/stddef.h>
#include <asm/atomic.h>
#include <asm/bitops.h>
-@@ -136,6 +137,7 @@
+@@ -139,6 +140,7 @@
#define S_IMMUTABLE 16 /* Immutable file */
#define S_DEAD 32 /* removed, but still open directory */
#define S_NOQUOTA 64 /* Inode is not counted to quota */
/*
* Note that nosuid etc flags are inode-specific: setting some file-system
-@@ -162,6 +164,7 @@
+@@ -165,6 +167,7 @@
#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
#define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
#define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME)
#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
-@@ -489,6 +492,7 @@
+@@ -500,6 +503,7 @@
atomic_t i_writecount;
unsigned int i_attr_flags;
__u32 i_generation;
union {
struct minix_inode_info minix_i;
struct ext2_inode_info ext2_i;
-@@ -708,6 +712,7 @@
+@@ -714,6 +718,7 @@
unsigned int flags;
int last_type;
struct lookup_intent *intent;
};
/*
-@@ -1621,12 +1626,6 @@
+@@ -1629,12 +1634,6 @@
return dget(dentry->d_parent);
}
/*
* Whee.. Deadlock country. Happily there are only two VFS
* operations that does this..
-Index: linux-2.4.20-rh/fs/inode.c
-===================================================================
---- linux-2.4.20-rh.orig/fs/inode.c 2003-09-04 20:58:35.000000000 +0800
-+++ linux-2.4.20-rh/fs/inode.c 2003-09-04 21:03:46.000000000 +0800
-@@ -121,6 +121,7 @@
- mapping->host = inode;
- mapping->gfp_mask = GFP_HIGHUSER;
- inode->i_mapping = mapping;
-+ dynlock_init(&inode->i_dcache_lock);
- }
- return inode;
- }