ext4: error should be cleared if ea_inode isn't added to the cache

Message ID 1499831813-13218-1-git-send-email-emoly.liu@intel.com
State Awaiting Upstream
Headers show

Commit Message

Emoly Liu July 12, 2017, 3:56 a.m.
For Lustre, if ea_inode fails in hash validation but passes parent
inode and generation checks, it won't be added to the cache as well
as the error "-EFSCORRUPTED" should be cleared, otherwise it will
cause "Structure needs cleaning" when running getfattr command.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9723
---
 fs/ext4/xattr.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Tahsin Erdogan July 12, 2017, 4:37 a.m. | #1
Reviewed-by: tahsin@google.com

On Tue, Jul 11, 2017 at 8:56 PM, Emoly Liu <emoly.liu@intel.com> wrote:
> For Lustre, if ea_inode fails in hash validation but passes parent
> inode and generation checks, it won't be added to the cache as well
> as the error "-EFSCORRUPTED" should be cleared, otherwise it will
> cause "Structure needs cleaning" when running getfattr command.
>
> Signed-off-by: Emoly Liu <emoly.liu@intel.com>
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9723
> ---
>  fs/ext4/xattr.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index cff4f41..de217a0 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -451,6 +451,7 @@ static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino,
>                 }
>                 /* Do not add ea_inode to the cache. */
>                 ea_inode_cache = NULL;
> +               err = 0;
>         } else if (err)
>                 goto out;
>
> --
> 1.8.3.1
>
Andreas Dilger July 13, 2017, 5:17 a.m. | #2
On Jul 11, 2017, at 9:37 PM, Tahsin Erdogan <tahsin@google.com> wrote:
> 
> Reviewed-by: tahsin@google.com
> 
> On Tue, Jul 11, 2017 at 8:56 PM, Emoly Liu <emoly.liu@intel.com> wrote:
>> For Lustre, if ea_inode fails in hash validation but passes parent
>> inode and generation checks, it won't be added to the cache as well
>> as the error "-EFSCORRUPTED" should be cleared, otherwise it will
>> cause "Structure needs cleaning" when running getfattr command.
>> 
>> Signed-off-by: Emoly Liu <emoly.liu@intel.com>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

This could also include:

  Fixes: dec214d00e0d78a08b947d7dccdfdb84407a9f4d

unless this fix is merged into the original patch.

>> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9723
>> ---
>> fs/ext4/xattr.c | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
>> index cff4f41..de217a0 100644
>> --- a/fs/ext4/xattr.c
>> +++ b/fs/ext4/xattr.c
>> @@ -451,6 +451,7 @@ static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino,
>>                }
>>                /* Do not add ea_inode to the cache. */
>>                ea_inode_cache = NULL;
>> +               err = 0;
>>        } else if (err)
>>                goto out;




Cheers, Andreas

Patch

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index cff4f41..de217a0 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -451,6 +451,7 @@  static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino,
 		}
 		/* Do not add ea_inode to the cache. */
 		ea_inode_cache = NULL;
+		err = 0;
 	} else if (err)
 		goto out;