From 030f42713ce0076ab380469914e373d62c5544d7 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 1 Feb 2010 11:05:16 -0500 Subject: [PATCH] --- yaml --- r: 185722 b: refs/heads/master c: e21e7095a78867364d7aa9223d833ccb966f93f3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/hpfs/namei.c | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 62df25a81f00..f9d05680f2fd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 391e8bbd38474b9f85b1f3933394a79ea66fe1e2 +refs/heads/master: e21e7095a78867364d7aa9223d833ccb966f93f3 diff --git a/trunk/fs/hpfs/namei.c b/trunk/fs/hpfs/namei.c index 15fd2c06f4a7..11c2b4080f65 100644 --- a/trunk/fs/hpfs/namei.c +++ b/trunk/fs/hpfs/namei.c @@ -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(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; }