patch-2.4.0-test3 linux/fs/coda/dir.c
Next file: linux/fs/coda/file.c
Previous file: linux/fs/coda/cache.c
Back to the patch index
Back to the overall index
- Lines: 146
- Date:
Sat Jul 8 19:26:12 2000
- Orig file:
v2.4.0-test2/linux/fs/coda/dir.c
- Orig date:
Fri Jun 23 21:55:10 2000
diff -u --recursive --new-file v2.4.0-test2/linux/fs/coda/dir.c linux/fs/coda/dir.c
@@ -15,9 +15,10 @@
#include <linux/stat.h>
#include <linux/errno.h>
#include <linux/locks.h>
-#include <asm/segment.h>
-#include <asm/uaccess.h>
#include <linux/string.h>
+#include <linux/smp_lock.h>
+
+#include <asm/uaccess.h>
#include <linux/coda.h>
#include <linux/coda_linux.h>
@@ -55,7 +56,7 @@
struct dentry *open_dentry);
static int coda_venus_readdir(struct file *filp, void *dirent,
filldir_t filldir);
-int coda_fsync(struct file *, struct dentry *dentry);
+int coda_fsync(struct file *, struct dentry *dentry, int datasync);
int coda_hasmknod = 0;
@@ -479,7 +480,7 @@
CDEBUG(D_INODE, "old: %s, (%d length), new: %s"
"(%d length). old:d_count: %d, new:d_count: %d\n",
old_name, old_length, new_name, new_length,
- old_dentry->d_count, new_dentry->d_count);
+ atomic_read(&old_dentry->d_count), atomic_read(&new_dentry->d_count));
error = venus_rename(old_dir->i_sb, coda_i2f(old_dir),
coda_i2f(new_dir), old_length, new_length,
@@ -578,16 +579,18 @@
unsigned short coda_flags = coda_flags_to_cflags(flags);
struct coda_cred *cred;
+ lock_kernel();
ENTRY;
coda_vfs_stat.open++;
CDEBUG(D_SPECIAL, "OPEN inode number: %ld, count %d, flags %o.\n",
- f->f_dentry->d_inode->i_ino, f->f_dentry->d_count, flags);
+ f->f_dentry->d_inode->i_ino, atomic_read(&f->f_dentry->d_count), flags);
error = venus_open(i->i_sb, coda_i2f(i), coda_flags, &ino, &dev);
if (error) {
CDEBUG(D_FILE, "venus: dev %d, inode %ld, out->result %d\n",
dev, (long)ino, error);
+ unlock_kernel();
return error;
}
@@ -599,6 +602,7 @@
printk("coda_open: coda_inode_grab error %d.", error);
if (cont_inode)
iput(cont_inode);
+ unlock_kernel();
return error;
}
@@ -619,6 +623,7 @@
cont_inode->i_ino, atomic_read(&cont_inode->i_count),
cont_inode->i_op);
EXIT;
+ unlock_kernel();
return 0;
}
@@ -779,21 +784,21 @@
/* called when a cache lookup succeeds */
static int coda_dentry_revalidate(struct dentry *de, int flags)
{
- int valid = 1;
struct inode *inode = de->d_inode;
struct coda_inode_info *cii;
ENTRY;
if (!inode)
return 1;
+ lock_kernel();
if (coda_isroot(inode))
- return 1;
+ goto out;
if (is_bad_inode(inode))
- return 0;
+ goto bad;
cii = ITOC(de->d_inode);
if (! (cii->c_flags & (C_PURGE | C_FLUSH)) )
- return valid;
+ goto out;
shrink_dcache_parent(de);
@@ -801,17 +806,22 @@
if (cii->c_flags & C_FLUSH)
coda_flag_inode_children(inode, C_FLUSH);
- if (de->d_count > 1) {
+ if (atomic_read(&de->d_count) > 1) {
/* pretend it's valid, but don't change the flags */
CDEBUG(D_DOWNCALL, "BOOM for: ino %ld, %s\n",
de->d_inode->i_ino, coda_f2s(&cii->c_fid));
- return 1;
+ goto out;
}
/* clear the flags. */
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
+bad:
+ unlock_kernel();
return 0;
+out:
+ unlock_kernel();
+ return 1;
}
/*
@@ -857,8 +867,9 @@
dentry->d_name.len, dentry->d_name.name,
dentry->d_parent->d_name.len, dentry->d_parent->d_name.name);
+ lock_kernel();
if ( cii->c_flags == 0 )
- return 0;
+ goto ok;
if (cii->c_flags & (C_VATTR | C_PURGE | C_FLUSH)) {
error = venus_getattr(inode->i_sb, &(cii->c_fid), &attr);
@@ -890,6 +901,8 @@
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
}
+ok:
+ unlock_kernel();
return 0;
return_bad_inode:
@@ -899,6 +912,7 @@
iput(container);
}
make_bad_inode(inode);
+ unlock_kernel();
return -EIO;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)