Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[linux-2.6-microblaze.git] / fs / ext4 / ioctl.c
index eff6835..3c4f8bb 100644 (file)
@@ -63,6 +63,7 @@ static void swap_inode_data(struct inode *inode1, struct inode *inode2)
        loff_t isize;
        struct ext4_inode_info *ei1;
        struct ext4_inode_info *ei2;
+       unsigned long tmp;
 
        ei1 = EXT4_I(inode1);
        ei2 = EXT4_I(inode2);
@@ -72,7 +73,10 @@ static void swap_inode_data(struct inode *inode1, struct inode *inode2)
        swap(inode1->i_mtime, inode2->i_mtime);
 
        memswap(ei1->i_data, ei2->i_data, sizeof(ei1->i_data));
-       swap(ei1->i_flags, ei2->i_flags);
+       tmp = ei1->i_flags & EXT4_FL_SHOULD_SWAP;
+       ei1->i_flags = (ei2->i_flags & EXT4_FL_SHOULD_SWAP) |
+               (ei1->i_flags & ~EXT4_FL_SHOULD_SWAP);
+       ei2->i_flags = tmp | (ei2->i_flags & ~EXT4_FL_SHOULD_SWAP);
        swap(ei1->i_disksize, ei2->i_disksize);
        ext4_es_remove_extent(inode1, 0, EXT_MAX_BLOCKS);
        ext4_es_remove_extent(inode2, 0, EXT_MAX_BLOCKS);
@@ -128,6 +132,7 @@ static long swap_inode_boot_loader(struct super_block *sb,
 
        if (inode->i_nlink != 1 || !S_ISREG(inode->i_mode) ||
            IS_SWAPFILE(inode) || IS_ENCRYPTED(inode) ||
+           (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) ||
            ext4_has_inline_data(inode)) {
                err = -EINVAL;
                goto journal_err_out;
@@ -252,7 +257,7 @@ journal_err_out:
        return err;
 }
 
-#ifdef CONFIG_EXT4_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
 static int uuid_is_zero(__u8 u[16])
 {
        int     i;
@@ -1020,7 +1025,7 @@ resizefs_out:
                return fscrypt_ioctl_set_policy(filp, (const void __user *)arg);
 
        case EXT4_IOC_GET_ENCRYPTION_PWSALT: {
-#ifdef CONFIG_EXT4_FS_ENCRYPTION
+#ifdef CONFIG_FS_ENCRYPTION
                int err, err2;
                struct ext4_sb_info *sbi = EXT4_SB(sb);
                handle_t *handle;