Lines Matching +full:set +full:- +full:aces
1 // SPDX-License-Identifier: GPL-2.0-or-later
11 #include <linux/backing-dev.h>
43 if (!test_share_config_flag(work->tcon->share_conf, in ksmbd_vfs_inherit_owner()
51 * ksmbd_vfs_lock_parent() - lock parent dentry if it is stable
55 * Returns: %0 on success, %-ENOENT if the parent dentry is not stable
60 if (child->d_parent != parent) { in ksmbd_vfs_lock_parent()
62 return -ENOENT; in ksmbd_vfs_lock_parent()
75 struct path *root_share_path = &share_conf->vfs_path; in ksmbd_vfs_path_lookup_locked()
80 pathname = share_conf->path; in ksmbd_vfs_path_lookup_locked()
101 return -ENOENT; in ksmbd_vfs_path_lookup_locked()
104 err = mnt_want_write(parent_path->mnt); in ksmbd_vfs_path_lookup_locked()
108 return -ENOENT; in ksmbd_vfs_path_lookup_locked()
111 inode_lock_nested(parent_path->dentry->d_inode, I_MUTEX_PARENT); in ksmbd_vfs_path_lookup_locked()
112 d = lookup_one_qstr_excl(&last, parent_path->dentry, 0); in ksmbd_vfs_path_lookup_locked()
121 path->dentry = d; in ksmbd_vfs_path_lookup_locked()
122 path->mnt = mntget(parent_path->mnt); in ksmbd_vfs_path_lookup_locked()
136 inode_unlock(d_inode(parent_path->dentry)); in ksmbd_vfs_path_lookup_locked()
137 mnt_drop_write(parent_path->mnt); in ksmbd_vfs_path_lookup_locked()
140 return -ENOENT; in ksmbd_vfs_path_lookup_locked()
160 if (!inode_permission(idmap, d_inode(dentry->d_parent), MAY_EXEC | MAY_WRITE)) in ksmbd_vfs_query_maximal_access()
165 * ksmbd_vfs_create() - vfs helper for smb create file
182 if (err != -ENOENT) in ksmbd_vfs_create()
203 * ksmbd_vfs_mkdir() - vfs helper for smb create directory
222 if (err != -EEXIST) in ksmbd_vfs_mkdir()
234 d = lookup_one(idmap, dentry->d_name.name, dentry->d_parent, in ksmbd_vfs_mkdir()
235 dentry->d_name.len); in ksmbd_vfs_mkdir()
242 err = -ENOENT; in ksmbd_vfs_mkdir()
262 ssize_t value_len = -ENOENT, xattr_list_len; in ksmbd_vfs_getcasexattr()
268 for (name = xattr_list; name - xattr_list < xattr_list_len; in ksmbd_vfs_getcasexattr()
297 v_len = ksmbd_vfs_getcasexattr(file_mnt_idmap(fp->filp), in ksmbd_vfs_stream_read()
298 fp->filp->f_path.dentry, in ksmbd_vfs_stream_read()
299 fp->stream.name, in ksmbd_vfs_stream_read()
300 fp->stream.size, in ksmbd_vfs_stream_read()
306 count = -EINVAL; in ksmbd_vfs_stream_read()
310 if (v_len - *pos < count) in ksmbd_vfs_stream_read()
311 count = v_len - *pos; in ksmbd_vfs_stream_read()
321 * check_lock_range() - vfs helper for smb byte range file locking
336 if (!ctx || list_empty_careful(&ctx->flc_posix)) in check_lock_range()
339 spin_lock(&ctx->flc_lock); in check_lock_range()
340 for_each_file_lock(flock, &ctx->flc_posix) { in check_lock_range()
342 if (flock->fl_end >= start && end >= flock->fl_start) { in check_lock_range()
351 if (flock->c.flc_file != filp) { in check_lock_range()
360 spin_unlock(&ctx->flc_lock); in check_lock_range()
365 * ksmbd_vfs_read() - vfs helper for smb file read
377 struct file *filp = fp->filp; in ksmbd_vfs_read()
381 if (S_ISDIR(inode->i_mode)) in ksmbd_vfs_read()
382 return -EISDIR; in ksmbd_vfs_read()
387 if (work->conn->connection_type) { in ksmbd_vfs_read()
388 if (!(fp->daccess & (FILE_READ_DATA_LE | FILE_EXECUTE_LE))) { in ksmbd_vfs_read()
389 pr_err("no right to read(%pD)\n", fp->filp); in ksmbd_vfs_read()
390 return -EACCES; in ksmbd_vfs_read()
397 if (!work->tcon->posix_extensions) { in ksmbd_vfs_read()
400 ret = check_lock_range(filp, *pos, *pos + count - 1, READ); in ksmbd_vfs_read()
403 return -EAGAIN; in ksmbd_vfs_read()
413 filp->f_pos = *pos; in ksmbd_vfs_read()
421 struct mnt_idmap *idmap = file_mnt_idmap(fp->filp); in ksmbd_vfs_stream_write()
432 count = (*pos + count) - XATTR_SIZE_MAX; in ksmbd_vfs_stream_write()
436 fp->filp->f_path.dentry, in ksmbd_vfs_stream_write()
437 fp->stream.name, in ksmbd_vfs_stream_write()
438 fp->stream.size, in ksmbd_vfs_stream_write()
449 err = -ENOMEM; in ksmbd_vfs_stream_write()
462 &fp->filp->f_path, in ksmbd_vfs_stream_write()
463 fp->stream.name, in ksmbd_vfs_stream_write()
471 fp->filp->f_pos = *pos; in ksmbd_vfs_stream_write()
479 * ksmbd_vfs_write() - vfs helper for smb file write
498 if (work->conn->connection_type) { in ksmbd_vfs_write()
499 if (!(fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE))) { in ksmbd_vfs_write()
500 pr_err("no right to write(%pD)\n", fp->filp); in ksmbd_vfs_write()
501 err = -EACCES; in ksmbd_vfs_write()
506 filp = fp->filp; in ksmbd_vfs_write()
515 if (!work->tcon->posix_extensions) { in ksmbd_vfs_write()
516 err = check_lock_range(filp, *pos, *pos + count - 1, WRITE); in ksmbd_vfs_write()
519 err = -EAGAIN; in ksmbd_vfs_write()
525 fp->reserve_lease_break = true; in ksmbd_vfs_write()
536 filp->f_pos = *pos; in ksmbd_vfs_write()
543 fp->filp, err); in ksmbd_vfs_write()
551 * ksmbd_vfs_getattr() - vfs helper for smb getattr
567 * ksmbd_vfs_fsync() - vfs helper for smb fsync
582 return -ENOENT; in ksmbd_vfs_fsync()
584 err = vfs_fsync(fp->filp, 0); in ksmbd_vfs_fsync()
592 * ksmbd_vfs_remove_file() - vfs helper for smb rmdir or unlink
601 struct dentry *parent = path->dentry->d_parent; in ksmbd_vfs_remove_file()
605 return -ENOMEM; in ksmbd_vfs_remove_file()
607 if (!d_inode(path->dentry)->i_nlink) { in ksmbd_vfs_remove_file()
608 err = -ENOENT; in ksmbd_vfs_remove_file()
612 idmap = mnt_idmap(path->mnt); in ksmbd_vfs_remove_file()
613 if (S_ISDIR(d_inode(path->dentry)->i_mode)) { in ksmbd_vfs_remove_file()
614 err = vfs_rmdir(idmap, d_inode(parent), path->dentry); in ksmbd_vfs_remove_file()
615 if (err && err != -ENOTEMPTY) in ksmbd_vfs_remove_file()
618 err = vfs_unlink(idmap, d_inode(parent), path->dentry, NULL); in ksmbd_vfs_remove_file()
629 * ksmbd_vfs_link() - vfs helper for creating smb hardlink
644 return -ENOMEM; in ksmbd_vfs_link()
662 err = -EXDEV; in ksmbd_vfs_link()
687 struct dentry *old_child = old_path->dentry; in ksmbd_vfs_rename()
692 struct ksmbd_share_config *share_conf = work->tcon->share_conf; in ksmbd_vfs_rename()
698 return -ENOMEM; in ksmbd_vfs_rename()
709 &share_conf->vfs_path); in ksmbd_vfs_rename()
713 if (old_path->mnt != new_path.mnt) { in ksmbd_vfs_rename()
714 err = -EXDEV; in ksmbd_vfs_rename()
718 err = mnt_want_write(old_path->mnt); in ksmbd_vfs_rename()
728 old_parent = dget(old_child->d_parent); in ksmbd_vfs_rename()
730 err = -EINVAL; in ksmbd_vfs_rename()
734 parent_fp = ksmbd_lookup_fd_inode(old_child->d_parent); in ksmbd_vfs_rename()
736 if (parent_fp->daccess & FILE_DELETE_LE) { in ksmbd_vfs_rename()
738 err = -ESHARE; in ksmbd_vfs_rename()
753 err = -EACCES; in ksmbd_vfs_rename()
762 err = -EEXIST; in ksmbd_vfs_rename()
768 err = -EINVAL; in ksmbd_vfs_rename()
773 err = -ENOTEMPTY; in ksmbd_vfs_rename()
777 rd.old_mnt_idmap = mnt_idmap(old_path->mnt), in ksmbd_vfs_rename()
781 rd.new_dir = new_path.dentry->d_inode, in ksmbd_vfs_rename()
795 mnt_drop_write(old_path->mnt); in ksmbd_vfs_rename()
811 * ksmbd_vfs_truncate() - vfs helper for smb file truncate
824 filp = fp->filp; in ksmbd_vfs_truncate()
829 if (!work->tcon->posix_extensions) { in ksmbd_vfs_truncate()
832 if (size < inode->i_size) { in ksmbd_vfs_truncate()
834 inode->i_size - 1, WRITE); in ksmbd_vfs_truncate()
836 err = check_lock_range(filp, inode->i_size, in ksmbd_vfs_truncate()
837 size - 1, WRITE); in ksmbd_vfs_truncate()
842 return -EAGAIN; in ksmbd_vfs_truncate()
846 err = vfs_truncate(&filp->f_path, size); in ksmbd_vfs_truncate()
853 * ksmbd_vfs_listxattr() - vfs helper for smb list extended attributes
870 return -ENOMEM; in ksmbd_vfs_listxattr()
890 * ksmbd_vfs_getxattr() - vfs helper for smb get extended attributes value
912 return -ENOMEM; in ksmbd_vfs_getxattr()
924 * ksmbd_vfs_setxattr() - vfs helper for smb set extended attributes value
926 * @path: path of dentry to set XATTR at
928 * @attr_value: xattr value to set
943 err = mnt_want_write(path->mnt); in ksmbd_vfs_setxattr()
949 path->dentry, in ksmbd_vfs_setxattr()
957 mnt_drop_write(path->mnt); in ksmbd_vfs_setxattr()
962 * ksmbd_vfs_set_fadvise() - convert smb IO caching options to linux options
970 mapping = filp->f_mapping; in ksmbd_vfs_set_fadvise()
976 filp->f_flags |= O_SYNC; in ksmbd_vfs_set_fadvise()
978 filp->f_ra.ra_pages = inode_to_bdi(mapping->host)->ra_pages * 2; in ksmbd_vfs_set_fadvise()
979 spin_lock(&filp->f_lock); in ksmbd_vfs_set_fadvise()
980 filp->f_mode &= ~FMODE_RANDOM; in ksmbd_vfs_set_fadvise()
981 spin_unlock(&filp->f_lock); in ksmbd_vfs_set_fadvise()
983 spin_lock(&filp->f_lock); in ksmbd_vfs_set_fadvise()
984 filp->f_mode |= FMODE_RANDOM; in ksmbd_vfs_set_fadvise()
985 spin_unlock(&filp->f_lock); in ksmbd_vfs_set_fadvise()
993 if (fp->f_ci->m_fattr & FILE_ATTRIBUTE_SPARSE_FILE_LE) in ksmbd_vfs_zero_data()
994 return vfs_fallocate(fp->filp, in ksmbd_vfs_zero_data()
998 return vfs_fallocate(fp->filp, in ksmbd_vfs_zero_data()
1007 struct file *f = fp->filp; in ksmbd_vfs_fqar_lseek()
1008 struct inode *inode = file_inode(fp->filp); in ksmbd_vfs_fqar_lseek()
1009 loff_t maxbytes = (u64)inode->i_sb->s_maxbytes, end; in ksmbd_vfs_fqar_lseek()
1014 return -EFBIG; in ksmbd_vfs_fqar_lseek()
1022 if (length > maxbytes || (maxbytes - length) < start) in ksmbd_vfs_fqar_lseek()
1023 length = maxbytes - start; in ksmbd_vfs_fqar_lseek()
1025 if (start + length > inode->i_size) in ksmbd_vfs_fqar_lseek()
1026 length = inode->i_size - start; in ksmbd_vfs_fqar_lseek()
1033 if (extent_start != -ENXIO) in ksmbd_vfs_fqar_lseek()
1043 if (extent_end != -ENXIO) in ksmbd_vfs_fqar_lseek()
1052 cpu_to_le64(min(extent_end, end) - extent_start); in ksmbd_vfs_fqar_lseek()
1067 err = mnt_want_write(path->mnt); in ksmbd_vfs_remove_xattr()
1072 err = vfs_removexattr(idmap, path->dentry, attr_name); in ksmbd_vfs_remove_xattr()
1075 mnt_drop_write(path->mnt); in ksmbd_vfs_remove_xattr()
1083 struct dentry *dir, *dentry = filp->f_path.dentry; in ksmbd_vfs_unlink()
1086 err = mnt_want_write(filp->f_path.mnt); in ksmbd_vfs_unlink()
1096 if (S_ISDIR(d_inode(dentry)->i_mode)) in ksmbd_vfs_unlink()
1107 mnt_drop_write(filp->f_path.mnt); in ksmbd_vfs_unlink()
1119 buf->dirent_count++; in __dir_empty()
1121 return !buf->dirent_count; in __dir_empty()
1125 * ksmbd_vfs_empty_dir() - check for empty directory
1140 err = iterate_dir(fp->filp, &readdir_data.ctx); in ksmbd_vfs_empty_dir()
1142 err = -ENOTEMPTY; in ksmbd_vfs_empty_dir()
1153 int cmp = -EINVAL; in __caseless_lookup()
1157 if (buf->used != namlen) in __caseless_lookup()
1159 if (IS_ENABLED(CONFIG_UNICODE) && buf->um) { in __caseless_lookup()
1160 const struct qstr q_buf = {.name = buf->private, in __caseless_lookup()
1161 .len = buf->used}; in __caseless_lookup()
1165 cmp = utf8_strncasecmp(buf->um, &q_buf, &q_name); in __caseless_lookup()
1168 cmp = strncasecmp((char *)buf->private, name, namlen); in __caseless_lookup()
1170 memcpy((char *)buf->private, name, buf->used); in __caseless_lookup()
1171 buf->dirent_count = 1; in __caseless_lookup()
1178 * ksmbd_vfs_lookup_in_dir() - lookup a file in a directory
1212 * ksmbd_vfs_kern_path_locked() - lookup a file and get path info
1226 struct ksmbd_share_config *share_conf = work->tcon->share_conf; in ksmbd_vfs_kern_path_locked()
1242 *parent_path = share_conf->vfs_path; in ksmbd_vfs_kern_path_locked()
1245 while (d_can_lookup(parent_path->dentry)) { in ksmbd_vfs_kern_path_locked()
1246 char *filename = filepath + path_len - remain_len; in ksmbd_vfs_kern_path_locked()
1248 size_t filename_len = next - filename; in ksmbd_vfs_kern_path_locked()
1256 work->conn->um); in ksmbd_vfs_kern_path_locked()
1262 err = vfs_path_lookup(share_conf->vfs_path.dentry, in ksmbd_vfs_kern_path_locked()
1263 share_conf->vfs_path.mnt, in ksmbd_vfs_kern_path_locked()
1275 remain_len -= filename_len + 1; in ksmbd_vfs_kern_path_locked()
1278 err = -EINVAL; in ksmbd_vfs_kern_path_locked()
1285 err = mnt_want_write(parent_path->mnt); in ksmbd_vfs_kern_path_locked()
1292 err = ksmbd_vfs_lock_parent(parent_path->dentry, path->dentry); in ksmbd_vfs_kern_path_locked()
1303 inode_unlock(d_inode(parent_path->dentry)); in ksmbd_vfs_kern_path_unlock()
1304 mnt_drop_write(parent_path->mnt); in ksmbd_vfs_kern_path_unlock()
1317 abs_name = convert_to_unix_name(work->tcon->share_conf, name); in ksmbd_vfs_kern_path_create()
1319 return ERR_PTR(-ENOMEM); in ksmbd_vfs_kern_path_create()
1333 xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list); in ksmbd_vfs_remove_acl_xattrs()
1341 err = mnt_want_write(path->mnt); in ksmbd_vfs_remove_acl_xattrs()
1345 for (name = xattr_list; name - xattr_list < xattr_list_len; in ksmbd_vfs_remove_acl_xattrs()
1350 sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1) || in ksmbd_vfs_remove_acl_xattrs()
1352 sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1)) { in ksmbd_vfs_remove_acl_xattrs()
1353 err = vfs_remove_acl(idmap, path->dentry, name); in ksmbd_vfs_remove_acl_xattrs()
1359 mnt_drop_write(path->mnt); in ksmbd_vfs_remove_acl_xattrs()
1372 xattr_list_len = ksmbd_vfs_listxattr(path->dentry, &xattr_list); in ksmbd_vfs_remove_sd_xattrs()
1380 for (name = xattr_list; name - xattr_list < xattr_list_len; in ksmbd_vfs_remove_sd_xattrs()
1413 sizeof(struct xattr_acl_entry) * posix_acls->a_count, in ksmbd_vfs_make_xattr_posix_acl()
1418 smb_acl->count = posix_acls->a_count; in ksmbd_vfs_make_xattr_posix_acl()
1419 pa_entry = posix_acls->a_entries; in ksmbd_vfs_make_xattr_posix_acl()
1420 xa_entry = smb_acl->entries; in ksmbd_vfs_make_xattr_posix_acl()
1421 for (i = 0; i < posix_acls->a_count; i++, pa_entry++, xa_entry++) { in ksmbd_vfs_make_xattr_posix_acl()
1422 switch (pa_entry->e_tag) { in ksmbd_vfs_make_xattr_posix_acl()
1424 xa_entry->type = SMB_ACL_USER; in ksmbd_vfs_make_xattr_posix_acl()
1425 xa_entry->uid = posix_acl_uid_translate(idmap, pa_entry); in ksmbd_vfs_make_xattr_posix_acl()
1428 xa_entry->type = SMB_ACL_USER_OBJ; in ksmbd_vfs_make_xattr_posix_acl()
1431 xa_entry->type = SMB_ACL_GROUP; in ksmbd_vfs_make_xattr_posix_acl()
1432 xa_entry->gid = posix_acl_gid_translate(idmap, pa_entry); in ksmbd_vfs_make_xattr_posix_acl()
1435 xa_entry->type = SMB_ACL_GROUP_OBJ; in ksmbd_vfs_make_xattr_posix_acl()
1438 xa_entry->type = SMB_ACL_OTHER; in ksmbd_vfs_make_xattr_posix_acl()
1441 xa_entry->type = SMB_ACL_MASK; in ksmbd_vfs_make_xattr_posix_acl()
1444 pr_err("unknown type : 0x%x\n", pa_entry->e_tag); in ksmbd_vfs_make_xattr_posix_acl()
1448 if (pa_entry->e_perm & ACL_READ) in ksmbd_vfs_make_xattr_posix_acl()
1449 xa_entry->perm |= SMB_ACL_READ; in ksmbd_vfs_make_xattr_posix_acl()
1450 if (pa_entry->e_perm & ACL_WRITE) in ksmbd_vfs_make_xattr_posix_acl()
1451 xa_entry->perm |= SMB_ACL_WRITE; in ksmbd_vfs_make_xattr_posix_acl()
1452 if (pa_entry->e_perm & ACL_EXECUTE) in ksmbd_vfs_make_xattr_posix_acl()
1453 xa_entry->perm |= SMB_ACL_EXECUTE; in ksmbd_vfs_make_xattr_posix_acl()
1470 struct dentry *dentry = path->dentry; in ksmbd_vfs_set_sd_xattr()
1480 pntsd->osidoffset = in ksmbd_vfs_set_sd_xattr()
1481 cpu_to_le32(le32_to_cpu(pntsd->osidoffset) + NDR_NTSD_OFFSETOF); in ksmbd_vfs_set_sd_xattr()
1482 pntsd->gsidoffset = in ksmbd_vfs_set_sd_xattr()
1483 cpu_to_le32(le32_to_cpu(pntsd->gsidoffset) + NDR_NTSD_OFFSETOF); in ksmbd_vfs_set_sd_xattr()
1484 pntsd->dacloffset = in ksmbd_vfs_set_sd_xattr()
1485 cpu_to_le32(le32_to_cpu(pntsd->dacloffset) + NDR_NTSD_OFFSETOF); in ksmbd_vfs_set_sd_xattr()
1498 if (S_ISDIR(inode->i_mode)) in ksmbd_vfs_set_sd_xattr()
1560 if (S_ISDIR(inode->i_mode)) in ksmbd_vfs_get_sd_xattr()
1579 rc = -EINVAL; in ksmbd_vfs_get_sd_xattr()
1589 (*pntsd)->osidoffset = cpu_to_le32(le32_to_cpu((*pntsd)->osidoffset) - in ksmbd_vfs_get_sd_xattr()
1591 (*pntsd)->gsidoffset = cpu_to_le32(le32_to_cpu((*pntsd)->gsidoffset) - in ksmbd_vfs_get_sd_xattr()
1593 (*pntsd)->dacloffset = cpu_to_le32(le32_to_cpu((*pntsd)->dacloffset) - in ksmbd_vfs_get_sd_xattr()
1644 err = -EINVAL; in ksmbd_vfs_get_dos_attrib_xattr()
1654 * ksmbd_vfs_init_kstat() - convert unix stat information to smb stat format
1663 struct kstat *kstat = ksmbd_kstat->kstat; in ksmbd_vfs_init_kstat()
1666 info->FileIndex = 0; in ksmbd_vfs_init_kstat()
1667 info->CreationTime = cpu_to_le64(ksmbd_kstat->create_time); in ksmbd_vfs_init_kstat()
1668 time = ksmbd_UnixTimeToNT(kstat->atime); in ksmbd_vfs_init_kstat()
1669 info->LastAccessTime = cpu_to_le64(time); in ksmbd_vfs_init_kstat()
1670 time = ksmbd_UnixTimeToNT(kstat->mtime); in ksmbd_vfs_init_kstat()
1671 info->LastWriteTime = cpu_to_le64(time); in ksmbd_vfs_init_kstat()
1672 time = ksmbd_UnixTimeToNT(kstat->ctime); in ksmbd_vfs_init_kstat()
1673 info->ChangeTime = cpu_to_le64(time); in ksmbd_vfs_init_kstat()
1675 if (ksmbd_kstat->file_attributes & FILE_ATTRIBUTE_DIRECTORY_LE) { in ksmbd_vfs_init_kstat()
1676 info->EndOfFile = 0; in ksmbd_vfs_init_kstat()
1677 info->AllocationSize = 0; in ksmbd_vfs_init_kstat()
1679 info->EndOfFile = cpu_to_le64(kstat->size); in ksmbd_vfs_init_kstat()
1680 info->AllocationSize = cpu_to_le64(kstat->blocks << 9); in ksmbd_vfs_init_kstat()
1682 info->ExtFileAttributes = ksmbd_kstat->file_attributes; in ksmbd_vfs_init_kstat()
1692 struct ksmbd_share_config *share_conf = work->tcon->share_conf; in ksmbd_vfs_fill_dentry_attrs()
1696 .mnt = share_conf->vfs_path.mnt, in ksmbd_vfs_fill_dentry_attrs()
1700 rc = vfs_getattr(&path, ksmbd_kstat->kstat, in ksmbd_vfs_fill_dentry_attrs()
1706 time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->ctime); in ksmbd_vfs_fill_dentry_attrs()
1707 ksmbd_kstat->create_time = time; in ksmbd_vfs_fill_dentry_attrs()
1710 * set default value for the case that store dos attributes is not yes in ksmbd_vfs_fill_dentry_attrs()
1713 if (S_ISDIR(ksmbd_kstat->kstat->mode)) in ksmbd_vfs_fill_dentry_attrs()
1714 ksmbd_kstat->file_attributes = FILE_ATTRIBUTE_DIRECTORY_LE; in ksmbd_vfs_fill_dentry_attrs()
1716 ksmbd_kstat->file_attributes = FILE_ATTRIBUTE_ARCHIVE_LE; in ksmbd_vfs_fill_dentry_attrs()
1718 if (test_share_config_flag(work->tcon->share_conf, in ksmbd_vfs_fill_dentry_attrs()
1724 ksmbd_kstat->file_attributes = cpu_to_le32(da.attr); in ksmbd_vfs_fill_dentry_attrs()
1725 ksmbd_kstat->create_time = da.create_time; in ksmbd_vfs_fill_dentry_attrs()
1739 ssize_t value_len = -ENOENT, xattr_list_len; in ksmbd_vfs_casexattr_len()
1745 for (name = xattr_list; name - xattr_list < xattr_list_len; in ksmbd_vfs_casexattr_len()
1773 return -ENOMEM; in ksmbd_vfs_xattr_stream_name()
1799 if (!(src_fp->daccess & (FILE_READ_DATA_LE | FILE_EXECUTE_LE))) { in ksmbd_vfs_copy_file_ranges()
1800 pr_err("no right to read(%pD)\n", src_fp->filp); in ksmbd_vfs_copy_file_ranges()
1801 return -EACCES; in ksmbd_vfs_copy_file_ranges()
1803 if (!(dst_fp->daccess & (FILE_WRITE_DATA_LE | FILE_APPEND_DATA_LE))) { in ksmbd_vfs_copy_file_ranges()
1804 pr_err("no right to write(%pD)\n", dst_fp->filp); in ksmbd_vfs_copy_file_ranges()
1805 return -EACCES; in ksmbd_vfs_copy_file_ranges()
1809 return -EBADF; in ksmbd_vfs_copy_file_ranges()
1813 if (!work->tcon->posix_extensions) { in ksmbd_vfs_copy_file_ranges()
1819 if (check_lock_range(src_fp->filp, src_off, in ksmbd_vfs_copy_file_ranges()
1820 src_off + len - 1, READ)) in ksmbd_vfs_copy_file_ranges()
1821 return -EAGAIN; in ksmbd_vfs_copy_file_ranges()
1822 if (check_lock_range(dst_fp->filp, dst_off, in ksmbd_vfs_copy_file_ranges()
1823 dst_off + len - 1, WRITE)) in ksmbd_vfs_copy_file_ranges()
1824 return -EAGAIN; in ksmbd_vfs_copy_file_ranges()
1828 src_file_size = i_size_read(file_inode(src_fp->filp)); in ksmbd_vfs_copy_file_ranges()
1836 return -E2BIG; in ksmbd_vfs_copy_file_ranges()
1838 ret = vfs_copy_file_range(src_fp->filp, src_off, in ksmbd_vfs_copy_file_ranges()
1839 dst_fp->filp, dst_off, len, 0); in ksmbd_vfs_copy_file_ranges()
1840 if (ret == -EOPNOTSUPP || ret == -EXDEV) in ksmbd_vfs_copy_file_ranges()
1841 ret = vfs_copy_file_range(src_fp->filp, src_off, in ksmbd_vfs_copy_file_ranges()
1842 dst_fp->filp, dst_off, len, in ksmbd_vfs_copy_file_ranges()
1855 wait_event(flock->c.flc_wait, !flock->c.flc_blocker); in ksmbd_vfs_posix_lock_wait()
1860 return wait_event_interruptible_timeout(flock->c.flc_wait, in ksmbd_vfs_posix_lock_wait_timeout()
1861 !flock->c.flc_blocker, in ksmbd_vfs_posix_lock_wait_timeout()
1875 struct dentry *dentry = path->dentry; in ksmbd_vfs_set_init_posix_acl()
1880 return -EOPNOTSUPP; in ksmbd_vfs_set_init_posix_acl()
1882 ksmbd_debug(SMB, "Set posix acls\n"); in ksmbd_vfs_set_init_posix_acl()
1887 /* Set default owner group */ in ksmbd_vfs_set_init_posix_acl()
1888 acl_state.owner.allow = (inode->i_mode & 0700) >> 6; in ksmbd_vfs_set_init_posix_acl()
1889 acl_state.group.allow = (inode->i_mode & 0070) >> 3; in ksmbd_vfs_set_init_posix_acl()
1890 acl_state.other.allow = inode->i_mode & 0007; in ksmbd_vfs_set_init_posix_acl()
1891 acl_state.users->aces[acl_state.users->n].uid = inode->i_uid; in ksmbd_vfs_set_init_posix_acl()
1892 acl_state.users->aces[acl_state.users->n++].perms.allow = in ksmbd_vfs_set_init_posix_acl()
1894 acl_state.groups->aces[acl_state.groups->n].gid = inode->i_gid; in ksmbd_vfs_set_init_posix_acl()
1895 acl_state.groups->aces[acl_state.groups->n++].perms.allow = in ksmbd_vfs_set_init_posix_acl()
1902 return -ENOMEM; in ksmbd_vfs_set_init_posix_acl()
1904 posix_state_to_acl(&acl_state, acls->a_entries); in ksmbd_vfs_set_init_posix_acl()
1908 ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_ACCESS) failed, rc : %d\n", in ksmbd_vfs_set_init_posix_acl()
1910 else if (S_ISDIR(inode->i_mode)) { in ksmbd_vfs_set_init_posix_acl()
1911 posix_state_to_acl(&acl_state, acls->a_entries); in ksmbd_vfs_set_init_posix_acl()
1914 ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_DEFAULT) failed, rc : %d\n", in ksmbd_vfs_set_init_posix_acl()
1928 struct dentry *dentry = path->dentry; in ksmbd_vfs_inherit_posix_acl()
1933 return -EOPNOTSUPP; in ksmbd_vfs_inherit_posix_acl()
1937 return -ENOENT; in ksmbd_vfs_inherit_posix_acl()
1938 pace = acls->a_entries; in ksmbd_vfs_inherit_posix_acl()
1940 for (i = 0; i < acls->a_count; i++, pace++) { in ksmbd_vfs_inherit_posix_acl()
1941 if (pace->e_tag == ACL_MASK) { in ksmbd_vfs_inherit_posix_acl()
1942 pace->e_perm = 0x07; in ksmbd_vfs_inherit_posix_acl()
1949 ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_ACCESS) failed, rc : %d\n", in ksmbd_vfs_inherit_posix_acl()
1951 if (S_ISDIR(inode->i_mode)) { in ksmbd_vfs_inherit_posix_acl()
1955 ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_DEFAULT) failed, rc : %d\n", in ksmbd_vfs_inherit_posix_acl()