[PATCH] btrfs: return original error code when failing from option parsing

2018-05-09 Thread Chengguang Xu
It's no good to overwrite -ENOMEM using -EINVAL when failing from mount option parsing, so just return original error code. Signed-off-by: Chengguang Xu <cgxu...@gmx.com> --- fs/btrfs/super.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 0

[PATCH v2] btrfs: return original error code when failing from option parsing

2018-05-09 Thread Chengguang Xu
It's no good to overwrite -ENOMEM using -EINVAL when failing from mount option parsing, so just return original error code. Signed-off-by: Chengguang Xu <cgxu...@gmx.com> Reviewed-by: David Sterba <dste...@suse.com> Reviewed-by: Qu Wenruo <w...@suse.com> --- v1->v2: - Remo

[PATCH v3] btrfs: code cleanups for btrfs_get_acl()

2018-06-26 Thread Chengguang Xu
-by: Chengguang Xu --- v3: - Fix some other bad practices. - Add more information to commit log. v2: - Avoid errno overriding instead of print error message in error case. - Change commit log for better understanding. fs/btrfs/acl.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff

[PATCH v2] btrfs: remove -ERANGE check and avoid errno overriding in btrfs_get_acl()

2018-06-23 Thread Chengguang Xu
Remove -ERANGE error check because there is no chance to get into this condition and meanwhile avoid overriding errno to -EIO in btrfs_get_acl(). Signed-off-by: Chengguang Xu --- v2: - Avoid errno overriding instead of print error message in error case. - Change commit log for better

[PATCH v4 1/5] btrfs: return error instead of crash when detecting unexpected type in btrfs_get_acl()

2018-06-26 Thread Chengguang Xu
The caller of btrfs_get_acl() checks error condition so there is no impact from this change. In practice there is no chance to get into default case of switch statement because VFS has already checked the type. Signed-off-by: Chengguang Xu Reviewed-by: Nikolay Borisov --- v4: - Split patch

[PATCH v4 2/5] btrfs: replace empty string with NULL when getting attribute length in btrfs_get_acl()

2018-06-26 Thread Chengguang Xu
In btrfs_get_acl() the first call of btr_getxattr() is for getting the length of attribute, the value buffer is never used in this case. So it's better to replace empty string with NULL. Signed-off-by: Chengguang Xu Reviewed-by: Nikolay Borisov --- v4: - Split patch to series. v3: - Fix some

[PATCH v4 3/5] btrfs: remove unnecessary -ERANGE check in btrfs_get_acl()

2018-06-26 Thread Chengguang Xu
-by: Chengguang Xu Reviewed-by: Nikolay Borisov --- v4: - Split patch to series. v3: - Fix some toher bad practices. - Add more information to commit log. v2: - Avoid errno overriding instead of print error message in error case. - Chagne commit log for better understanding. fs/btrfs/acl.c | 2

[PATCH v4 5/5] btrfs: remove unnecessary bracket in btrfs_get_acl()

2018-06-26 Thread Chengguang Xu
It's only coding style fix not functinal change. When if/else has only one statement then the bracket is not needed. Signed-off-by: Chengguang Xu Reviewed-by: Nikolay Borisov --- v4: - Split patch to series. v3: - Fix some toher bad practices. - Add more information to commit log. v2: - Avoid

[PATCH v4 0/5] code cleanups for btrfs_get_acl()

2018-06-26 Thread Chengguang Xu
This patch set does code cleanups for btrfs_get_acl(). Chengguang Xu (5): btrfs: return error instead of crash when detecting unexpected type in btrfs_get_acl() btrfs: replace empty string with NULL when getting attribute length in btrfs_get_acl() btrfs: remove unnecessary -ERANGE

[PATCH v4 4/5] btrfs: avoid error code overriding in btrfs_get_acl()

2018-06-26 Thread Chengguang Xu
It's no good to override error code when failing from btrfs_getxattr() in btrfs_get_acl() because it will hide real root cause. Signed-off-by: Chengguang Xu Reviewed-by: Nikolay Borisov --- v4: - Split patch to series. v3: - Fix some toher bad practices. - Add more information to commit log

[PATCH] btrfs: treat -ERANGE as an error case in btrfs_get_acl()

2018-06-21 Thread Chengguang Xu
Currently, when encoutering -ERANGE in btrfs_get_acl(), just set acl to NULL so that we cannot get proper acl information but the operation looks successful. This patch treats -ERANGE as an error case and meanwhile print real errno before translating errno to -EIO. Signed-off-by: Chengguang Xu