linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Chris Mason <chris.mason@oracle.com>,
	Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: [PATCH 07/10] btrfs: fix wrong ctime when adding link
Date: Thu, 20 May 2010 15:22:30 +0800	[thread overview]
Message-ID: <4BF4E336.40603@cn.fujitsu.com> (raw)

the ctime of file has not been updated when I create a link for it.

Steps to reproduce:
 # touch file1
 # stat -c %Z file1
 1273592239
 # link flink1 file1
 # stat -c %Z file1
 1273592239             <-- have not been updated

This patch fix this problem.

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

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a85b90c..5271887 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4218,8 +4218,12 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
 
 		btrfs_i_size_write(parent_inode, parent_inode->i_size +
 				   name_len * 2);
-		parent_inode->i_mtime = parent_inode->i_ctime = CURRENT_TIME;
-		ret = btrfs_update_inode(trans, root, parent_inode);
+		parent_inode->i_mtime = parent_inode->i_ctime = inode->i_ctime
+				      = CURRENT_TIME;
+
+		ret = btrfs_update_inode(trans, root, inode);
+		if (!ret)
+			ret = btrfs_update_inode(trans, root, parent_inode);
 	}
 	return ret;
 }
-- 
1.6.5.2



             reply	other threads:[~2010-05-20  7:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-20  7:22 Miao Xie [this message]
2010-05-20  8:33 ` [PATCH 07/10] btrfs: fix wrong ctime when adding link Christoph Hellwig
2010-05-24  6:37   ` Shi Weihua
2010-05-20  9:01 ` Mike Fedyk
2010-05-21  9:36   ` Miao Xie

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=4BF4E336.40603@cn.fujitsu.com \
    --to=miaox@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).