patch-2.4.0-test3 linux/include/linux/fs_struct.h
Next file: linux/include/linux/in6.h
Previous file: linux/include/linux/fs.h
Back to the patch index
Back to the overall index
- Lines: 50
- Date:
Wed Jul 5 11:31:00 2000
- Orig file:
v2.4.0-test2/linux/include/linux/fs_struct.h
- Orig date:
Thu May 11 15:30:08 2000
diff -u --recursive --new-file v2.4.0-test2/linux/include/linux/fs_struct.h linux/include/linux/fs_struct.h
@@ -4,6 +4,7 @@
struct fs_struct {
atomic_t count;
+ rwlock_t lock;
int umask;
struct dentry * root, * pwd, * altroot;
struct vfsmount * rootmnt, * pwdmnt, * altrootmnt;
@@ -11,6 +12,7 @@
#define INIT_FS { \
ATOMIC_INIT(1), \
+ RW_LOCK_UNLOCKED, \
0022, \
NULL, NULL, NULL, NULL, NULL, NULL \
}
@@ -27,10 +29,14 @@
struct vfsmount *mnt,
struct dentry *dentry)
{
- struct dentry *old_root = fs->root;
- struct vfsmount *old_rootmnt = fs->rootmnt;
+ struct dentry *old_root;
+ struct vfsmount *old_rootmnt;
+ write_lock(&fs->lock);
+ old_root = fs->root;
+ old_rootmnt = fs->rootmnt;
fs->rootmnt = mntget(mnt);
fs->root = dget(dentry);
+ write_unlock(&fs->lock);
if (old_root) {
dput(old_root);
mntput(old_rootmnt);
@@ -46,10 +52,14 @@
struct vfsmount *mnt,
struct dentry *dentry)
{
- struct dentry *old_pwd = fs->pwd;
- struct vfsmount *old_pwdmnt = fs->pwdmnt;
+ struct dentry *old_pwd;
+ struct vfsmount *old_pwdmnt;
+ write_lock(&fs->lock);
+ old_pwd = fs->pwd;
+ old_pwdmnt = fs->pwdmnt;
fs->pwdmnt = mntget(mnt);
fs->pwd = dget(dentry);
+ write_unlock(&fs->lock);
if (old_pwd) {
dput(old_pwd);
mntput(old_pwdmnt);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)