Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix ctime update of on-disk inode
@ 2011-12-09  1:40 Li Zefan
  2011-12-09  2:03 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zefan @ 2011-12-09  1:40 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

To reproduce the bug:

    # touch /mnt/tmp
    # stat /mnt/tmp | grep Change
    Change: 2011-12-09 09:32:23.412105981 +0800
    # chattr +i /mnt/tmp
    # stat /mnt/tmp | grep Change
    Change: 2011-12-09 09:32:43.198105295 +0800
    # umount /mnt
    # mount /dev/loop1 /mnt
    # stat /mnt/tmp | grep Change
    Change: 2011-12-09 09:32:23.412105981 +0800

We should update ctime of in-memory inode before calling
btrfs_update_inode().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 fs/btrfs/ioctl.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 72d4616..40eaa9f 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -252,11 +252,11 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
 	trans = btrfs_join_transaction(root);
 	BUG_ON(IS_ERR(trans));
 
+	btrfs_update_iflags(inode);
+	inode->i_ctime = CURRENT_TIME;
 	ret = btrfs_update_inode(trans, root, inode);
 	BUG_ON(ret);
 
-	btrfs_update_iflags(inode);
-	inode->i_ctime = CURRENT_TIME;
 	btrfs_end_transaction(trans, root);
 
 	mnt_drop_write(file->f_path.mnt);
-- 
1.7.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: fix ctime update of on-disk inode
  2011-12-09  1:40 [PATCH] Btrfs: fix ctime update of on-disk inode Li Zefan
@ 2011-12-09  2:03 ` Christoph Hellwig
  2011-12-09  2:12   ` Li Zefan
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2011-12-09  2:03 UTC (permalink / raw)
  To: Li Zefan; +Cc: linux-btrfs@vger.kernel.org

On Fri, Dec 09, 2011 at 09:40:35AM +0800, Li Zefan wrote:
> To reproduce the bug:
> 
>     # touch /mnt/tmp
>     # stat /mnt/tmp | grep Change
>     Change: 2011-12-09 09:32:23.412105981 +0800
>     # chattr +i /mnt/tmp
>     # stat /mnt/tmp | grep Change
>     Change: 2011-12-09 09:32:43.198105295 +0800
>     # umount /mnt
>     # mount /dev/loop1 /mnt
>     # stat /mnt/tmp | grep Change
>     Change: 2011-12-09 09:32:23.412105981 +0800
> 
> We should update ctime of in-memory inode before calling
> btrfs_update_inode().

Can you submit this one as a test for xfstests?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: fix ctime update of on-disk inode
  2011-12-09  2:03 ` Christoph Hellwig
@ 2011-12-09  2:12   ` Li Zefan
  0 siblings, 0 replies; 3+ messages in thread
From: Li Zefan @ 2011-12-09  2:12 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-btrfs@vger.kernel.org

Christoph Hellwig wrote:
> On Fri, Dec 09, 2011 at 09:40:35AM +0800, Li Zefan wrote:
>> To reproduce the bug:
>>
>>     # touch /mnt/tmp
>>     # stat /mnt/tmp | grep Change
>>     Change: 2011-12-09 09:32:23.412105981 +0800
>>     # chattr +i /mnt/tmp
>>     # stat /mnt/tmp | grep Change
>>     Change: 2011-12-09 09:32:43.198105295 +0800
>>     # umount /mnt
>>     # mount /dev/loop1 /mnt
>>     # stat /mnt/tmp | grep Change
>>     Change: 2011-12-09 09:32:23.412105981 +0800
>>
>> We should update ctime of in-memory inode before calling
>> btrfs_update_inode().
> 
> Can you submit this one as a test for xfstests?
> 

Sure.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-09  2:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09  1:40 [PATCH] Btrfs: fix ctime update of on-disk inode Li Zefan
2011-12-09  2:03 ` Christoph Hellwig
2011-12-09  2:12   ` Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox