Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

reiserfs: fix handling of -EOPNOTSUPP in reiserfs_for_each_xattr

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: 60e4cf67a582 ("reiserfs: fix extended attributes on the root directory")
CC: stable@vger.kernel.org # Commit 60e4cf67a58 was picked up by stable
Link: https://lore.kernel.org/r/20200115180059.6935-1-jeffm@suse.com
Reported-by: Michael Brunnbauer <brunni@netestate.de>
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

Jeff Mahoney and committed by
Jan Kara
394440d4 c79f46a2

+6 -2
+6 -2
fs/reiserfs/xattr.c
··· 319 319 out_dir: 320 320 dput(dir); 321 321 out: 322 - /* -ENODATA isn't an error */ 323 - if (err == -ENODATA) 322 + /* 323 + * -ENODATA: this object doesn't have any xattrs 324 + * -EOPNOTSUPP: this file system doesn't have xattrs enabled on disk. 325 + * Neither are errors 326 + */ 327 + if (err == -ENODATA || err == -EOPNOTSUPP) 324 328 err = 0; 325 329 return err; 326 330 }