Skip to content

Commit d979f3b

Browse files
committed
Add protocol specific operation for CIFS xattrs
Changeset 666753c added protocol operations for get/setxattr to avoid calling cifs operations on smb2/smb3 mounts for xattr operations and this changeset adds the calls to cifs specific protocol operations for xattrs (in order to reenable cifs support for xattrs which was temporarily disabled by the previous changeset. We do not have SMB2/SMB3 worker function for setting xattrs yet so this only enables it for cifs. CCing stable since without these two small changsets (its small coreq 666753c is also needed) calling getfattr/setfattr on smb2/smb3 mounts causes problems. Signed-off-by: Steve French <[email protected]> Reviewed-by: Shirish Pargaonkar <[email protected]> CC: Stable <[email protected]>
1 parent 9343224 commit d979f3b

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

fs/cifs/inode.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,15 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
527527
return PTR_ERR(tlink);
528528
tcon = tlink_tcon(tlink);
529529

530-
rc = CIFSSMBQAllEAs(xid, tcon, path, "SETFILEBITS",
531-
ea_value, 4 /* size of buf */, cifs_sb->local_nls,
532-
cifs_sb->mnt_cifs_flags &
533-
CIFS_MOUNT_MAP_SPECIAL_CHR);
530+
if (tcon->ses->server->ops->query_all_EAs == NULL) {
531+
cifs_put_tlink(tlink);
532+
return -EOPNOTSUPP;
533+
}
534+
535+
rc = tcon->ses->server->ops->query_all_EAs(xid, tcon, path,
536+
"SETFILEBITS", ea_value, 4 /* size of buf */,
537+
cifs_sb->local_nls,
538+
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
534539
cifs_put_tlink(tlink);
535540
if (rc < 0)
536541
return (int)rc;

fs/cifs/smb1ops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,10 @@ struct smb_version_operations smb1_operations = {
10671067
.query_mf_symlink = cifs_query_mf_symlink,
10681068
.create_mf_symlink = cifs_create_mf_symlink,
10691069
.is_read_op = cifs_is_read_op,
1070+
#ifdef CONFIG_CIFS_XATTR
1071+
.query_all_EAs = CIFSSMBQAllEAs,
1072+
.set_EA = CIFSSMBSetEA,
1073+
#endif /* CIFS_XATTR */
10701074
};
10711075

10721076
struct smb_version_values smb1_values = {

0 commit comments

Comments
 (0)