Whamcloud - gitweb
New tag 2.15.63
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel7.9 / ext4-enc-flag.patch
1 diff -wur a/fs/ext4/ext4.h b/fs/ext4/ext4.h
2 --- a/fs/ext4/ext4.h
3 +++ b/fs/ext4/ext4.h
4 @@ -1154,6 +1154,9 @@ struct ext4_inode_info {
5  #define EXT4_MOUNT_DISCARD             0x40000000 /* Issue DISCARD requests */
6  #define EXT4_MOUNT_INIT_INODE_TABLE    0x80000000 /* Initialize uninitialized itables */
7  
8 +/* we know this is a Lustre mount thanks to the DIRDATA flag */
9 +#define IS_LUSTRE_MOUNT(sb)    test_opt((sb), DIRDATA)
10 +
11  /*
12   * Mount flags set either automatically (could not be set by mount option)
13   * based on per file system feature or property or in special cases such as
14 diff -wur a/fs/ext4/xattr.c b/fs/ext4/xattr.c
15 --- a/fs/ext4/xattr.c
16 +++ b/fs/ext4/xattr.c
17 @@ -654,6 +654,7 @@
18         up_read(&EXT4_I(inode)->xattr_sem);
19         return error;
20  }
21 +EXPORT_SYMBOL(ext4_xattr_get);
22  
23  static int
24  ext4_xattr_list_entries(struct dentry *dentry, struct ext4_xattr_entry *entry,
25 @@ -1197,14 +1197,21 @@
26                         ext4_handle_sync(handle);
27         }
28  
29 +       if (!error && name_index == EXT4_XATTR_INDEX_ENCRYPTION &&
30 +           strcmp(name, "c") == 0) {
31 +               EXT4_I(inode)->i_flags |= EXT4_ENCRYPT_FL;
32 +               mark_inode_dirty(inode);
33 +       }
34 +
35  cleanup:
36         brelse(is.iloc.bh);
37         brelse(bs.bh);
38         if (no_expand == 0)
39                 ext4_clear_inode_state(inode, EXT4_STATE_NO_EXPAND);
40         up_write(&EXT4_I(inode)->xattr_sem);
41         return error;
42  }
43 +EXPORT_SYMBOL(ext4_xattr_set_handle);
44  
45  /*
46   * ext4_xattr_set()
47 diff -wur a/fs/ext4/xattr.h b/fs/ext4/xattr.h
48 --- a/fs/ext4/xattr.h
49 +++ b/fs/ext4/xattr.h
50 @@ -121,6 +121,9 @@
51  extern const struct xattr_handler ext4_xattr_acl_default_handler;
52  extern const struct xattr_handler ext4_xattr_security_handler;
53  
54 +#define EXT4_XATTR_INDEX_ENCRYPTION            9
55 +#define EXT4_XATTR_NAME_ENCRYPTION_CONTEXT "c"
56 +
57  extern ssize_t ext4_listxattr(struct dentry *, char *, size_t);
58  
59  extern int ext4_xattr_get(struct inode *, int, const char *, void *, size_t);
60 diff -wur a/fs/ext4/ext4.h b/fs/ext4/ext4.h
61 --- a/fs/ext4/ext4.h
62 +++ b/fs/ext4/ext4.h
63 @@ -381,7 +378,8 @@ struct flex_groups {
64  #define EXT4_DIRTY_FL                  0x00000100
65  #define EXT4_COMPRBLK_FL               0x00000200 /* One or more compressed clusters */
66  #define EXT4_NOCOMPR_FL                        0x00000400 /* Don't compress */
67 -#define EXT4_ECOMPR_FL                 0x00000800 /* Compression error */
68 +/* nb: was previously EXT4_ECOMPR_FL */
69 +#define EXT4_ENCRYPT_FL                 0x00000800 /* encrypted file */
70  /* End compression flags --- maybe not all used */
71  #define EXT4_INDEX_FL                  0x00001000 /* hash-indexed directory */
72  #define EXT4_IMAGIC_FL                 0x00002000 /* AFS directory */
73 @@ -447,7 +445,7 @@ enum {
74         EXT4_INODE_DIRTY        = 8,
75         EXT4_INODE_COMPRBLK     = 9,    /* One or more compressed clusters */
76         EXT4_INODE_NOCOMPR      = 10,   /* Don't compress */
77 -       EXT4_INODE_ECOMPR       = 11,   /* Compression error */
78 +       EXT4_INODE_ENCRYPT      = 11,   /* Encrypted file */
79  /* End compression flags --- maybe not all used */
80         EXT4_INODE_INDEX        = 12,   /* hash-indexed directory */
81         EXT4_INODE_IMAGIC       = 13,   /* AFS directory */
82 @@ -493,7 +491,7 @@ static inline void ext4_check_flag_va
83         CHECK_FLAG_VALUE(DIRTY);
84         CHECK_FLAG_VALUE(COMPRBLK);
85         CHECK_FLAG_VALUE(NOCOMPR);
86 -       CHECK_FLAG_VALUE(ECOMPR);
87 +       CHECK_FLAG_VALUE(ENCRYPT);
88         CHECK_FLAG_VALUE(INDEX);
89         CHECK_FLAG_VALUE(IMAGIC);
90         CHECK_FLAG_VALUE(JOURNAL_DATA);