Commit 441a9d0e authored by Al Viro's avatar Al Viro

qib_fs: fix (some) dcache abuses

* lookup_one_len() really wants i_mutex held on directory.
* leaks galore - just mount ipathfs, then
cd /sys/bus/pci/drivers/qib_ib; echo *:*:*.* >unbind
on a box with that card present and try to umount ipathfs...
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ede4cebc
...@@ -456,13 +456,13 @@ static int remove_file(struct dentry *parent, char *name) ...@@ -456,13 +456,13 @@ static int remove_file(struct dentry *parent, char *name)
spin_lock(&tmp->d_lock); spin_lock(&tmp->d_lock);
if (!(d_unhashed(tmp) && tmp->d_inode)) { if (!(d_unhashed(tmp) && tmp->d_inode)) {
dget_dlock(tmp);
__d_drop(tmp); __d_drop(tmp);
spin_unlock(&tmp->d_lock); spin_unlock(&tmp->d_lock);
simple_unlink(parent->d_inode, tmp); simple_unlink(parent->d_inode, tmp);
} else { } else {
spin_unlock(&tmp->d_lock); spin_unlock(&tmp->d_lock);
} }
dput(tmp);
ret = 0; ret = 0;
bail: bail:
...@@ -491,6 +491,7 @@ static int remove_device_files(struct super_block *sb, ...@@ -491,6 +491,7 @@ static int remove_device_files(struct super_block *sb,
goto bail; goto bail;
} }
mutex_lock(&dir->d_inode->i_mutex);
remove_file(dir, "counters"); remove_file(dir, "counters");
remove_file(dir, "counter_names"); remove_file(dir, "counter_names");
remove_file(dir, "portcounter_names"); remove_file(dir, "portcounter_names");
...@@ -505,8 +506,10 @@ static int remove_device_files(struct super_block *sb, ...@@ -505,8 +506,10 @@ static int remove_device_files(struct super_block *sb,
} }
} }
remove_file(dir, "flash"); remove_file(dir, "flash");
d_delete(dir); mutex_unlock(&dir->d_inode->i_mutex);
ret = simple_rmdir(root->d_inode, dir); ret = simple_rmdir(root->d_inode, dir);
d_delete(dir);
dput(dir);
bail: bail:
mutex_unlock(&root->d_inode->i_mutex); mutex_unlock(&root->d_inode->i_mutex);
......
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