diff mbox series

[2/5] fs/ntfs3: Refactor ntfs_get_acl_ex for better readability

Message ID 994cb658-d2f8-a797-e947-35ac0a203ea2@paragon-software.com (mailing list archive)
State New, archived
Headers show
Series Refactor locking in inode_operations | expand

Commit Message

Konstantin Komarov Sept. 22, 2021, 4:18 p.m. UTC
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
 fs/ntfs3/xattr.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Kari Argillander Sept. 22, 2021, 5:47 p.m. UTC | #1
On Wed, Sep 22, 2021 at 07:18:18PM +0300, Konstantin Komarov wrote:

There should almoust always still be commit message. Even "small"
change. You have now see that people send you patch which change
just one line, but it can still contain many lines commit message.

> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
> ---
>  fs/ntfs3/xattr.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
> index 5c7c5c7a5ec1..3795943efc8e 100644
> --- a/fs/ntfs3/xattr.c
> +++ b/fs/ntfs3/xattr.c
> @@ -518,12 +518,15 @@ static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns,
>  	/* Translate extended attribute to acl. */
>  	if (err >= 0) {

If err was ENODATA ...

>  		acl = posix_acl_from_xattr(mnt_userns, buf, err);
> -		if (!IS_ERR(acl))
> -			set_cached_acl(inode, type, acl);
> +	} else if (err == -ENODATA) {
> +		acl = NULL;
>  	} else {
> -		acl = err == -ENODATA ? NULL : ERR_PTR(err);

Before we get this and we did not call set_cached_acl().

> +		acl = ERR_PTR(err);
>  	}
>  
> +	if (!IS_ERR(acl))

But now we call it with new logic. If this is correct then you change
behavier little bit. I let you talk before I look more into this.

> +		set_cached_acl(inode, type, acl);
> +
>  	__putname(buf);
>  
>  	return acl;
> -- 
> 2.33.0
> 
>
diff mbox series

Patch

diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index 5c7c5c7a5ec1..3795943efc8e 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -518,12 +518,15 @@  static struct posix_acl *ntfs_get_acl_ex(struct user_namespace *mnt_userns,
 	/* Translate extended attribute to acl. */
 	if (err >= 0) {
 		acl = posix_acl_from_xattr(mnt_userns, buf, err);
-		if (!IS_ERR(acl))
-			set_cached_acl(inode, type, acl);
+	} else if (err == -ENODATA) {
+		acl = NULL;
 	} else {
-		acl = err == -ENODATA ? NULL : ERR_PTR(err);
+		acl = ERR_PTR(err);
 	}
 
+	if (!IS_ERR(acl))
+		set_cached_acl(inode, type, acl);
+
 	__putname(buf);
 
 	return acl;