diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-02-01 11:05:16 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-03 14:07:58 -0500 |
commit | e21e7095a78867364d7aa9223d833ccb966f93f3 (patch) | |
tree | e01e5cd5ad9d42d7c333dfaba040557ba7ee0a58 | |
parent | 391e8bbd38474b9f85b1f3933394a79ea66fe1e2 (diff) | |
download | linux-3.10-e21e7095a78867364d7aa9223d833ccb966f93f3.tar.gz linux-3.10-e21e7095a78867364d7aa9223d833ccb966f93f3.tar.bz2 linux-3.10-e21e7095a78867364d7aa9223d833ccb966f93f3.zip |
Don't mess with generic_permission() under ->d_lock in hpfs
Just use dentry_unhash() there
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/hpfs/namei.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index 15fd2c06f4a..11c2b4080f6 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c @@ -413,22 +413,25 @@ again: mutex_unlock(&hpfs_i(dir)->i_mutex); mutex_unlock(&hpfs_i(inode)->i_parent_mutex); - d_drop(dentry); - spin_lock(&dentry->d_lock); - if (atomic_read(&dentry->d_count) > 1 || - generic_permission(inode, MAY_WRITE, NULL) || + dentry_unhash(dentry); + if (!d_unhashed(dentry)) { + dput(dentry); + unlock_kernel(); + return -ENOSPC; + } + if (generic_permission(inode, MAY_WRITE, NULL) || !S_ISREG(inode->i_mode) || get_write_access(inode)) { - spin_unlock(&dentry->d_lock); d_rehash(dentry); + dput(dentry); } else { struct iattr newattrs; - spin_unlock(&dentry->d_lock); /*printk("HPFS: truncating file before delete.\n");*/ newattrs.ia_size = 0; newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; err = notify_change(dentry, &newattrs); put_write_access(inode); + dput(dentry); if (!err) goto again; } |