From 6408f2f80082175eb82c6b1bab2408c2712aef31 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 28 Sep 2018 14:54:10 -0400 Subject: [PATCH] add rebase v4.19-rc6 --- add-ext4_bmap-to-ext4_dax_aops | 34 --------- add-nonstring-annotations-to-ext4.h | 60 ---------------- avoid-arithmetic-overflow-that-can-trigger-a-BUG | 53 -------------- ...buffer-overrun-when-deleting-inline-directories | 82 ---------------------- ...rblock-checksum-after-update-free-blocks-inodes | 57 --------------- check-rename-destination-is-not-freed | 33 --------- ...e-race-between-direct-io-and-ext4_break_layouts | 70 ------------------ dont-mark-mmp-buffer-head-dirty | 38 ---------- fix-online-resize-with-bigalloc-1k | 34 --------- series | 15 +--- set-ext4_dax_aops-for-dax-files | 58 --------------- ...st_dummy_encryption-mount-option-in-proc-mounts | 31 -------- timestamps | 16 +---- truncate-resize-size-to-avoid-too-small-last-bg | 55 --------------- 14 files changed, 3 insertions(+), 633 deletions(-) delete mode 100644 add-ext4_bmap-to-ext4_dax_aops delete mode 100644 add-nonstring-annotations-to-ext4.h delete mode 100644 avoid-arithmetic-overflow-that-can-trigger-a-BUG delete mode 100644 avoid-buffer-overrun-when-deleting-inline-directories delete mode 100644 calculate-superblock-checksum-after-update-free-blocks-inodes delete mode 100644 check-rename-destination-is-not-freed delete mode 100644 close-race-between-direct-io-and-ext4_break_layouts delete mode 100644 dont-mark-mmp-buffer-head-dirty delete mode 100644 fix-online-resize-with-bigalloc-1k delete mode 100644 set-ext4_dax_aops-for-dax-files delete mode 100644 show-test_dummy_encryption-mount-option-in-proc-mounts delete mode 100644 truncate-resize-size-to-avoid-too-small-last-bg diff --git a/add-ext4_bmap-to-ext4_dax_aops b/add-ext4_bmap-to-ext4_dax_aops deleted file mode 100644 index 27c6b3b3..00000000 --- a/add-ext4_bmap-to-ext4_dax_aops +++ /dev/null @@ -1,34 +0,0 @@ -ext4, dax: add ext4_bmap to ext4_dax_aops - -From: Toshi Kani - -Ext4 mount path calls .bmap to the journal inode. This currently -works for the DAX mount case because ext4_iget() always set -'ext4_da_aops' to any regular files. - -In preparation to fix ext4_iget() to set 'ext4_dax_aops' for ext4 -DAX files, add ext4_bmap() to 'ext4_dax_aops', since bmap works for -DAX inodes. - -Fixes: 5f0663bb4a64 ("ext4, dax: introduce ext4_dax_aops") -Signed-off-by: Toshi Kani -Signed-off-by: Theodore Ts'o -Suggested-by: Jan Kara -Cc: stable@vger.kernel.org ---- - fs/ext4/inode.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index d0dd585add6a..e4acaa980467 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -3948,6 +3948,7 @@ static const struct address_space_operations ext4_dax_aops = { - .writepages = ext4_dax_writepages, - .direct_IO = noop_direct_IO, - .set_page_dirty = noop_set_page_dirty, -+ .bmap = ext4_bmap, - .invalidatepage = noop_invalidatepage, - }; - - diff --git a/add-nonstring-annotations-to-ext4.h b/add-nonstring-annotations-to-ext4.h deleted file mode 100644 index a92f104b..00000000 --- a/add-nonstring-annotations-to-ext4.h +++ /dev/null @@ -1,60 +0,0 @@ -ext4: add nonstring annotations to ext4.h - -This suppresses some false positives in gcc 8's -Wstringop-truncation - -Suggested by Miguel Ojeda (hopefully the __nonstring definition will -eventually get accepted in the compiler-gcc.h header file). - -Signed-off-by: Theodore Ts'o -Cc: Miguel Ojeda ---- - fs/ext4/ext4.h | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index 1fc013f3d944..249bcee4d7b2 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -43,6 +43,17 @@ - #define __FS_HAS_ENCRYPTION IS_ENABLED(CONFIG_EXT4_FS_ENCRYPTION) - #include - -+#include -+ -+/* Until this gets included into linux/compiler-gcc.h */ -+#ifndef __nonstring -+#if defined(GCC_VERSION) && (GCC_VERSION >= 80000) -+#define __nonstring __attribute__((nonstring)) -+#else -+#define __nonstring -+#endif -+#endif -+ - /* - * The fourth extended filesystem constants/structures - */ -@@ -1226,7 +1237,7 @@ struct ext4_super_block { - __le32 s_feature_ro_compat; /* readonly-compatible feature set */ - /*68*/ __u8 s_uuid[16]; /* 128-bit uuid for volume */ - /*78*/ char s_volume_name[16]; /* volume name */ --/*88*/ char s_last_mounted[64]; /* directory where last mounted */ -+/*88*/ char s_last_mounted[64] __nonstring; /* directory where last mounted */ - /*C8*/ __le32 s_algorithm_usage_bitmap; /* For compression */ - /* - * Performance hints. Directory preallocation should only -@@ -1277,13 +1288,13 @@ struct ext4_super_block { - __le32 s_first_error_time; /* first time an error happened */ - __le32 s_first_error_ino; /* inode involved in first error */ - __le64 s_first_error_block; /* block involved of first error */ -- __u8 s_first_error_func[32]; /* function where the error happened */ -+ __u8 s_first_error_func[32] __nonstring; /* function where the error happened */ - __le32 s_first_error_line; /* line number where error happened */ - __le32 s_last_error_time; /* most recent time of an error */ - __le32 s_last_error_ino; /* inode involved in last error */ - __le32 s_last_error_line; /* line number where error happened */ - __le64 s_last_error_block; /* block involved of last error */ -- __u8 s_last_error_func[32]; /* function where the error happened */ -+ __u8 s_last_error_func[32] __nonstring; /* function where the error happened */ - #define EXT4_S_ERR_END offsetof(struct ext4_super_block, s_mount_opts) - __u8 s_mount_opts[64]; - __le32 s_usr_quota_inum; /* inode for tracking user quota */ diff --git a/avoid-arithmetic-overflow-that-can-trigger-a-BUG b/avoid-arithmetic-overflow-that-can-trigger-a-BUG deleted file mode 100644 index 9ad67f5a..00000000 --- a/avoid-arithmetic-overflow-that-can-trigger-a-BUG +++ /dev/null @@ -1,53 +0,0 @@ -ext4: avoid arithemetic overflow that can trigger a BUG - -A maliciously crafted file system can cause an overflow when the -results of a 64-bit calculation is stored into a 32-bit length -parameter. - -https://bugzilla.kernel.org/show_bug.cgi?id=200623 - -Signed-off-by: Theodore Ts'o -Reported-by: Wen Xu -Cc: stable@vger.kernel.org ---- - fs/ext4/ext4.h | 3 +++ - fs/ext4/inode.c | 8 ++++++-- - 2 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h -index 249bcee4d7b2..ac05bd86643a 100644 ---- a/fs/ext4/ext4.h -+++ b/fs/ext4/ext4.h -@@ -686,6 +686,9 @@ enum { - /* Max physical block we can address w/o extents */ - #define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF - -+/* Max logical block we can support */ -+#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF -+ - /* - * Structure of an inode on the disk - */ -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index 8f6ad7667974..694f31364206 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -3412,12 +3412,16 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length, - { - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - unsigned int blkbits = inode->i_blkbits; -- unsigned long first_block = offset >> blkbits; -- unsigned long last_block = (offset + length - 1) >> blkbits; -+ unsigned long first_block, last_block; - struct ext4_map_blocks map; - bool delalloc = false; - int ret; - -+ if ((offset >> blkbits) > EXT4_MAX_LOGICAL_BLOCK) -+ return -EINVAL; -+ first_block = offset >> blkbits; -+ last_block = min_t(loff_t, (offset + length - 1) >> blkbits, -+ EXT4_MAX_LOGICAL_BLOCK); - - if (flags & IOMAP_REPORT) { - if (ext4_has_inline_data(inode)) { diff --git a/avoid-buffer-overrun-when-deleting-inline-directories b/avoid-buffer-overrun-when-deleting-inline-directories deleted file mode 100644 index 0d522311..00000000 --- a/avoid-buffer-overrun-when-deleting-inline-directories +++ /dev/null @@ -1,82 +0,0 @@ -ext4: avoid divide by zero fault when deleting corrupted inline directories - -A specially crafted file system can trick empty_inline_dir() into -reading past the last valid entry in a inline directory, and then run -into the end of xattr marker. This will trigger a divide by zero -fault. Fix this by using the size of the inline directory instead of -dir->i_size. - -Also clean up error reporting in __ext4_check_dir_entry so that the -message is clearer and more understandable --- and avoids the division -by zero trap if the size passed in is zero. (I'm not sure why we -coded it that way in the first place; printing offset % size is -actually more confusing and less useful.) - -https://bugzilla.kernel.org/show_bug.cgi?id=200933 - -Signed-off-by: Theodore Ts'o -Reported-by: Wen Xu -Cc: stable@vger.kernel.org -diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c -index e2902d394f1b..f93f9881ec18 100644 ---- a/fs/ext4/dir.c -+++ b/fs/ext4/dir.c -@@ -76,7 +76,7 @@ int __ext4_check_dir_entry(const char *function, unsigned int line, - else if (unlikely(rlen < EXT4_DIR_REC_LEN(de->name_len))) - error_msg = "rec_len is too small for name_len"; - else if (unlikely(((char *) de - buf) + rlen > size)) -- error_msg = "directory entry across range"; -+ error_msg = "directory entry overrun"; - else if (unlikely(le32_to_cpu(de->inode) > - le32_to_cpu(EXT4_SB(dir->i_sb)->s_es->s_inodes_count))) - error_msg = "inode out of bounds"; -@@ -85,18 +85,16 @@ int __ext4_check_dir_entry(const char *function, unsigned int line, - - if (filp) - ext4_error_file(filp, function, line, bh->b_blocknr, -- "bad entry in directory: %s - offset=%u(%u), " -- "inode=%u, rec_len=%d, name_len=%d", -- error_msg, (unsigned) (offset % size), -- offset, le32_to_cpu(de->inode), -- rlen, de->name_len); -+ "bad entry in directory: %s - offset=%u, " -+ "inode=%u, rec_len=%d, name_len=%d, size=%d", -+ error_msg, offset, le32_to_cpu(de->inode), -+ rlen, de->name_len, size); - else - ext4_error_inode(dir, function, line, bh->b_blocknr, -- "bad entry in directory: %s - offset=%u(%u), " -- "inode=%u, rec_len=%d, name_len=%d", -- error_msg, (unsigned) (offset % size), -- offset, le32_to_cpu(de->inode), -- rlen, de->name_len); -+ "bad entry in directory: %s - offset=%u, " -+ "inode=%u, rec_len=%d, name_len=%d, size=%d", -+ error_msg, offset, le32_to_cpu(de->inode), -+ rlen, de->name_len, size); - - return 1; - } -diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c -index 3543fe80a3c4..7b4736022761 100644 ---- a/fs/ext4/inline.c -+++ b/fs/ext4/inline.c -@@ -1753,6 +1753,7 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data) - { - int err, inline_size; - struct ext4_iloc iloc; -+ size_t inline_len; - void *inline_pos; - unsigned int offset; - struct ext4_dir_entry_2 *de; -@@ -1780,8 +1781,9 @@ bool empty_inline_dir(struct inode *dir, int *has_inline_data) - goto out; - } - -+ inline_len = ext4_get_inline_size(dir); - offset = EXT4_INLINE_DOTDOT_SIZE; -- while (offset < dir->i_size) { -+ while (offset < inline_len) { - de = ext4_get_inline_entry(dir, &iloc, offset, - &inline_pos, &inline_size); - if (ext4_check_dir_entry(dir, NULL, de, diff --git a/calculate-superblock-checksum-after-update-free-blocks-inodes b/calculate-superblock-checksum-after-update-free-blocks-inodes deleted file mode 100644 index 53d4db24..00000000 --- a/calculate-superblock-checksum-after-update-free-blocks-inodes +++ /dev/null @@ -1,57 +0,0 @@ -ext4: recalucate superblock checksum after updating free blocks/inodes - -When mounting the superblock, ext4_fill_super() calculates the free -blocks and free inodes and stores them in the superblock. It's not -strictly necessary, since we don't use them any more, but it's nice to -keep them roughly aligned to reality. - -Since it's not critical for file system correctness, the code doesn't -call ext4_commit_super(). The problem is that it's in -ext4_commit_super() that we recalculate the superblock checksum. So -if we're not going to call ext4_commit_super(), we need to call -ext4_superblock_csum_set() to make sure the superblock checksum is -consistent. - -Most of the time, this doesn't matter, since we end up calling -ext4_commit_super() very soon thereafter, and definitely by the time -the file system is unmounted. However, it doesn't work in this -sequence: - -mke2fs -Fq -t ext4 /dev/vdc 128M -mount /dev/vdc /vdc -cp xfstests/git-versions /vdc -godown /vdc -umount /vdc -mount /dev/vdc -tune2fs -l /dev/vdc - -With this commit, the "tune2fs -l" no longer fails. - -Reported-by: Chengguang Xu -Signed-off-by: Theodore Ts'o -Cc: stable@vger.kernel.org - - - ---- - fs/ext4/super.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index f7750bc5b85a..e41da553b430 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -4378,11 +4378,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) - block = ext4_count_free_clusters(sb); - ext4_free_blocks_count_set(sbi->s_es, - EXT4_C2B(sbi, block)); -+ ext4_superblock_csum_set(sb); - err = percpu_counter_init(&sbi->s_freeclusters_counter, block, - GFP_KERNEL); - if (!err) { - unsigned long freei = ext4_count_free_inodes(sb); - sbi->s_es->s_free_inodes_count = cpu_to_le32(freei); -+ ext4_superblock_csum_set(sb); - err = percpu_counter_init(&sbi->s_freeinodes_counter, freei, - GFP_KERNEL); - } diff --git a/check-rename-destination-is-not-freed b/check-rename-destination-is-not-freed deleted file mode 100644 index 8e0ca5f1..00000000 --- a/check-rename-destination-is-not-freed +++ /dev/null @@ -1,33 +0,0 @@ -ext4: check to make sure the rename(2)'s destination is not freed - -If the destination of the rename(2) system call exists, the inode's -link count (i_nlinks) must be non-zero. If it is, the inode can end -up on the orphan list prematurely, leading to all sorts of hilarity, -including a use-after-free. - -https://bugzilla.kernel.org/show_bug.cgi?id=200931 - -Signed-off-by: Theodore Ts'o -Reported-by: Wen Xu -Cc: stable@vger.kernel.org ---- - fs/ext4/namei.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c -index 116ff68c5bd4..377d516c475f 100644 ---- a/fs/ext4/namei.c -+++ b/fs/ext4/namei.c -@@ -3478,6 +3478,12 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, - int credits; - u8 old_file_type; - -+ if (new.inode && new.inode->i_nlink == 0) { -+ EXT4_ERROR_INODE(new.inode, -+ "target of rename is already freed"); -+ return -EFSCORRUPTED; -+ } -+ - if ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT)) && - (!projid_eq(EXT4_I(new_dir)->i_projid, - EXT4_I(old_dentry->d_inode)->i_projid))) diff --git a/close-race-between-direct-io-and-ext4_break_layouts b/close-race-between-direct-io-and-ext4_break_layouts deleted file mode 100644 index c8382a87..00000000 --- a/close-race-between-direct-io-and-ext4_break_layouts +++ /dev/null @@ -1,70 +0,0 @@ -ext4: close race between direct IO and ext4_break_layouts() - -From: Ross Zwisler - -If the refcount of a page is lowered between the time that it is returned -by dax_busy_page() and when the refcount is again checked in -ext4_break_layouts() => ___wait_var_event(), the waiting function -ext4_wait_dax_page() will never be called. This means that -ext4_break_layouts() will still have 'retry' set to false, so we'll stop -looping and never check the refcount of other pages in this inode. - -Instead, always continue looping as long as dax_layout_busy_page() gives us -a page which it found with an elevated refcount. - -Signed-off-by: Ross Zwisler -Reviewed-by: Jan Kara -Signed-off-by: Jan Kara -Signed-off-by: Theodore Ts'o -Cc: stable@vger.kernel.org ---- - -v2: -- remove verbiage in comment header (Jan) - - fs/ext4/inode.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index 8f6ad7667974..d2663a1e3ec2 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -4191,9 +4191,8 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, - return 0; - } - --static void ext4_wait_dax_page(struct ext4_inode_info *ei, bool *did_unlock) -+static void ext4_wait_dax_page(struct ext4_inode_info *ei) - { -- *did_unlock = true; - up_write(&ei->i_mmap_sem); - schedule(); - down_write(&ei->i_mmap_sem); -@@ -4203,14 +4202,12 @@ int ext4_break_layouts(struct inode *inode) - { - struct ext4_inode_info *ei = EXT4_I(inode); - struct page *page; -- bool retry; - int error; - - if (WARN_ON_ONCE(!rwsem_is_locked(&ei->i_mmap_sem))) - return -EINVAL; - - do { -- retry = false; - page = dax_layout_busy_page(inode->i_mapping); - if (!page) - return 0; -@@ -4218,8 +4215,8 @@ int ext4_break_layouts(struct inode *inode) - error = ___wait_var_event(&page->_refcount, - atomic_read(&page->_refcount) == 1, - TASK_INTERRUPTIBLE, 0, 0, -- ext4_wait_dax_page(ei, &retry)); -- } while (error == 0 && retry); -+ ext4_wait_dax_page(ei)); -+ } while (error == 0); - - return error; - } - - diff --git a/dont-mark-mmp-buffer-head-dirty b/dont-mark-mmp-buffer-head-dirty deleted file mode 100644 index 820eea04..00000000 --- a/dont-mark-mmp-buffer-head-dirty +++ /dev/null @@ -1,38 +0,0 @@ -ext4: don't mark mmp buffer head dirty - -From: Li Dongyang - -Marking mmp bh dirty before writing it will make writeback -pick up mmp block later and submit a write, we don't want the -duplicate write as kmmpd thread should have full control of -reading and writing the mmp block. -Another reason is we will also have random I/O error on -the writeback request when blk integrity is enabled, because -kmmpd could modify the content of the mmp block(e.g. setting -new seq and time) while the mmp block is under I/O requested -by writeback. - -Signed-off-by: Li Dongyang -Signed-off-by: Theodore Ts'o -Reviewed-by: Andreas Dilger -Cc: stable@vger.kernel.org ---- - fs/ext4/mmp.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c -index 39b07c2d3384..2305b4374fd3 100644 ---- a/fs/ext4/mmp.c -+++ b/fs/ext4/mmp.c -@@ -49,7 +49,6 @@ static int write_mmp_block(struct super_block *sb, struct buffer_head *bh) - */ - sb_start_write(sb); - ext4_mmp_csum_set(sb, mmp); -- mark_buffer_dirty(bh); - lock_buffer(bh); - bh->b_end_io = end_buffer_write_sync; - get_bh(bh); --- -2.18.0 - - diff --git a/fix-online-resize-with-bigalloc-1k b/fix-online-resize-with-bigalloc-1k deleted file mode 100644 index db514b26..00000000 --- a/fix-online-resize-with-bigalloc-1k +++ /dev/null @@ -1,34 +0,0 @@ -ext4: fix online resizing for bigalloc file systems with a 1k block size - -An online resize of a file system with the bigalloc feature enabled -and a 1k block size would be refused since ext4_resize_begin() did not -understand s_first_data_block is 0 for all bigalloc file systems, even -when the block size is 1k. - -Signed-off-by: Theodore Ts'o -Cc: stable@vger.kernel.org ---- - fs/ext4/resize.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c -index 33655a6eff4d..ebbc663d0798 100644 ---- a/fs/ext4/resize.c -+++ b/fs/ext4/resize.c -@@ -19,6 +19,7 @@ - - int ext4_resize_begin(struct super_block *sb) - { -+ struct ext4_sb_info *sbi = EXT4_SB(sb); - int ret = 0; - - if (!capable(CAP_SYS_RESOURCE)) -@@ -29,7 +30,7 @@ int ext4_resize_begin(struct super_block *sb) - * because the user tools have no way of handling this. Probably a - * bad time to do it anyways. - */ -- if (EXT4_SB(sb)->s_sbh->b_blocknr != -+ if (EXT4_B2C(sbi, sbi->s_sbh->b_blocknr) != - le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { - ext4_warning(sb, "won't resize using backup superblock at %llu", - (unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr); diff --git a/series b/series index a38d9416..3f5dc217 100644 --- a/series +++ b/series @@ -1,17 +1,4 @@ -# 863c37fcb14f - -add-nonstring-annotations-to-ext4.h -check-rename-destination-is-not-freed -avoid-buffer-overrun-when-deleting-inline-directories -avoid-arithmetic-overflow-that-can-trigger-a-BUG -calculate-superblock-checksum-after-update-free-blocks-inodes -truncate-resize-size-to-avoid-too-small-last-bg -fix-online-resize-with-bigalloc-1k -close-race-between-direct-io-and-ext4_break_layouts -show-test_dummy_encryption-mount-option-in-proc-mounts -dont-mark-mmp-buffer-head-dirty -add-ext4_bmap-to-ext4_dax_aops -set-ext4_dax_aops-for-dax-files +# v4.19-rc6 #################################################### # unstable patches diff --git a/set-ext4_dax_aops-for-dax-files b/set-ext4_dax_aops-for-dax-files deleted file mode 100644 index 92a945e6..00000000 --- a/set-ext4_dax_aops-for-dax-files +++ /dev/null @@ -1,58 +0,0 @@ -ext4, dax: set ext4_dax_aops for dax files - -From: Toshi Kani - -Sync syscall to DAX file needs to flush processor cache, but it -currently does not flush to existing DAX files. This is because -'ext4_da_aops' is set to address_space_operations of existing DAX -files, instead of 'ext4_dax_aops', since S_DAX flag is set after -ext4_set_aops() in the open path. - - New file - -------- - lookup_open - ext4_create - __ext4_new_inode - ext4_set_inode_flags // Set S_DAX flag - ext4_set_aops // Set aops to ext4_dax_aops - - Existing file - ------------- - lookup_open - ext4_lookup - ext4_iget - ext4_set_aops // Set aops to ext4_da_aops - ext4_set_inode_flags // Set S_DAX flag - -Change ext4_iget() to initialize i_flags before ext4_set_aops(). - -Fixes: 5f0663bb4a64 ("ext4, dax: introduce ext4_dax_aops") -Signed-off-by: Toshi Kani -Signed-off-by: Theodore Ts'o -Suggested-by: Jan Kara -Cc: stable@vger.kernel.org ---- - fs/ext4/inode.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c -index e4acaa980467..b19387b75f2b 100644 ---- a/fs/ext4/inode.c -+++ b/fs/ext4/inode.c -@@ -4896,6 +4896,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) - * not initialized on a new filesystem. */ - } - ei->i_flags = le32_to_cpu(raw_inode->i_flags); -+ ext4_set_inode_flags(inode); - inode->i_blocks = ext4_inode_blocks(raw_inode, ei); - ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo); - if (ext4_has_feature_64bit(sb)) -@@ -5042,7 +5043,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) - goto bad_inode; - } - brelse(iloc.bh); -- ext4_set_inode_flags(inode); - - unlock_new_inode(inode); - return inode; - diff --git a/show-test_dummy_encryption-mount-option-in-proc-mounts b/show-test_dummy_encryption-mount-option-in-proc-mounts deleted file mode 100644 index 88618347..00000000 --- a/show-test_dummy_encryption-mount-option-in-proc-mounts +++ /dev/null @@ -1,31 +0,0 @@ -ext4: show test_dummy_encryption mount option in /proc/mounts - -From: Eric Biggers - -When in effect, add "test_dummy_encryption" to _ext4_show_options() so -that it is shown in /proc/mounts and other relevant procfs files. - -Signed-off-by: Eric Biggers -Signed-off-by: Theodore Ts'o -Cc: stable@vger.kernel.org ---- - fs/ext4/super.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/fs/ext4/super.c b/fs/ext4/super.c -index 5863fd22e90bb..6f5bd40ef341f 100644 ---- a/fs/ext4/super.c -+++ b/fs/ext4/super.c -@@ -2145,6 +2145,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb, - SEQ_OPTS_PRINT("max_dir_size_kb=%u", sbi->s_max_dir_size_kb); - if (test_opt(sb, DATA_ERR_ABORT)) - SEQ_OPTS_PUTS("data_err=abort"); -+ if (DUMMY_ENCRYPTION_ENABLED(sbi)) -+ SEQ_OPTS_PUTS("test_dummy_encryption"); - - ext4_show_quota_options(seq, sb); - return 0; --- -2.19.0.rc2.392.g5ba43deb5a-goog - - diff --git a/timestamps b/timestamps index 8630deb6..fbbe2c72 100755 --- a/timestamps +++ b/timestamps @@ -31,20 +31,8 @@ touch -d @1531110276 cleaner touch -d @1531110336 load-jmap-from-journal touch -d @1531110396 disable-writeback touch -d @1531115020 add-ext4-journal-lazy-mount-option -touch -d @1535346911 add-nonstring-annotations-to-ext4.h -touch -d @1535348829 check-rename-destination-is-not-freed touch -d @1535376041 stable-boundary -touch -d @1535376165 avoid-buffer-overrun-when-deleting-inline-directories -touch -d @1535820304 avoid-arithmetic-overflow-that-can-trigger-a-BUG -touch -d @1535827334 calculate-superblock-checksum-after-update-free-blocks-inodes -touch -d @1536027583 truncate-resize-size-to-avoid-too-small-last-bg -touch -d @1536027901 fix-online-resize-with-bigalloc-1k -touch -d @1536687076 close-race-between-direct-io-and-ext4_break_layouts -touch -d @1537036106 show-test_dummy_encryption-mount-option-in-proc-mounts -touch -d @1537045885 dont-mark-mmp-buffer-head-dirty -touch -d @1537061021 add-ext4_bmap-to-ext4_dax_aops -touch -d @1537061879 set-ext4_dax_aops-for-dax-files -touch -d @1537062364 series -touch -d @1537062373 status touch -d @1537242017 save-patch touch -d @1538160311 timestamps +touch -d @1538160345 status +touch -d @1538160503 series diff --git a/truncate-resize-size-to-avoid-too-small-last-bg b/truncate-resize-size-to-avoid-too-small-last-bg deleted file mode 100644 index 198b39e3..00000000 --- a/truncate-resize-size-to-avoid-too-small-last-bg +++ /dev/null @@ -1,55 +0,0 @@ -ext4: fix online resize's handling of a too-small final block group - -Avoid growing the file system to an extent so that the last block -group is too small to hold all of the metadata that must be stored in -the block group. - -This problem can be triggered with the following reproducer: - -umount /mnt -mke2fs -F -m0 -b 4096 -t ext4 -O resize_inode,^has_journal \ - -E resize=1073741824 /tmp/foo.img 128M -mount /tmp/foo.img /mnt -truncate --size 1708M /tmp/foo.img -resize2fs /dev/loop0 295400 -umount /mnt -e2fsck -fy /tmp/foo.img - -Reported-by: Torsten Hilbrich -Signed-off-by: Theodore Ts'o -Cc: stable@vger.kernel.org ---- - fs/ext4/resize.c | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c -index e5fb38451a73..33655a6eff4d 100644 ---- a/fs/ext4/resize.c -+++ b/fs/ext4/resize.c -@@ -1986,6 +1986,26 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) - } - } - -+ /* -+ * Make sure the last group has enough space so that it's -+ * guaranteed to have enough space for all metadata blocks -+ * that it might need to hold. (We might not need to store -+ * the inode table blocks in the last block group, but there -+ * will be cases where this might be needed.) -+ */ -+ if ((ext4_group_first_block_no(sb, n_group) + -+ ext4_group_overhead_blocks(sb, n_group) + 2 + -+ sbi->s_itb_per_group + sbi->s_cluster_ratio) >= n_blocks_count) { -+ n_blocks_count = ext4_group_first_block_no(sb, n_group); -+ n_group--; -+ n_blocks_count_retry = 0; -+ if (resize_inode) { -+ iput(resize_inode); -+ resize_inode = NULL; -+ } -+ goto retry; -+ } -+ - /* extend the last group */ - if (n_group == o_group) - add = n_blocks_count - o_blocks_count; -- 2.11.4.GIT