summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/adfs/inode.c3
-rw-r--r--fs/affs/inode.c8
-rw-r--r--fs/bfs/inode.c7
-rw-r--r--fs/block_dev.c3
-rw-r--r--fs/coda/dir.c4
-rw-r--r--fs/dcache.c33
-rw-r--r--fs/devfs/base.c32
-rw-r--r--fs/devices.c3
-rw-r--r--fs/ext2/inode.c2
-rw-r--r--fs/fat/fatfs_syms.c1
-rw-r--r--fs/fat/inode.c12
-rw-r--r--fs/fifo.c4
-rw-r--r--fs/filesystems.c2
-rw-r--r--fs/hfs/inode.c3
-rw-r--r--fs/hpfs/file.c5
-rw-r--r--fs/hpfs/inode.c4
-rw-r--r--fs/jffs/inode-v23.c5
-rw-r--r--fs/ncpfs/dir.c2
-rw-r--r--fs/nfs/inode.c8
-rw-r--r--fs/nfsd/nfsfh.c6
-rw-r--r--fs/ntfs/fs.c5
-rw-r--r--fs/open.c2
-rw-r--r--fs/pipe.c2
-rw-r--r--fs/proc/proc_misc.c1
-rw-r--r--fs/qnx4/inode.c6
-rw-r--r--fs/smbfs/dir.c5
-rw-r--r--fs/smbfs/file.c2
-rw-r--r--fs/smbfs/inode.c2
-rw-r--r--fs/sysv/inode.c4
-rw-r--r--fs/udf/super.c10
-rw-r--r--fs/ufs/ialloc.c1
-rw-r--r--fs/ufs/inode.c9
-rw-r--r--fs/ufs/super.c1
33 files changed, 153 insertions, 44 deletions
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c
index 5dacc56d6..e55362eb7 100644
--- a/fs/adfs/inode.c
+++ b/fs/adfs/inode.c
@@ -12,6 +12,7 @@
#include <linux/string.h>
#include <linux/locks.h>
#include <linux/mm.h>
+#include <linux/smp_lock.h>
#include "adfs.h"
@@ -354,6 +355,7 @@ void adfs_write_inode(struct inode *inode, int unused)
struct super_block *sb = inode->i_sb;
struct object_info obj;
+ lock_kernel();
obj.file_id = inode->i_ino;
obj.name_len = 0;
obj.parent_id = inode->u.adfs_i.parent_id;
@@ -363,4 +365,5 @@ void adfs_write_inode(struct inode *inode, int unused)
obj.size = inode->i_size;
adfs_dir_update(sb, &obj);
+ unlock_kernel();
}
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 84ea2adf8..f98a2cd0b 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -27,6 +27,7 @@
#include <linux/major.h>
#include <linux/blkdev.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -202,8 +203,10 @@ affs_write_inode(struct inode *inode, int unused)
if (!inode->i_nlink)
return;
+ lock_kernel();
if (!(bh = bread(inode->i_dev,inode->i_ino,AFFS_I2BSIZE(inode)))) {
affs_error(inode->i_sb,"write_inode","Cannot read block %lu",inode->i_ino);
+ unlock_kernel();
return;
}
file_end = GET_END_PTR(struct file_end, bh->b_data,AFFS_I2BSIZE(inode));
@@ -231,6 +234,7 @@ affs_write_inode(struct inode *inode, int unused)
affs_fix_checksum(AFFS_I2BSIZE(inode),bh->b_data,5);
mark_buffer_dirty(bh,1);
brelse(bh);
+ unlock_kernel();
}
int
@@ -269,6 +273,7 @@ affs_put_inode(struct inode *inode)
pr_debug("AFFS: put_inode(ino=%lu, nlink=%u)\n",
inode->i_ino,inode->i_nlink);
+ lock_kernel();
affs_free_prealloc(inode);
if (atomic_read(&inode->i_count) == 1) {
unsigned long cache_page = (unsigned long) inode->u.affs_i.i_ec;
@@ -278,16 +283,19 @@ affs_put_inode(struct inode *inode)
free_page(cache_page);
}
}
+ unlock_kernel();
}
void
affs_delete_inode(struct inode *inode)
{
pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n",inode->i_ino,inode->i_nlink);
+ lock_kernel();
inode->i_size = 0;
if (S_ISREG(inode->i_mode) && !inode->u.affs_i.i_hlink)
affs_truncate(inode);
affs_free_block(inode->i_sb,inode->i_ino);
+ unlock_kernel();
clear_inode(inode);
}
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
index 5f41c53ac..9f53cbcd3 100644
--- a/fs/bfs/inode.c
+++ b/fs/bfs/inode.c
@@ -11,6 +11,7 @@
#include <linux/init.h>
#include <linux/locks.h>
#include <linux/bfs_fs.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
@@ -97,10 +98,12 @@ static void bfs_write_inode(struct inode * inode, int unused)
return;
}
+ lock_kernel();
block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
bh = bread(dev, block, BFS_BSIZE);
if (!bh) {
printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino);
+ unlock_kernel();
return;
}
@@ -126,6 +129,7 @@ static void bfs_write_inode(struct inode * inode, int unused)
mark_buffer_dirty(bh, 0);
brelse(bh);
+ unlock_kernel();
}
static void bfs_delete_inode(struct inode * inode)
@@ -146,11 +150,13 @@ static void bfs_delete_inode(struct inode * inode)
inode->i_size = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
+ lock_kernel();
mark_inode_dirty(inode);
block = (ino - BFS_ROOT_INO)/BFS_INODES_PER_BLOCK + 1;
bh = bread(dev, block, BFS_BSIZE);
if (!bh) {
printf("Unable to read inode %s:%08lx\n", bdevname(dev), ino);
+ unlock_kernel();
return;
}
off = (ino - BFS_ROOT_INO)%BFS_INODES_PER_BLOCK;
@@ -173,6 +179,7 @@ static void bfs_delete_inode(struct inode * inode)
s->su_lf_eblk = inode->iu_sblock - 1;
mark_buffer_dirty(s->su_sbh, 1);
}
+ unlock_kernel();
clear_inode(inode);
}
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 02ae171c4..9a034ca60 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -11,6 +11,7 @@
#include <linux/malloc.h>
#include <linux/kmod.h>
#include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
@@ -611,6 +612,7 @@ int blkdev_open(struct inode * inode, struct file * filp)
int ret = -ENODEV;
struct block_device *bdev = inode->i_bdev;
down(&bdev->bd_sem);
+ lock_kernel();
if (!bdev->bd_op)
bdev->bd_op = get_blkfops(MAJOR(inode->i_rdev));
if (bdev->bd_op) {
@@ -622,6 +624,7 @@ int blkdev_open(struct inode * inode, struct file * filp)
else if (!atomic_read(&bdev->bd_openers))
bdev->bd_op = NULL;
}
+ unlock_kernel();
up(&bdev->bd_sem);
return ret;
}
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 66279990e..f5c53fac2 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -579,6 +579,7 @@ int coda_open(struct inode *i, struct file *f)
unsigned short coda_flags = coda_flags_to_cflags(flags);
struct coda_cred *cred;
+ lock_kernel();
ENTRY;
coda_vfs_stat.open++;
@@ -589,6 +590,7 @@ int coda_open(struct inode *i, struct file *f)
if (error) {
CDEBUG(D_FILE, "venus: dev %d, inode %ld, out->result %d\n",
dev, (long)ino, error);
+ unlock_kernel();
return error;
}
@@ -600,6 +602,7 @@ int coda_open(struct inode *i, struct file *f)
printk("coda_open: coda_inode_grab error %d.", error);
if (cont_inode)
iput(cont_inode);
+ unlock_kernel();
return error;
}
@@ -620,6 +623,7 @@ int coda_open(struct inode *i, struct file *f)
cont_inode->i_ino, atomic_read(&cont_inode->i_count),
cont_inode->i_op);
EXIT;
+ unlock_kernel();
return 0;
}
diff --git a/fs/dcache.c b/fs/dcache.c
index 1841eef97..3de8547ef 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -223,6 +223,24 @@ int d_invalidate(struct dentry * dentry)
return 0;
}
+/* This should be called _only_ with dcache_lock held */
+
+static inline struct dentry * __dget_locked(struct dentry *dentry)
+{
+ atomic_inc(&dentry->d_count);
+ if (atomic_read(&dentry->d_count) == 1) {
+ dentry_stat.nr_unused--;
+ list_del(&dentry->d_lru);
+ INIT_LIST_HEAD(&dentry->d_lru); /* make "list_empty()" work */
+ }
+ return dentry;
+}
+
+struct dentry * dget_locked(struct dentry *dentry)
+{
+ return __dget_locked(dentry);
+}
+
/**
* d_find_alias - grab a hashed alias of inode
* @inode: inode in question
@@ -246,7 +264,7 @@ struct dentry * d_find_alias(struct inode *inode)
next = tmp->next;
alias = list_entry(tmp, struct dentry, d_alias);
if (!list_empty(&alias->d_hash)) {
- dget(alias);
+ __dget_locked(alias);
spin_unlock(&dcache_lock);
return alias;
}
@@ -268,7 +286,7 @@ restart:
while ((tmp = tmp->next) != head) {
struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
if (!atomic_read(&dentry->d_count)) {
- dget(dentry);
+ __dget_locked(dentry);
spin_unlock(&dcache_lock);
d_drop(dentry);
dput(dentry);
@@ -706,12 +724,7 @@ struct dentry * d_lookup(struct dentry * parent, struct qstr * name)
if (memcmp(dentry->d_name.name, str, len))
continue;
}
- atomic_inc(&dentry->d_count);
- if (atomic_read(&dentry->d_count) == 1) {
- dentry_stat.nr_unused--;
- list_del(&dentry->d_lru);
- INIT_LIST_HEAD(&dentry->d_lru); /* make "list_empty()" work */
- }
+ __dget_locked(dentry);
spin_unlock(&dcache_lock);
return dentry;
}
@@ -748,7 +761,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent,
lhp = base;
while ((lhp = lhp->next) != base) {
if (dentry == list_entry(lhp, struct dentry, d_hash)) {
- dget(dentry);
+ __dget_locked(dentry);
goto out;
}
}
@@ -764,7 +777,7 @@ int d_validate(struct dentry *dentry, struct dentry *dparent,
if (!sb->s_dev)
continue;
if (sb->s_root == dentry) {
- dget(dentry);
+ __dget_locked(dentry);
goto out;
}
}
diff --git a/fs/devfs/base.c b/fs/devfs/base.c
index bacb67241..494cb270a 100644
--- a/fs/devfs/base.c
+++ b/fs/devfs/base.c
@@ -1075,16 +1075,19 @@ static void free_dentries (struct devfs_entry *de)
{
struct dentry *dentry;
+ spin_lock(&dcache_lock);
dentry = de->inode.dentry;
if (dentry != NULL)
{
- dget (dentry);
+ dget_locked (dentry);
de->inode.dentry = NULL;
+ spin_unlock(&dcache_lock);
/* Forcefully remove the inode */
if (dentry->d_inode != NULL) dentry->d_inode->i_nlink = 0;
d_drop (dentry);
dput (dentry);
- }
+ } else
+ spin_unlock(&dcache_lock);
} /* End Function free_dentries */
@@ -2303,10 +2306,12 @@ static void devfs_write_inode (struct inode *inode, int wait)
if (inode->i_ino < FIRST_INODE) return;
index = inode->i_ino - FIRST_INODE;
+ lock_kernel();
if (index >= fs_info->num_inodes)
{
printk ("%s: writing inode: %lu for which there is no entry!\n",
DEVFS_NAME, inode->i_ino);
+ unlock_kernel();
return;
}
de = fs_info->table[index];
@@ -2326,6 +2331,7 @@ static void devfs_write_inode (struct inode *inode, int wait)
de->inode.atime = inode->i_atime;
de->inode.mtime = inode->i_mtime;
de->inode.ctime = inode->i_ctime;
+ unlock_kernel();
} /* End Function devfs_write_inode */
static int devfs_notify_change (struct dentry *dentry, struct iattr *iattr)
@@ -2476,11 +2482,18 @@ static int devfs_open (struct inode *inode, struct file *file)
struct devfs_entry *de;
struct fs_info *fs_info = inode->i_sb->u.generic_sbp;
+ lock_kernel();
de = get_devfs_entry_from_vfs_inode (inode);
- if (de == NULL) return -ENODEV;
- if ( S_ISDIR (de->mode) ) return 0;
+ err = -ENODEV;
+ if (de == NULL)
+ goto out;
+ err = 0;
+ if ( S_ISDIR (de->mode) )
+ goto out;
df = &de->u.fcb;
- if (!de->registered) return -ENODEV;
+ err = -ENODEV;
+ if (!de->registered)
+ goto out;
file->private_data = de->info;
if ( S_ISBLK (inode->i_mode) )
{
@@ -2496,9 +2509,10 @@ static int devfs_open (struct inode *inode, struct file *file)
if ( S_ISCHR (inode->i_mode) ) err = chrdev_open (inode, file);
else err = -ENODEV;
}
- if (err < 0) return err;
+ if (err < 0) goto out;
/* Open was successful */
- if (df->open) return 0;
+ err = 0;
+ if (df->open) goto out;
df->open = TRUE; /* This is the first open */
if (df->auto_owner)
{
@@ -2513,7 +2527,9 @@ static int devfs_open (struct inode *inode, struct file *file)
if (df->aopen_notify)
devfsd_notify_one (de, DEVFSD_NOTIFY_ASYNC_OPEN, inode->i_mode,
current->euid, current->egid, fs_info);
- return 0;
+out:
+ unlock_kernel();
+ return err;
} /* End Function devfs_open */
static struct file_operations devfs_fops =
diff --git a/fs/devices.c b/fs/devices.c
index 9e37e5c68..3023747da 100644
--- a/fs/devices.c
+++ b/fs/devices.c
@@ -18,6 +18,7 @@
#include <linux/fcntl.h>
#include <linux/errno.h>
#include <linux/module.h>
+#include <linux/smp_lock.h>
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
@@ -143,6 +144,7 @@ int chrdev_open(struct inode * inode, struct file * filp)
{
int ret = -ENODEV;
+ lock_kernel();
filp->f_op = fops_get(get_chrfops(MAJOR(inode->i_rdev),
MINOR(inode->i_rdev)));
if (filp->f_op) {
@@ -150,6 +152,7 @@ int chrdev_open(struct inode * inode, struct file * filp)
if (filp->f_op->open != NULL)
ret = filp->f_op->open(inode,filp);
}
+ unlock_kernel();
return ret;
}
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index d999b2b4f..5792d7b95 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -62,8 +62,8 @@ void ext2_delete_inode (struct inode * inode)
unlock_kernel();
return;
no_delete:
- clear_inode(inode); /* We must guarantee clearing of inode... */
unlock_kernel();
+ clear_inode(inode); /* We must guarantee clearing of inode... */
}
#define inode_bmap(inode, nr) (le32_to_cpu((inode)->u.ext2_i.i_data[(nr)]))
diff --git a/fs/fat/fatfs_syms.c b/fs/fat/fatfs_syms.c
index 0b7793f07..3a665a18f 100644
--- a/fs/fat/fatfs_syms.c
+++ b/fs/fat/fatfs_syms.c
@@ -42,6 +42,7 @@ EXPORT_SYMBOL(fat_dir_ioctl);
EXPORT_SYMBOL(fat_add_entries);
EXPORT_SYMBOL(fat_dir_empty);
EXPORT_SYMBOL(fat_truncate);
+EXPORT_SYMBOL(fat_brelse);
static int __init init_fat_fs(void)
{
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index bd8d0ae26..046d384de 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -27,6 +27,7 @@
#include <linux/locks.h>
#include <linux/fat_cvf.h>
#include <linux/malloc.h>
+#include <linux/smp_lock.h>
#include "msbuffer.h"
@@ -153,17 +154,21 @@ out:
void fat_delete_inode(struct inode *inode)
{
+ lock_kernel();
inode->i_size = 0;
fat_truncate(inode);
+ unlock_kernel();
clear_inode(inode);
}
void fat_clear_inode(struct inode *inode)
{
+ lock_kernel();
spin_lock(&fat_inode_lock);
fat_cache_inval_inode(inode);
list_del(&MSDOS_I(inode)->i_fat_hash);
spin_unlock(&fat_inode_lock);
+ unlock_kernel();
}
void fat_put_super(struct super_block *sb)
@@ -846,16 +851,20 @@ void fat_write_inode(struct inode *inode, int wait)
retry:
i_pos = MSDOS_I(inode)->i_location;
- if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) return;
+ if (inode->i_ino == MSDOS_ROOT_INO || !i_pos) {
+ return;
+ }
if (!(bh = fat_bread(sb, i_pos >> MSDOS_DPB_BITS))) {
printk("dev = %s, ino = %d\n", kdevname(inode->i_dev), i_pos);
fat_fs_panic(sb, "msdos_write_inode: unable to read i-node block");
+ unlock_kernel();
return;
}
spin_lock(&fat_inode_lock);
if (i_pos != MSDOS_I(inode)->i_location) {
spin_unlock(&fat_inode_lock);
fat_brelse(sb, bh);
+ unlock_kernel();
goto retry;
}
@@ -885,6 +894,7 @@ retry:
spin_unlock(&fat_inode_lock);
fat_mark_buffer_dirty(sb, bh, 1);
fat_brelse(sb, bh);
+ unlock_kernel();
}
diff --git a/fs/fifo.c b/fs/fifo.c
index 25a08e757..ee048ac02 100644
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -11,6 +11,7 @@
#include <linux/mm.h>
#include <linux/malloc.h>
+#include <linux/smp_lock.h>
static void wait_for_partner(struct inode* inode, unsigned int* cnt)
{
@@ -32,6 +33,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
int ret;
ret = -ERESTARTSYS;
+ lock_kernel();
if (down_interruptible(PIPE_SEM(*inode)))
goto err_nolock_nocleanup;
@@ -114,6 +116,7 @@ static int fifo_open(struct inode *inode, struct file *filp)
/* Ok! */
up(PIPE_SEM(*inode));
+ unlock_kernel();
return 0;
err_rd:
@@ -140,6 +143,7 @@ err_nocleanup:
up(PIPE_SEM(*inode));
err_nolock_nocleanup:
+ unlock_kernel();
return ret;
}
diff --git a/fs/filesystems.c b/fs/filesystems.c
index ce64f4c8e..e57b7b3df 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -50,7 +50,7 @@ void __init filesystem_setup(void)
#ifndef CONFIG_NFSD
#ifdef CONFIG_NFSD_MODULE
-int (*do_nfsservctl)(int, void *, void *);
+long (*do_nfsservctl)(int, void *, void *);
#endif
long
asmlinkage sys_nfsservctl(int cmd, void *argp, void *resp)
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
index 371538b9d..56d1547e7 100644
--- a/fs/hfs/inode.c
+++ b/fs/hfs/inode.c
@@ -20,6 +20,7 @@
#include <linux/hfs_fs_sb.h>
#include <linux/hfs_fs_i.h>
#include <linux/hfs_fs.h>
+#include <linux/smp_lock.h>
/*================ Variable-like macros ================*/
@@ -79,6 +80,7 @@ void hfs_put_inode(struct inode * inode)
{
struct hfs_cat_entry *entry = HFS_I(inode)->entry;
+ lock_kernel();
hfs_cat_put(entry);
if (atomic_read(&inode->i_count) == 1) {
struct hfs_hdr_layout *tmp = HFS_I(inode)->layout;
@@ -88,6 +90,7 @@ void hfs_put_inode(struct inode * inode)
HFS_DELETE(tmp);
}
}
+ unlock_kernel();
}
/*
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 4a301f593..f284e3d42 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -7,12 +7,17 @@
*/
#include <linux/string.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include "hpfs_fn.h"
+/* HUH? */
int hpfs_open(struct inode *i, struct file *f)
{
+ lock_kernel();
hpfs_lock_inode(i);
hpfs_unlock_inode(i); /* make sure nobody is deleting the file */
+ unlock_kernel();
if (!i->i_nlink) return -ENOENT;
return 0;
}
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index 7938970c8..a9f085863 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -6,6 +6,8 @@
* inode VFS functions
*/
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include "hpfs_fn.h"
static struct file_operations hpfs_file_ops =
@@ -313,6 +315,8 @@ void hpfs_write_if_changed(struct inode *inode)
void hpfs_delete_inode(struct inode *inode)
{
+ lock_kernel();
hpfs_remove_fnode(inode->i_sb, inode->i_ino);
+ unlock_kernel();
clear_inode(inode);
}
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index fc9c7d0d2..e088d7fba 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -1453,7 +1453,8 @@ static struct inode_operations jffs_file_inode_operations =
static struct file_operations jffs_dir_operations =
{
- readdir: jffs_readdir,
+ read: generic_read_dir,
+ readdir: jffs_readdir,
};
static struct inode_operations jffs_dir_inode_operations =
@@ -1532,9 +1533,9 @@ jffs_delete_inode(struct inode *inode)
inode->i_size = 0;
+ unlock_kernel();
clear_inode(inode);
- unlock_kernel();
}
void
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 3ea18c96d..8cb5a5c06 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -391,7 +391,7 @@ ncp_dget_fpos(struct dentry *dentry, struct dentry *parent, unsigned long fpos)
dent = list_entry(next, struct dentry, d_child);
if ((unsigned long)dent->d_fsdata == fpos) {
if (dent->d_inode)
- dget(dent);
+ dget_locked(dent);
else
dent = NULL;
spin_unlock(&dcache_lock);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 0a6c2fd26..4ef5569fc 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -884,10 +884,14 @@ nfs_revalidate(struct dentry *dentry)
*/
int nfs_open(struct inode *inode, struct file *filp)
{
- struct rpc_auth *auth = NFS_CLIENT(inode)->cl_auth;
- struct rpc_cred *cred = rpcauth_lookupcred(auth, 0);
+ struct rpc_auth *auth;
+ struct rpc_cred *cred;
+ lock_kernel();
+ auth = NFS_CLIENT(inode)->cl_auth;
+ cred = rpcauth_lookupcred(auth, 0);
filp->private_data = cred;
+ unlock_kernel();
return 0;
}
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index cc3896c38..52a0348c1 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -155,7 +155,7 @@ static struct dentry *nfsd_iget(struct super_block *sb, unsigned long ino, __u32
for (lp = inode->i_dentry.next; lp != &inode->i_dentry ; lp=lp->next) {
result = list_entry(lp,struct dentry, d_alias);
if (! (result->d_flags & DCACHE_NFSD_DISCONNECTED)) {
- dget(result);
+ dget_locked(result);
spin_unlock(&dcache_lock);
iput(inode);
return result;
@@ -260,7 +260,7 @@ struct dentry *nfsd_findparent(struct dentry *child)
pdentry = list_entry(aliases->prev, struct dentry, d_alias);
if (pdentry == tdentry)
pdentry = NULL;
- if (pdentry) dget(pdentry);
+ if (pdentry) dget_locked(pdentry);
}
spin_unlock(&dcache_lock);
if (pdentry == NULL) {
@@ -305,7 +305,7 @@ static struct dentry *splice(struct dentry *child, struct dentry *parent)
for (lp = child->d_inode->i_dentry.next; lp != &child->d_inode->i_dentry ; lp=lp->next) {
tmp = list_entry(lp,struct dentry, d_alias);
if (tmp->d_parent == parent) {
- child = dget(tmp);
+ child = dget_locked(tmp);
spin_unlock(&dcache_lock);
goto out;
}
diff --git a/fs/ntfs/fs.c b/fs/ntfs/fs.c
index 38ca56312..96178b4bb 100644
--- a/fs/ntfs/fs.c
+++ b/fs/ntfs/fs.c
@@ -29,6 +29,7 @@
#include <linux/nls.h>
#include <linux/locks.h>
#include <linux/init.h>
+#include <linux/smp_lock.h>
/* Forward declarations */
static struct inode_operations ntfs_dir_inode_operations;
@@ -711,13 +712,16 @@ static void ntfs_read_inode(struct inode* inode)
static void
ntfs_write_inode (struct inode *ino, int unused)
{
+ lock_kernel();
ntfs_debug (DEBUG_LINUX, "ntfs:write inode %x\n", ino->i_ino);
ntfs_update_inode (NTFS_LINO2NINO (ino));
+ unlock_kernel();
}
#endif
static void _ntfs_clear_inode(struct inode *ino)
{
+ lock_kernel();
ntfs_debug(DEBUG_OTHER, "ntfs_clear_inode %lx\n",ino->i_ino);
#ifdef NTFS_IN_LINUX_KERNEL
if(ino->i_ino!=FILE_MFT)
@@ -730,6 +734,7 @@ static void _ntfs_clear_inode(struct inode *ino)
ino->u.generic_ip=0;
}
#endif
+ unlock_kernel();
return;
}
diff --git a/fs/open.c b/fs/open.c
index 70a3d199d..dc2eaebe9 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -645,9 +645,7 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
if (inode->i_sb)
file_move(f, &inode->i_sb->s_files);
if (f->f_op && f->f_op->open) {
- lock_kernel();
error = f->f_op->open(inode,f);
- unlock_kernel();
if (error)
goto cleanup_all;
}
diff --git a/fs/pipe.c b/fs/pipe.c
index 0cd5f6b09..12c160a1a 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -366,12 +366,14 @@ pipe_write_open(struct inode *inode, struct file *filp)
static int
pipe_rdwr_open(struct inode *inode, struct file *filp)
{
+ lock_kernel();
down(PIPE_SEM(*inode));
if (filp->f_mode & FMODE_READ)
PIPE_READERS(*inode)++;
if (filp->f_mode & FMODE_WRITE)
PIPE_WRITERS(*inode)++;
up(PIPE_SEM(*inode));
+ unlock_kernel();
return 0;
}
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index 5937878c9..b20f0b7c4 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -626,7 +626,6 @@ void __init proc_misc_init(void)
{"locks", locks_read_proc},
{"mounts", mounts_read_proc},
{"swaps", swaps_read_proc},
- {"slabinfo", slabinfo_read_proc},
{"iomem", memory_read_proc},
{"execdomains", execdomains_read_proc},
{NULL,NULL}
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index 0785ee368..4e6dce60b 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -23,6 +23,7 @@
#include <linux/locks.h>
#include <linux/init.h>
#include <linux/highuid.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
@@ -62,9 +63,11 @@ int qnx4_sync_inode(struct inode *inode)
static void qnx4_delete_inode(struct inode *inode)
{
QNX4DEBUG(("qnx4: deleting inode [%lu]\n", (unsigned long) inode->i_ino));
+ lock_kernel();
inode->i_size = 0;
qnx4_truncate(inode);
qnx4_free_inode(inode);
+ unlock_kernel();
}
static void qnx4_write_super(struct super_block *sb)
@@ -91,9 +94,11 @@ static void qnx4_write_inode(struct inode *inode, int unused)
}
QNX4DEBUG(("qnx4: write inode 2.\n"));
block = ino / QNX4_INODES_PER_BLOCK;
+ lock_kernel();
if (!(bh = bread(inode->i_dev, block, QNX4_BLOCK_SIZE))) {
printk("qnx4: major problem: unable to read inode from dev "
"%s\n", kdevname(inode->i_dev));
+ unlock_kernel();
return;
}
raw_inode = ((struct qnx4_inode_entry *) bh->b_data) +
@@ -109,6 +114,7 @@ static void qnx4_write_inode(struct inode *inode, int unused)
raw_inode->di_first_xtnt.xtnt_size = cpu_to_le32(inode->i_blocks);
mark_buffer_dirty(bh, 1);
brelse(bh);
+ unlock_kernel();
}
#endif
diff --git a/fs/smbfs/dir.c b/fs/smbfs/dir.c
index 00fefa101..7f08aa22d 100644
--- a/fs/smbfs/dir.c
+++ b/fs/smbfs/dir.c
@@ -141,7 +141,7 @@ static int
smb_dir_open(struct inode *dir, struct file *file)
{
struct dentry *dentry = file->f_dentry;
- struct smb_sb_info *server = server_from_dentry(dentry);
+ struct smb_sb_info *server;
int error = 0;
#ifdef SMBFS_DEBUG_VERBOSE
printk("smb_dir_open: (%s/%s)\n", dentry->d_parent->d_name.name,
@@ -151,6 +151,8 @@ file->f_dentry->d_name.name);
* Directory timestamps in the core protocol aren't updated
* when a file is added, so we give them a very short TTL.
*/
+ lock_kernel();
+ server = server_from_dentry(dentry);
if (server->opt.protocol < SMB_PROTOCOL_LANMAN2)
{
unsigned long age = jiffies - dir->u.smbfs_i.oldmtime;
@@ -160,6 +162,7 @@ file->f_dentry->d_name.name);
if (server->conn_pid)
error = smb_revalidate_inode(dentry);
+ unlock_kernel();
return error;
}
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c
index cbabee222..2c3b96638 100644
--- a/fs/smbfs/file.c
+++ b/fs/smbfs/file.c
@@ -334,7 +334,9 @@ out:
static int
smb_file_open(struct inode *inode, struct file * file)
{
+ lock_kernel();
inode->u.smbfs_i.openers++;
+ unlock_kernel();
return 0;
}
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c
index 89ddfb22a..caa8cc533 100644
--- a/fs/smbfs/inode.c
+++ b/fs/smbfs/inode.c
@@ -281,9 +281,11 @@ static void
smb_delete_inode(struct inode *ino)
{
pr_debug("smb_delete_inode\n");
+ lock_kernel();
if (smb_close(ino))
printk("smb_delete_inode: could not close inode %ld\n",
ino->i_ino);
+ unlock_kernel();
clear_inode(ino);
}
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index 9ac81643b..e1d594f0b 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -61,9 +61,11 @@ void sysv_print_inode(struct inode * inode)
static void sysv_delete_inode(struct inode *inode)
{
+ lock_kernel();
inode->i_size = 0;
sysv_truncate(inode);
sysv_free_inode(inode);
+ unlock_kernel();
}
static void sysv_put_super(struct super_block *);
@@ -1156,8 +1158,10 @@ static struct buffer_head * sysv_update_inode(struct inode * inode)
void sysv_write_inode(struct inode * inode, int wait)
{
struct buffer_head *bh;
+ lock_kernel();
bh = sysv_update_inode(inode);
brelse(bh);
+ unlock_kernel();
}
int sysv_sync_inode(struct inode * inode)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index f3f575d7e..e89a86e72 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -100,14 +100,14 @@ static DECLARE_FSTYPE_DEV(udf_fstype, "udf", udf_read_super);
/* Superblock operations */
static struct super_operations udf_sb_ops = {
- read_inode: udf_read_inode,
+ read_inode: udf_read_inode,
write_inode: udf_write_inode,
- put_inode: udf_put_inode,
+ put_inode: udf_put_inode,
delete_inode: udf_delete_inode,
- put_super: udf_put_super,
+ put_super: udf_put_super,
write_super: udf_write_super,
- statfs: udf_statfs,
- remount_fs: udf_remount_fs,
+ statfs: udf_statfs,
+ remount_fs: udf_remount_fs,
};
struct udf_options
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 3b7bf8410..f93a55c4e 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -101,6 +101,7 @@ void ufs_free_inode (struct inode * inode)
is_directory = S_ISDIR(inode->i_mode);
DQUOT_FREE_INODE(sb, inode);
+ DQUOT_DROP(inode);
clear_inode (inode);
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index eb1d86d18..fffaa7d3e 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -747,7 +747,9 @@ static int ufs_update_inode(struct inode * inode, int do_sync)
void ufs_write_inode (struct inode * inode, int wait)
{
+ lock_kernel();
ufs_update_inode (inode, wait);
+ unlock_kernel();
}
int ufs_sync_inode (struct inode *inode)
@@ -755,18 +757,15 @@ int ufs_sync_inode (struct inode *inode)
return ufs_update_inode (inode, 1);
}
-void ufs_put_inode (struct inode * inode)
-{
- UFSD(("ENTER & EXIT\n"))
-}
-
void ufs_delete_inode (struct inode * inode)
{
/*inode->u.ufs_i.i_dtime = CURRENT_TIME;*/
+ lock_kernel();
mark_inode_dirty(inode);
ufs_update_inode(inode, IS_SYNC(inode));
inode->i_size = 0;
if (inode->i_blocks)
ufs_truncate (inode);
ufs_free_inode (inode);
+ unlock_kernel();
}
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index 7784203e0..c41228adf 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -971,7 +971,6 @@ int ufs_statfs (struct super_block * sb, struct statfs * buf)
static struct super_operations ufs_super_ops = {
read_inode: ufs_read_inode,
write_inode: ufs_write_inode,
- put_inode: ufs_put_inode,
delete_inode: ufs_delete_inode,
put_super: ufs_put_super,
write_super: ufs_write_super,