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) |
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 15fd2c06f4a7..11c2b4080f65 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -413,22 +413,25 @@ again: | |||
413 | 413 | ||
414 | mutex_unlock(&hpfs_i(dir)->i_mutex); | 414 | mutex_unlock(&hpfs_i(dir)->i_mutex); |
415 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); | 415 | mutex_unlock(&hpfs_i(inode)->i_parent_mutex); |
416 | d_drop(dentry); | 416 | dentry_unhash(dentry); |
417 | spin_lock(&dentry->d_lock); | 417 | if (!d_unhashed(dentry)) { |
418 | if (atomic_read(&dentry->d_count) > 1 || | 418 | dput(dentry); |
419 | generic_permission(inode, MAY_WRITE, NULL) || | 419 | unlock_kernel(); |
420 | return -ENOSPC; | ||
421 | } | ||
422 | if (generic_permission(inode, MAY_WRITE, NULL) || | ||
420 | !S_ISREG(inode->i_mode) || | 423 | !S_ISREG(inode->i_mode) || |
421 | get_write_access(inode)) { | 424 | get_write_access(inode)) { |
422 | spin_unlock(&dentry->d_lock); | ||
423 | d_rehash(dentry); | 425 | d_rehash(dentry); |
426 | dput(dentry); | ||
424 | } else { | 427 | } else { |
425 | struct iattr newattrs; | 428 | struct iattr newattrs; |
426 | spin_unlock(&dentry->d_lock); | ||
427 | /*printk("HPFS: truncating file before delete.\n");*/ | 429 | /*printk("HPFS: truncating file before delete.\n");*/ |
428 | newattrs.ia_size = 0; | 430 | newattrs.ia_size = 0; |
429 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; | 431 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; |
430 | err = notify_change(dentry, &newattrs); | 432 | err = notify_change(dentry, &newattrs); |
431 | put_write_access(inode); | 433 | put_write_access(inode); |
434 | dput(dentry); | ||
432 | if (!err) | 435 | if (!err) |
433 | goto again; | 436 | goto again; |
434 | } | 437 | } |