Skip to contentSkip to conversation

reiserfs: fix handling of -EOPNOTSUPP in reiserfs_for_each_xattr

PATCH In review [email protected] 2 participants 2 messages Jan 15, 2020 – Jan 16, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiserfs: fix handling of -EOPNOTSUPP in reiserfs_for_each_xattr

From: Jeff Mahoney <[email protected]>

Commit 60e4cf67a58 (reiserfs: fix extended attributes on the root directory) introduced a regression open_xa_root started returning -EOPNOTSUPP but it was not handled properly in reiserfs_for_each_xattr.

When the reiserfs module is built without CONFIG_REISERFS_FS_XATTR, deleting an inode would result in a warning and chowning an inode would also result in a warning and then fail to complete.

With CONFIG_REISERFS_FS_XATTR enabled, the xattr root would always be present for read-write operations.

This commit handles -EOPNOSUPP in the same way -ENODATA is handled.

Fixes 60e4cf67a58 (reiserfs: fix extended attributes on the root directory)
---
 fs/reiserfs/xattr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/reiserfs/xattr.c +6 -2
index 06497965f0a0..d843c4789ced 100644
@@ -319,8 +319,12 @@ static int reiserfs_for_each_xattr(struct inode *inode,
 out_dir:
 	dput(dir);
 out:
-	/* -ENODATA isn't an error */
-	if (err == -ENODATA)
+	/*
+	 * -ENODATA: this object doesn't have any xattrs
+	 * -EOPNOTSUPP: this file system doesn't have xattrs enabled on disk.
+	 * Neither are errors
+	 */
+	if (err == -ENODATA || err == -EOPNOTSUPP)
 		err = 0;
 	return err;
 }
Signature · 1 line
2.16.4
#1 lore raw
Quoted 10 lines · On Wed 15-01-20 13:00:59, [email protected] wrote:

From: Jeff Mahoney <[email protected]>

Commit 60e4cf67a58 (reiserfs: fix extended attributes on the root directory) introduced a regression open_xa_root started returning -EOPNOTSUPP but it was not handled properly in reiserfs_for_each_xattr.

When the reiserfs module is built without CONFIG_REISERFS_FS_XATTR, deleting an inode would result in a warning and chowning an inode would also result in a warning and then fail to complete.

Quoted 8 lines

With CONFIG_REISERFS_FS_XATTR enabled, the xattr root would always be present for read-write operations.

This commit handles -EOPNOSUPP in the same way -ENODATA is handled.

Fixes 60e4cf67a58 (reiserfs: fix extended attributes on the root directory)

Thanks Jeff! I've queued the patch to my tree and will push it to Linus next week.

Honza

Quoted 26 lines
---
 fs/reiserfs/xattr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/reiserfs/xattr.c +6 -2
index 06497965f0a0..d843c4789ced 100644
@@ -319,8 +319,12 @@ static int reiserfs_for_each_xattr(struct inode *inode,
 out_dir:
 	dput(dir);
 out:
-	/* -ENODATA isn't an error */
-	if (err == -ENODATA)
+	/*
+	 * -ENODATA: this object doesn't have any xattrs
+	 * -EOPNOTSUPP: this file system doesn't have xattrs enabled on disk.
+	 * Neither are errors
+	 */
+	if (err == -ENODATA || err == -EOPNOTSUPP)
 		err = 0;
 	return err;
 }
Signature · 1 line
2.16.4
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR