Commit 42c7ef79 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[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. 
parent cdd7a251
...@@ -701,7 +701,8 @@ static void __remove_file(struct dentry * dentry) ...@@ -701,7 +701,8 @@ static void __remove_file(struct dentry * dentry)
vfs_unlink(dentry->d_parent->d_inode,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 */ /* remove reference count from when file was created */
dput(dentry); dput(dentry);
...@@ -741,7 +742,8 @@ void driverfs_remove_file(struct driver_dir_entry * dir, const char * name) ...@@ -741,7 +742,8 @@ void driverfs_remove_file(struct driver_dir_entry * dir, const char * name)
} }
node = node->next; 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) ...@@ -760,8 +762,9 @@ void driverfs_remove_dir(struct driver_dir_entry * dir)
if (!dir->dentry) if (!dir->dentry)
goto done; goto done;
/* lock the directory while we remove the files */
dentry = dget(dir->dentry); dentry = dget(dir->dentry);
dget(dentry->d_parent);
down(&dentry->d_parent->d_inode->i_sem);
down(&dentry->d_inode->i_sem); down(&dentry->d_inode->i_sem);
node = dir->files.next; node = dir->files.next;
...@@ -776,11 +779,9 @@ void driverfs_remove_dir(struct driver_dir_entry * dir) ...@@ -776,11 +779,9 @@ void driverfs_remove_dir(struct driver_dir_entry * dir)
node = dir->files.next; 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); 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 */ /* remove reference count from when directory was created */
dput(dentry); dput(dentry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment