Bug 202007 - CIFS: return successfully if remove non-existent EA
Summary: CIFS: return successfully if remove non-existent EA
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: CIFS (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_cifs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-17 05:52 UTC by Xiaoli Feng
Modified: 2019-03-11 02:22 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.20.0-rc6+
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Xiaoli Feng 2018-12-17 05:52:24 UTC
When remove a non-existent EA, the cifs return successfully.

# mount //localhost/cifs cifs -o user=root,password=redhat
# touch cifs/file
# setfattr -x user.test cifs/file
# echo $?
0

It should be like this.

# touch file
# setfattr -x user.test file
setfattr: file: No such attribute
# echo $?
1
Comment 1 Ronnie Sahlberg 2019-02-07 04:56:37 UTC
The problem is that we do not check if the attribute exists before we try to delete it.

If we delete an attribute using SMB2 SET_INFO the server will return STATUS_SUCCESS even if the attribute did not exist.

What we need to do here is to first check if the attribute exists in cifs.ko before we decide if we should try to delete it.
Comment 2 Ronnie Sahlberg 2019-03-11 02:22:01 UTC
Fixed in commit 2109464184919f81efd593b4008291448c522815
Author: Ronnie Sahlberg <lsahlber@redhat.com>
Date:   Thu Feb 7 15:48:44 2019 +1000

    cifs: return -ENODATA when deleting an xattr that does not exist
    
    BUGZILLA: https://bugzilla.kernel.org/show_bug.cgi?id=202007
    
    When deleting an xattr/EA:
    SMB2/3 servers will return SUCCESS when clients delete non-existing EAs.
    This means that we need to first QUERY the server and check if the EA
    exists or not so that we can return -ENODATA correctly when this happens.
    
    Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>

Note You need to log in before you can comment on or make changes to this bug.