From 3ae4c5c20d6e0943b72d3c61f9315302c5eb19d9 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 26 Mar 2017 19:09:00 -0400 Subject: [PATCH] Sync changes before pull request to Linus --- fix-spelling-nits | 34 +++++++++ lock-xattr-block-before-calculating-checksum | 107 +++++++++++++++++++++++---- series | 3 +- timestamps | 34 +++++---- 4 files changed, 147 insertions(+), 31 deletions(-) create mode 100644 fix-spelling-nits diff --git a/fix-spelling-nits b/fix-spelling-nits new file mode 100644 index 00000000..392e95bd --- /dev/null +++ b/fix-spelling-nits @@ -0,0 +1,34 @@ +ext4: fix two spelling nits + +Signed-off-by: Theodore Ts'o +--- + fs/ext4/inode.c | 2 +- + fs/ext4/move_extent.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c +index f622d4a577e3..f303d3a7f44a 100644 +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -5400,7 +5400,7 @@ int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, + * If there is inline data in the inode, the inode will normally not + * have data blocks allocated (it may have an external xattr block). + * Report at least one sector for such files, so tools like tar, rsync, +- * others doen't incorrectly think the file is completely sparse. ++ * others don't incorrectly think the file is completely sparse. + */ + if (unlikely(ext4_has_inline_data(inode))) + stat->blocks += (stat->size + 511) >> 9; +diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c +index 6fc14def0c70..615bc03d0fbd 100644 +--- a/fs/ext4/move_extent.c ++++ b/fs/ext4/move_extent.c +@@ -511,7 +511,7 @@ mext_check_arguments(struct inode *orig_inode, + if ((orig_start & ~(PAGE_MASK >> orig_inode->i_blkbits)) != + (donor_start & ~(PAGE_MASK >> orig_inode->i_blkbits))) { + ext4_debug("ext4 move extent: orig and donor's start " +- "offset are not alligned [ino:orig %lu, donor %lu]\n", ++ "offsets are not aligned [ino:orig %lu, donor %lu]\n", + orig_inode->i_ino, donor_inode->i_ino); + return -EINVAL; + } diff --git a/lock-xattr-block-before-calculating-checksum b/lock-xattr-block-before-calculating-checksum index 3d666dfc..2b9571db 100644 --- a/lock-xattr-block-before-calculating-checksum +++ b/lock-xattr-block-before-calculating-checksum @@ -1,7 +1,7 @@ -ext4: lock the the xattr block before calculating its checksum +ext4: lock the xattr block before checksuming it -We must lock the xattr block in order to avoid spurious checksum -failures. +We must lock the xattr block before calculating or verifying the +checksum in order to avoid spurious checksum failures. https://bugzilla.kernel.org/show_bug.cgi?id=193661 @@ -9,14 +9,14 @@ Reported-by: Colin Ian King Signed-off-by: Theodore Ts'o Cc: stable@vger.kernel.org --- - fs/ext4/xattr.c | 31 ++++++++++++++----------------- - 1 file changed, 14 insertions(+), 17 deletions(-) + fs/ext4/xattr.c | 65 +++++++++++++++++++++++++++++++---------------------------------- + 1 file changed, 31 insertions(+), 34 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c -index 67636acf7624..3247057ef5ff 100644 +index 67636acf7624..996e7900d4c8 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c -@@ -131,30 +131,27 @@ static __le32 ext4_xattr_block_csum(struct inode *inode, +@@ -131,31 +131,26 @@ static __le32 ext4_xattr_block_csum(struct inode *inode, } static int ext4_xattr_block_csum_verify(struct inode *inode, @@ -42,25 +42,28 @@ index 67636acf7624..3247057ef5ff 100644 - hdr->h_checksum = ext4_xattr_block_csum(inode, block_nr, hdr); + if (ext4_has_metadata_csum(inode->i_sb)) { + lock_buffer(bh); -+ ret = hdr->h_checksum == ext4_xattr_block_csum(inode, -+ bh->b_blocknr, hdr); ++ ret = (hdr->h_checksum == ext4_xattr_block_csum(inode, ++ bh->b_blocknr, hdr)); + unlock_buffer(bh); + } + return ret; } - static inline int ext4_handle_dirty_xattr_block(handle_t *handle, - struct inode *inode, - struct buffer_head *bh) +-static inline int ext4_handle_dirty_xattr_block(handle_t *handle, +- struct inode *inode, +- struct buffer_head *bh) ++static void ext4_xattr_block_csum_set(struct inode *inode, ++ struct buffer_head *bh) { - ext4_xattr_block_csum_set(inode, bh->b_blocknr, BHDR(bh)); +- return ext4_handle_dirty_metadata(handle, inode, bh); + if (ext4_has_metadata_csum(inode->i_sb)) + BHDR(bh)->h_checksum = ext4_xattr_block_csum(inode, + bh->b_blocknr, BHDR(bh)); - return ext4_handle_dirty_metadata(handle, inode, bh); } -@@ -233,7 +230,7 @@ ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh) + static inline const struct xattr_handler * +@@ -233,7 +228,7 @@ ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh) if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || BHDR(bh)->h_blocks != cpu_to_le32(1)) return -EFSCORRUPTED; @@ -69,3 +72,79 @@ index 67636acf7624..3247057ef5ff 100644 return -EFSBADCRC; error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size, bh->b_data); +@@ -618,23 +613,22 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, + } + } + ++ ext4_xattr_block_csum_set(inode, bh); + /* + * Beware of this ugliness: Releasing of xattr block references + * from different inodes can race and so we have to protect + * from a race where someone else frees the block (and releases + * its journal_head) before we are done dirtying the buffer. In + * nojournal mode this race is harmless and we actually cannot +- * call ext4_handle_dirty_xattr_block() with locked buffer as ++ * call ext4_handle_dirty_metadata() with locked buffer as + * that function can call sync_dirty_buffer() so for that case + * we handle the dirtying after unlocking the buffer. + */ + if (ext4_handle_valid(handle)) +- error = ext4_handle_dirty_xattr_block(handle, inode, +- bh); ++ error = ext4_handle_dirty_metadata(handle, inode, bh); + unlock_buffer(bh); + if (!ext4_handle_valid(handle)) +- error = ext4_handle_dirty_xattr_block(handle, inode, +- bh); ++ error = ext4_handle_dirty_metadata(handle, inode, bh); + if (IS_SYNC(inode)) + ext4_handle_sync(handle); + dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1)); +@@ -863,13 +857,14 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + ext4_xattr_cache_insert(ext4_mb_cache, + bs->bh); + } ++ ext4_xattr_block_csum_set(inode, bs->bh); + unlock_buffer(bs->bh); + if (error == -EFSCORRUPTED) + goto bad_block; + if (!error) +- error = ext4_handle_dirty_xattr_block(handle, +- inode, +- bs->bh); ++ error = ext4_handle_dirty_metadata(handle, ++ inode, ++ bs->bh); + if (error) + goto cleanup; + goto inserted; +@@ -967,10 +962,11 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + ce->e_reusable = 0; + ea_bdebug(new_bh, "reusing; refcount now=%d", + ref); ++ ext4_xattr_block_csum_set(inode, new_bh); + unlock_buffer(new_bh); +- error = ext4_handle_dirty_xattr_block(handle, +- inode, +- new_bh); ++ error = ext4_handle_dirty_metadata(handle, ++ inode, ++ new_bh); + if (error) + goto cleanup_dquot; + } +@@ -1020,11 +1016,12 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, + goto getblk_failed; + } + memcpy(new_bh->b_data, s->base, new_bh->b_size); ++ ext4_xattr_block_csum_set(inode, new_bh); + set_buffer_uptodate(new_bh); + unlock_buffer(new_bh); + ext4_xattr_cache_insert(ext4_mb_cache, new_bh); +- error = ext4_handle_dirty_xattr_block(handle, +- inode, new_bh); ++ error = ext4_handle_dirty_metadata(handle, inode, ++ new_bh); + if (error) + goto cleanup; + } diff --git a/series b/series index 3f429f2b..7c439b8b 100644 --- a/series +++ b/series @@ -1,8 +1,9 @@ # cab7076a185e -lock-xattr-block-before-calculating-checksum mark-inode-dirty-after-converting-inline-directory dont-leak-memory-if-setting-up-journal-failures +lock-xattr-block-before-calculating-checksum +fix-spelling-nits #################################################### # unstable patches diff --git a/timestamps b/timestamps index c3123b8d..540d7d18 100755 --- a/timestamps +++ b/timestamps @@ -39,20 +39,22 @@ touch -d @1485974942 save-patch touch -d @1486090090 remove-unused-function-ext4_dax_huge_fault touch -d @1486187507 fix-readpage-lockups touch -d @1487173020 dont-wipe-log-on-unmount -touch -d @1488292989 lock-xattr-block-before-calculating-checksum -touch -d @1488293049 stable-boundary -touch -d @1488293109 stable-boundary-undo.patch -touch -d @1488293169 jbd2-suppress-extra-newline-in-jbd2_debug -touch -d @1488293229 jbd2-dont-double-bump-transaction-number -touch -d @1488293289 journal-superblock-changes -touch -d @1488293349 add-journal-no-cleanup-option -touch -d @1488293409 add-support-for-log-metadata-block-tracking-in-log -touch -d @1488293469 add-indirection-to-metadata-block-read-paths -touch -d @1488293529 cleaner -touch -d @1488293589 load-jmap-from-journal -touch -d @1488293649 disable-writeback -touch -d @1488293709 add-ext4-journal-lazy-mount-option -touch -d @1489603178 series touch -d @1489603922 mark-inode-dirty-after-converting-inline-directory -touch -d @1489603961 status -touch -d @1489603967 timestamps +touch -d @1489604928 dont-leak-memory-if-setting-up-journal-failures +touch -d @1489604988 stable-boundary +touch -d @1489605048 stable-boundary-undo.patch +touch -d @1489605108 jbd2-suppress-extra-newline-in-jbd2_debug +touch -d @1489605168 jbd2-dont-double-bump-transaction-number +touch -d @1489875201 journal-superblock-changes +touch -d @1489875205 add-journal-no-cleanup-option +touch -d @1489875207 add-support-for-log-metadata-block-tracking-in-log +touch -d @1489875209 add-indirection-to-metadata-block-read-paths +touch -d @1489900163 cleaner +touch -d @1489900165 load-jmap-from-journal +touch -d @1489900166 disable-writeback +touch -d @1489900168 add-ext4-journal-lazy-mount-option +touch -d @1490476967 lock-xattr-block-before-calculating-checksum +touch -d @1490477584 series +touch -d @1490477611 fix-spelling-nits +touch -d @1490569639 status +touch -d @1490569710 timestamps -- 2.11.4.GIT