浏览代码

Btrfs: fix missing inherited flag in rename

When we move a file into a directory with compression flag, we need to
inherite BTRFS_INODE_COMPRESS and clear BTRFS_INODE_NOCOMPRESS as well.
But if we move a file into a directory without compression flag, we need
to clear both of them.

It is the way how our setflags deals with compression flag, so keep
the same behaviour here.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Liu Bo 13 年之前
父节点
当前提交
bc1782374b
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      fs/btrfs/inode.c

+ 6 - 3
fs/btrfs/inode.c

@@ -7122,10 +7122,13 @@ static void fixup_inode_flags(struct inode *dir, struct inode *inode)
 	else
 	else
 		b_inode->flags &= ~BTRFS_INODE_NODATACOW;
 		b_inode->flags &= ~BTRFS_INODE_NODATACOW;
 
 
-	if (b_dir->flags & BTRFS_INODE_COMPRESS)
+	if (b_dir->flags & BTRFS_INODE_COMPRESS) {
 		b_inode->flags |= BTRFS_INODE_COMPRESS;
 		b_inode->flags |= BTRFS_INODE_COMPRESS;
-	else
-		b_inode->flags &= ~BTRFS_INODE_COMPRESS;
+		b_inode->flags &= ~BTRFS_INODE_NOCOMPRESS;
+	} else {
+		b_inode->flags &= ~(BTRFS_INODE_COMPRESS |
+				    BTRFS_INODE_NOCOMPRESS);
+	}
 }
 }
 
 
 static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,