Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@math.psu.edu>2002-02-08 19:27:14 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2002-02-08 19:27:14 -0800
commit42c7ef7947f12ee0ba56e9bd971411a4a15cb654 (patch)
treee5dd2d020f17eb27ddf82de6c7e7e391ab8e20f3
parentcdd7a2511eaf881b5a56048af7a6c44962da4829 (diff)
[PATCH] driverfs - preparation to fixes
Make dentry and ->i_sem manipulations in driverfs explicit. Something is seriously rotten there and real fixes will take non-trivial work (e.g, I suspect that we actually ought to kill driverfs_rename() - at least cross-directory one for regular files, maybe completely). This patch simply cleans the ground.
-rw-r--r--fs/driverfs/inode.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/driverfs/inode.c b/fs/driverfs/inode.c
index 9502dc7cd85d..94d8b0d4e4a3 100644
--- a/fs/driverfs/inode.c
+++ b/fs/driverfs/inode.c
@@ -701,7 +701,8 @@ static void __remove_file(struct dentry * dentry)
vfs_unlink(dentry->d_parent->d_inode,dentry);
- unlock_dir(dentry);
+ up(&dentry->d_inode->i_sem);
+ dput(dentry);
/* remove reference count from when file was created */
dput(dentry);
@@ -741,7 +742,8 @@ void driverfs_remove_file(struct driver_dir_entry * dir, const char * name)
}
node = node->next;
}
- unlock_dir(dentry);
+ up(&dentry->d_inode->i_sem);
+ dput(dentry);
}
/**
@@ -760,8 +762,9 @@ void driverfs_remove_dir(struct driver_dir_entry * dir)
if (!dir->dentry)
goto done;
- /* lock the directory while we remove the files */
dentry = dget(dir->dentry);
+ dget(dentry->d_parent);
+ down(&dentry->d_parent->d_inode->i_sem);
down(&dentry->d_inode->i_sem);
node = dir->files.next;
@@ -776,11 +779,9 @@ void driverfs_remove_dir(struct driver_dir_entry * dir)
node = dir->files.next;
}
- /* now lock the parent, so we can remove this directory */
- lock_parent(dentry);
-
vfs_rmdir(dentry->d_parent->d_inode,dentry);
- double_unlock(dentry,dentry->d_parent);
+ up(&dentry->d_parent->d_inode->i_sem);
+ up(&dentry->d_inode->i_sem);
/* remove reference count from when directory was created */
dput(dentry);