Whamcloud - gitweb
LU-14596 ldiskfs: Fix mounting issues for newer kernels
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / linux-5.4 / ext4-attach-jinode-in-writepages.patch
1 From 01da8ce642e08594db95d940b3352ad7ee153b09 Mon Sep 17 00:00:00 2001
2 From: Shaun Tancheff <stancheff@cray.com>
3 Date: Tue, 6 Aug 2019 17:11:57 -0500
4 Subject: [PATCH] + linux-5.3/ext4-attach-jinode-in-writepages
5
6 ---
7  fs/ext4/ext4.h  | 1 +
8  fs/ext4/inode.c | 8 ++++++++
9  2 files changed, 9 insertions(+)
10
11 diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
12 index 65c02d6..f28104a 100644
13 --- a/fs/ext4/ext4.h
14 +++ b/fs/ext4/ext4.h
15 @@ -2672,6 +2672,7 @@ extern int ext4_trim_fs(struct super_block *, struct fstrim_range *);
16  extern void ext4_process_freed_data(struct super_block *sb, tid_t commit_tid);
17  
18  /* inode.c */
19 +#define HAVE_LDISKFS_INFO_JINODE
20  int ext4_inode_is_fast_symlink(struct inode *inode);
21  struct buffer_head *ext4_getblk(handle_t *, struct inode *, ext4_lblk_t, int);
22  struct buffer_head *ext4_bread(handle_t *, struct inode *, ext4_lblk_t, int);
23 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
24 index 434b256..0fd5f4e 100644
25 --- a/fs/ext4/inode.c
26 +++ b/fs/ext4/inode.c
27 @@ -735,6 +735,10 @@ out_sem:
28                                 (loff_t)map->m_lblk << inode->i_blkbits;
29                         loff_t length = (loff_t)map->m_len << inode->i_blkbits;
30  
31 +                       ret = ext4_inode_attach_jinode(inode);
32 +                       if (ret)
33 +                               return ret;
34 +
35                         if (flags & EXT4_GET_BLOCKS_IO_SUBMIT)
36                                 ret = ext4_jbd2_inode_add_wait(handle, inode,
37                                                 start_byte, length);
38 @@ -2829,6 +2833,9 @@ static int ext4_writepages(struct address_space *mapping,
39                 mpd.last_page = wbc->range_end >> PAGE_SHIFT;
40         }
41  
42 +       ret = ext4_inode_attach_jinode(inode);
43 +       if (ret)
44 +               goto out_writepages;
45         mpd.inode = inode;
46         mpd.wbc = wbc;
47         ext4_io_submit_init(&mpd.io_submit, wbc);
48 @@ -4446,6 +4453,7 @@ int ext4_inode_attach_jinode(struct inode *inode)
49                 jbd2_free_inode(jinode);
50         return 0;
51  }
52 +EXPORT_SYMBOL(ext4_inode_attach_jinode);
53  
54  /*
55   * ext4_truncate()
56 -- 
57 2.20.1
58