ext2: Set superblock revision when enabling xattr feature

This change “ext2: Set superblock revision when enabling xattr feature” in Linux kernel is authored by Jan Kara <jack [at] suse.cz> on Tue Jan 22 12:35:36 2019 +0100.

ext2: Set superblock revision when enabling xattr feature

When setting the first xattr, we automatically enable
EXT2_FEATURE_COMPAT_EXT_ATTR. However we forget to call
ext2_update_dynamic_rev() so in theory if the filesystem was created as
ancient one without features support, this could be missed. The
consequences are minor anyway - since the feature is compat one, only
old e2fsck which does not understand xattrs could do something bad.

Reported-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Jan Kara <jack@suse.cz>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit 032cdc3.

There is one line of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/ext2/xattr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 4f30876..1e33e0a 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -342,6 +342,7 @@ static void ext2_xattr_update_super_block(struct super_block *sb)
 		return;
 
 	spin_lock(&EXT2_SB(sb)->s_lock);
+	ext2_update_dynamic_rev(sb);
 	EXT2_SET_COMPAT_FEATURE(sb, EXT2_FEATURE_COMPAT_EXT_ATTR);
 	spin_unlock(&EXT2_SB(sb)->s_lock);
 	mark_buffer_dirty(EXT2_SB(sb)->s_sbh);

The commit for this change in Linux stable tree is 032cdc3 (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *