Commit e21e7095 authored by Al Viro's avatar Al Viro

Don't mess with generic_permission() under ->d_lock in hpfs

Just use dentry_unhash() there
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 391e8bbd
...@@ -413,22 +413,25 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -413,22 +413,25 @@ static int hpfs_unlink(struct inode *dir, struct dentry *dentry)
mutex_unlock(&hpfs_i(dir)->i_mutex); mutex_unlock(&hpfs_i(dir)->i_mutex);
mutex_unlock(&hpfs_i(inode)->i_parent_mutex); mutex_unlock(&hpfs_i(inode)->i_parent_mutex);
d_drop(dentry); dentry_unhash(dentry);
spin_lock(&dentry->d_lock); if (!d_unhashed(dentry)) {
if (atomic_read(&dentry->d_count) > 1 || dput(dentry);
generic_permission(inode, MAY_WRITE, NULL) || unlock_kernel();
return -ENOSPC;
}
if (generic_permission(inode, MAY_WRITE, NULL) ||
!S_ISREG(inode->i_mode) || !S_ISREG(inode->i_mode) ||
get_write_access(inode)) { get_write_access(inode)) {
spin_unlock(&dentry->d_lock);
d_rehash(dentry); d_rehash(dentry);
dput(dentry);
} else { } else {
struct iattr newattrs; struct iattr newattrs;
spin_unlock(&dentry->d_lock);
/*printk("HPFS: truncating file before delete.\n");*/ /*printk("HPFS: truncating file before delete.\n");*/
newattrs.ia_size = 0; newattrs.ia_size = 0;
newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
err = notify_change(dentry, &newattrs); err = notify_change(dentry, &newattrs);
put_write_access(inode); put_write_access(inode);
dput(dentry);
if (!err) if (!err)
goto again; goto again;
} }
......
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