Whamcloud - gitweb
b=22769 improve error message for dx_probe
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3_fix_i_flags.patch
1 Index: b/fs/ext3/inode.c
2 ===================================================================
3 --- a/fs/ext3/inode.c
4 +++ b/fs/ext3/inode.c
5 @@ -2676,6 +2676,25 @@ void ext3_set_inode_flags(struct inode *
6                 inode->i_flags |= S_DIRSYNC;
7  }
8  
9 +/* Propagate flags from i_flags to EXT3_I(inode)->i_flags */
10 +void ext3_get_inode_flags(struct ldiskfs_inode_info *ei)
11 +{
12 +        unsigned int flags = ei->vfs_inode.i_flags;
13 +
14 +        ei->i_flags &= ~(EXT3_SYNC_FL|EXT3_APPEND_FL|
15 +                        EXT3_IMMUTABLE_FL|EXT3_NOATIME_FL|EXT3_DIRSYNC_FL);
16 +        if (flags & S_SYNC)
17 +                ei->i_flags |= EXT3_SYNC_FL;
18 +        if (flags & S_APPEND)
19 +                ei->i_flags |= EXT3_APPEND_FL;
20 +        if (flags & S_IMMUTABLE)
21 +                ei->i_flags |= EXT3_IMMUTABLE_FL;
22 +        if (flags & S_NOATIME)
23 +                ei->i_flags |= EXT3_NOATIME_FL;
24 +        if (flags & S_DIRSYNC)
25 +                ei->i_flags |= EXT3_DIRSYNC_FL;
26 +}
27 +
28  void ext3_read_inode(struct inode * inode)
29  {
30         struct ext3_iloc iloc;
31 @@ -2841,6 +2860,7 @@ static int ext3_do_update_inode(handle_t
32         if (ei->i_state & EXT3_STATE_NEW)
33                 memset(raw_inode, 0, EXT3_SB(inode->i_sb)->s_inode_size);
34  
35 +       ext3_get_inode_flags(ei);
36         raw_inode->i_mode = cpu_to_le16(inode->i_mode);
37         if(!(test_opt(inode->i_sb, NO_UID32))) {
38                 raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
39 Index: b/fs/ext3/ioctl.c
40 ===================================================================
41 --- a/fs/ext3/ioctl.c
42 +++ b/fs/ext3/ioctl.c
43 @@ -117,6 +117,7 @@ int ext3_ioctl (struct inode * inode, st
44                 return rc;
45         }
46         case EXT3_IOC_GETFLAGS:
47 +               ext3_get_inode_flags(ei);
48                 flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
49                 return put_user(flags, (int __user *) arg);
50         case EXT3_IOC_SETFLAGS: {
51 Index: b/include/linux/ext3_fs.h
52 ===================================================================
53 --- a/include/linux/ext3_fs.h
54 +++ b/include/linux/ext3_fs.h
55 @@ -1092,6 +1092,7 @@ extern int ext3_get_inode_loc(struct ino
56  extern int ext3_can_truncate(struct inode *inode);
57  extern void ext3_truncate (struct inode *);
58  extern void ext3_set_inode_flags(struct inode *);
59 +extern void ext3_get_inode_flags(struct ldiskfs_inode_info *ei);
60  extern void ext3_set_aops(struct inode *inode);
61  extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
62                        u64 start, u64 len);