Commit 17661ecf authored by Namjae Jeon's avatar Namjae Jeon Committed by Steve French

ksmbd: don't remove dos attribute xattr on O_TRUNC open

When smb client open file in ksmbd share with O_TRUNC, dos attribute
xattr is removed as well as data in file. This cause the FSCTL_SET_SPARSE
request from the client fails because ksmbd can't update the dos attribute
after setting ATTR_SPARSE_FILE. And this patch fix xfstests generic/469
test also.
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Reviewed-by: default avatarHyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent c90b31ea
...@@ -2330,15 +2330,15 @@ static int smb2_remove_smb_xattrs(struct path *path) ...@@ -2330,15 +2330,15 @@ static int smb2_remove_smb_xattrs(struct path *path)
name += strlen(name) + 1) { name += strlen(name) + 1) {
ksmbd_debug(SMB, "%s, len %zd\n", name, strlen(name)); ksmbd_debug(SMB, "%s, len %zd\n", name, strlen(name));
if (strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) &&
strncmp(&name[XATTR_USER_PREFIX_LEN], DOS_ATTRIBUTE_PREFIX, !strncmp(&name[XATTR_USER_PREFIX_LEN], STREAM_PREFIX,
DOS_ATTRIBUTE_PREFIX_LEN) && STREAM_PREFIX_LEN)) {
strncmp(&name[XATTR_USER_PREFIX_LEN], STREAM_PREFIX, STREAM_PREFIX_LEN)) err = ksmbd_vfs_remove_xattr(user_ns, path->dentry,
continue; name);
if (err)
err = ksmbd_vfs_remove_xattr(user_ns, path->dentry, name); ksmbd_debug(SMB, "remove xattr failed : %s\n",
if (err) name);
ksmbd_debug(SMB, "remove xattr failed : %s\n", name); }
} }
out: out:
kvfree(xattr_list); kvfree(xattr_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment