linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: [PATCH 3/4] Btrfs: Fix incorrect inode nlink in btrfs_link()
Date: Wed, 13 Apr 2011 15:43:00 +0800	[thread overview]
Message-ID: <4DA55404.4060702@cn.fujitsu.com> (raw)
In-Reply-To: <4DA553C9.2040807@cn.fujitsu.com>

From: Miao Xie <miaox@cn.fujitsu.com>

Link count of the inode is not decreased if btrfs_set_inode_index()
fails.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Singed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 fs/btrfs/inode.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b9f7f52..a4157cf 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4846,9 +4846,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
 	if (inode->i_nlink == ~0U)
 		return -EMLINK;
 
-	btrfs_inc_nlink(inode);
-	inode->i_ctime = CURRENT_TIME;
-
 	err = btrfs_set_inode_index(dir, &index);
 	if (err)
 		goto fail;
@@ -4864,6 +4861,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
 		goto fail;
 	}
 
+	btrfs_inc_nlink(inode);
+	inode->i_ctime = CURRENT_TIME;
+
 	btrfs_set_trans_block_group(trans, dir);
 	ihold(inode);
 
-- 
1.7.3.1

  parent reply	other threads:[~2011-04-13  7:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  7:42 [PATCH 0/4] Btrfs: A few small bug fixes Li Zefan
2011-04-13  7:42 ` [PATCH 1/4] Btrfs: Check if btrfs_next_leaf() returns error in btrfs_listxattr() Li Zefan
2011-04-13  7:42 ` [PATCH 2/4] Btrfs: Check if btrfs_next_leaf() returns error in btrfs_real_readdir() Li Zefan
2011-04-13  7:43 ` Li Zefan [this message]
2011-04-13  7:43 ` [PATCH 4/4] Btrfs: Check validity before setting an acl Li Zefan
2011-04-13 11:30 ` [PATCH 0/4] Btrfs: A few small bug fixes Chris Mason

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=4DA55404.4060702@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).