Message ID | 20190207054844.19147-1-lsahlber@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | cifs: return -ENODATA when deleting an xattr that does not exist | expand |
merged into cifs-2.6.git for-next On Wed, Feb 6, 2019 at 11:48 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote: > > 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> > --- > fs/cifs/smb2ops.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c > index 1995bbe90845..fe20358fb5e4 100644 > --- a/fs/cifs/smb2ops.c > +++ b/fs/cifs/smb2ops.c > @@ -986,6 +986,16 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, > resp_buftype[0] = resp_buftype[1] = resp_buftype[2] = CIFS_NO_BUFFER; > memset(rsp_iov, 0, sizeof(rsp_iov)); > > + if (ses->server->ops->query_all_EAs) { > + if (!ea_value) { > + rc = ses->server->ops->query_all_EAs(xid, tcon, path, > + ea_name, NULL, 0, > + cifs_sb); > + if (rc == -ENODATA) > + goto sea_exit; > + } > + } > + > /* Open */ > memset(&open_iov, 0, sizeof(open_iov)); > rqst[0].rq_iov = open_iov; > -- > 2.13.6 >
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 1995bbe90845..fe20358fb5e4 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -986,6 +986,16 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, resp_buftype[0] = resp_buftype[1] = resp_buftype[2] = CIFS_NO_BUFFER; memset(rsp_iov, 0, sizeof(rsp_iov)); + if (ses->server->ops->query_all_EAs) { + if (!ea_value) { + rc = ses->server->ops->query_all_EAs(xid, tcon, path, + ea_name, NULL, 0, + cifs_sb); + if (rc == -ENODATA) + goto sea_exit; + } + } + /* Open */ memset(&open_iov, 0, sizeof(open_iov)); rqst[0].rq_iov = open_iov;
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> --- fs/cifs/smb2ops.c | 10 ++++++++++ 1 file changed, 10 insertions(+)