All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: update inode flags when renaming
@ 2013-02-22  8:11 Liu Bo
  2013-02-22  8:32 ` Marios Titas
  0 siblings, 1 reply; 15+ messages in thread
From: Liu Bo @ 2013-02-22  8:11 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Marios Titas

A user reported some weird behaviours,
if we move a file with the noCow flag to a directory without the
noCow flag, the file is now without the flag, but after remount,
we'll find the file's noCow flag comes back.

This is because we missed a proper inode update after inheriting
parent directory's flags,

Reported-by: Marios Titas <redneb8888@gmail.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/inode.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d9984fa..d2e3352 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7478,8 +7478,6 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 					old_dentry->d_inode,
 					old_dentry->d_name.name,
 					old_dentry->d_name.len);
-		if (!ret)
-			ret = btrfs_update_inode(trans, root, old_inode);
 	}
 	if (ret) {
 		btrfs_abort_transaction(trans, root, ret);
@@ -7514,6 +7512,11 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	}
 
 	fixup_inode_flags(new_dir, old_inode);
+	ret = btrfs_update_inode(trans, root, old_inode);
+	if (ret) {
+		btrfs_abort_transaction(trans, root, ret);
+		goto out_fail;
+	}
 
 	ret = btrfs_add_link(trans, new_dir, old_inode,
 			     new_dentry->d_name.name,
-- 
1.7.7.6


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

end of thread, other threads:[~2013-02-25 11:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22  8:11 [PATCH] Btrfs: update inode flags when renaming Liu Bo
2013-02-22  8:32 ` Marios Titas
2013-02-22  8:40   ` Liu Bo
2013-02-22  9:10     ` Marios Titas
2013-02-22 10:00       ` Liu Bo
2013-02-22 21:19         ` Marios Titas
2013-02-22 22:21           ` David Sterba
2013-02-22  9:34     ` Miao Xie
2013-02-22  9:50       ` Marios Titas
2013-02-22 10:06       ` Liu Bo
2013-02-22 22:04       ` David Sterba
2013-02-25  3:50         ` Liu Bo
2013-02-25  4:23           ` Miao Xie
2013-02-25  5:03             ` Liu Bo
2013-02-25 11:22             ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.