ksmbd: don't remove dos attribute xattr on O_TRUNC open
Subsystems (2)
Namjae Jeon
maintainerPATCH 1/1 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.
--- fs/ksmbd/smb2pdu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/ksmbd/smb2pdu.c +1 -3
@@ -2330,9 +2330,7 @@ static int smb2_remove_smb_xattrs(struct path *path) name += strlen(name) + 1) {ksmbd_debug (SMB ,"%s, len %zd\n" , name,strlen (name)); -if (strncmp (name,XATTR_USER_PREFIX ,XATTR_USER_PREFIX_LEN ) && -strncmp (&name[XATTR_USER_PREFIX_LEN ],DOS_ATTRIBUTE_PREFIX , -DOS_ATTRIBUTE_PREFIX_LEN ) && +if (!strncmp (name,XATTR_USER_PREFIX ,XATTR_USER_PREFIX_LEN ) &&strncmp (&name[XATTR_USER_PREFIX_LEN ],STREAM_PREFIX ,STREAM_PREFIX_LEN ))continue ;
Signature · 1 line
2.25.1
2022년 8월 12일 (금) 오전 11:56, Namjae Jeon <[email protected]>님이 작성:
Quoted 17 lines
When smb client open file in ksmbd share with
O_TRUNC, dos attribute xattr is removed as well as data in file. This cause theFSCTL_SET_SPARSErequest from the client fails because ksmbd can't update the dos attribute after settingATTR_SPARSE_FILE. And this patch fix xfstests generic/469 test also.Signed-off-by Namjae Jeon <[email protected]>--- fs/ksmbd/smb2pdu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/ksmbd/smb2pdu.c +0
-0
fs/ksmbd/smb2pdu.c static int smb2_remove_smb_xattrs(struct path *path) · line 2336
Quoted 10 lines
fs/ksmbd/smb2pdu.c +1
-3@@ -2330,9 +2330,7 @@ static int smb2_remove_smb_xattrs(struct path *path) name += strlen(name) + 1) {ksmbd_debug (SMB ,"%s, len %zd\n" , name,strlen (name)); -if (strncmp (name,XATTR_USER_PREFIX ,XATTR_USER_PREFIX_LEN ) && -strncmp (&name[XATTR_USER_PREFIX_LEN ],DOS_ATTRIBUTE_PREFIX , -DOS_ATTRIBUTE_PREFIX_LEN ) && +if (!strncmp (name,XATTR_USER_PREFIX ,XATTR_USER_PREFIX_LEN ) &&strncmp (&name[XATTR_USER_PREFIX_LEN ],STREAM_PREFIX ,STREAM_PREFIX_LEN ))continue ;
We don't need to exclude security.*, trusted.*, system.* from deletion?
Quoted 3 lines
--
2.25.1
Signature · 2 lines
Thanks, Hyunchul
Namjae Jeon
maintainer2022-08-14 11:19 GMT+09:00, Hyunchul Lee <[email protected]>:
Quoted 23 lines
2022년 8월 12일 (금) 오전 11:56, Namjae Jeon <[email protected]>님이 작성:
Quoted 22 lines
When smb client open file in ksmbd share with
O_TRUNC, dos attribute xattr is removed as well as data in file. This cause theFSCTL_SET_SPARSErequest from the client fails because ksmbd can't update the dos attribute
after settingATTR_SPARSE_FILE. And this patch fix xfstests generic/469 test also.Signed-off-by Namjae Jeon <[email protected]>--- fs/ksmbd/smb2pdu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)fs/ksmbd/smb2pdu.c +0
-0@@ -2330,9 +2330,7 @@ static int smb2_remove_smb_xattrs(struct path *path) name += strlen(name) + 1) {ksmbd_debug (SMB ,"%s, len %zd\n" , name,strlen (name));
Quoted 13 lines
Quoted 11 lines
fs/ksmbd/smb2pdu.c +0
-1- if (strncmp(name, XATTR_USER_PREFIX,
XATTR_USER_PREFIX_LEN) &&
- strncmp(&name[XATTR_USER_PREFIX_LEN],DOS_ATTRIBUTE_PREFIX,fs/ksmbd/smb2pdu.c +1
-1- DOS_ATTRIBUTE_PREFIX_LEN) && + if (!strncmp(name, XATTR_USER_PREFIX,
XATTR_USER_PREFIX_LEN) &&
strncmp(&name[XATTR_USER_PREFIX_LEN],STREAM_PREFIX,STREAM_PREFIX_LEN))continue;We don't need to exclude security.*, trusted.*, system.* from deletion?
Right, will fix it on v2.
Thanks.
Quoted 10 lines
Quoted 4 lines
--
2.25.1--
Thanks,
Hyunchul