public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Rui Miguel Silva <rmfrfs@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: chris.mason@oracle.com
Subject: [PATCH]] Btrfs: fix destroy snapshot to get the right parent dentry
Date: Tue, 3 Nov 2009 16:10:56 +0000	[thread overview]
Message-ID: <20091103161054.GA13781@gentoo-vm.octal.tv> (raw)

In snapshot destroy the dentry used for parent was the snapshot dentry
itself. Remove d_invalidate since always return EBUSY, making possible
to remove a snapshot using the btrfsctl -D option.

Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
---
 fs/btrfs/ioctl.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index cdbb054..fe6ac9a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -741,7 +741,7 @@ out:
 static noinline int btrfs_ioctl_snap_destroy(struct file *file,
 					     void __user *arg)
 {
-	struct dentry *parent = fdentry(file);
+	struct dentry *parent = file->f_path.dentry->d_parent;
 	struct dentry *dentry;
 	struct inode *dir = parent->d_inode;
 	struct inode *inode;
@@ -793,9 +793,6 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
 	dest = BTRFS_I(inode)->root;
 
 	mutex_lock(&inode->i_mutex);
-	err = d_invalidate(dentry);
-	if (err)
-		goto out_unlock;
 
 	down_write(&root->fs_info->subvol_sem);
 
@@ -827,7 +824,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
 	inode->i_flags |= S_DEAD;
 out_up_write:
 	up_write(&root->fs_info->subvol_sem);
-out_unlock:
+
 	mutex_unlock(&inode->i_mutex);
 	if (!err) {
 		shrink_dcache_sb(root->fs_info->sb);
-- 
1.6.5.1


             reply	other threads:[~2009-11-03 16:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 16:10 Rui Miguel Silva [this message]
2009-11-03 23:20 ` [PATCH]] Btrfs: fix destroy snapshot to get the right parent dentry Yan, Zheng 
2009-11-04 10:00   ` Rui Miguel Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091103161054.GA13781@gentoo-vm.octal.tv \
    --to=rmfrfs@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox