patch-2.4.0-test3 linux/fs/autofs4/root.c
Next file: linux/fs/bfs/inode.c
Previous file: linux/fs/autofs4/expire.c
Back to the patch index
Back to the overall index
- Lines: 98
- Date:
Wed Jul 5 11:31:01 2000
- Orig file:
v2.4.0-test2/linux/fs/autofs4/root.c
- Orig date:
Tue May 23 15:31:35 2000
diff -u --recursive --new-file v2.4.0-test2/linux/fs/autofs4/root.c linux/fs/autofs4/root.c
@@ -14,6 +14,8 @@
#include <linux/errno.h>
#include <linux/stat.h>
#include <linux/param.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
#include "autofs_i.h"
static struct dentry *autofs4_dir_lookup(struct inode *,struct dentry *);
@@ -118,12 +120,15 @@
/* If this is an unused directory that isn't a mount point,
bitch at the daemon and fix it in user space */
+ spin_lock(&dcache_lock);
if (S_ISDIR(dentry->d_inode->i_mode) &&
!d_mountpoint(dentry) &&
list_empty(&dentry->d_subdirs)) {
DPRINTK(("try_to_fill_entry: mounting existing dir\n"));
+ spin_unlock(&dcache_lock);
return autofs4_wait(sbi, &dentry->d_name, NFY_MOUNT) == 0;
}
+ spin_unlock(&dcache_lock);
/* We don't update the usages for the autofs daemon itself, this
is necessary for recursive autofs mounts */
@@ -163,16 +168,19 @@
ino = autofs4_dentry_ino(dentry);
/* Check for a non-mountpoint directory with no contents */
+ spin_lock(&dcache_lock);
if (S_ISDIR(dentry->d_inode->i_mode) &&
!d_mountpoint(dentry) &&
list_empty(&dentry->d_subdirs)) {
DPRINTK(("autofs_root_revalidate: dentry=%p %.*s, emptydir\n",
dentry, dentry->d_name.len, dentry->d_name.name));
+ spin_unlock(&dcache_lock);
if (oz_mode)
return 1;
else
return try_to_fill_dentry(dentry, dir->i_sb, sbi);
}
+ spin_unlock(&dcache_lock);
/* Update the usage list */
if (!oz_mode)
@@ -197,6 +205,7 @@
DPRINTK(("autofs4_dentry_release: releasing %p\n", de));
+ lock_kernel();
de->d_fsdata = NULL;
if (inf) {
inf->dentry = NULL;
@@ -204,6 +213,7 @@
autofs4_free_ino(inf);
}
+ unlock_kernel();
}
/* For dentries of directories in the root dir */
@@ -372,9 +382,6 @@
dir->i_mtime = CURRENT_TIME;
- DPRINTK(("autofs_dir_unlink: unlinking %p %.*s, count=%d\n",
- dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_count));
-
d_drop(dentry);
return 0;
@@ -388,8 +395,13 @@
if (!autofs4_oz_mode(sbi))
return -EACCES;
- if (!list_empty(&dentry->d_subdirs))
+ spin_lock(&dcache_lock);
+ if (!list_empty(&dentry->d_subdirs)) {
+ spin_unlock(&dcache_lock);
return -ENOTEMPTY;
+ }
+ list_del(&dentry->d_hash);
+ spin_unlock(&dcache_lock);
dput(ino->dentry);
@@ -398,11 +410,6 @@
if (dir->i_nlink)
dir->i_nlink--;
-
- DPRINTK(("autofs_dir_rmdir: rmdir %p %.*s, count=%d\n",
- dentry, dentry->d_name.len, dentry->d_name.name, dentry->d_count));
-
- d_drop(dentry);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)