Lines Matching +full:sig +full:- +full:dir +full:- +full:cmd
1 /* SPDX-License-Identifier: LGPL-2.1 */
59 * max attribute cache timeout (jiffies) - 2^30
113 #define CIFS_DFS_ROOT_SES(ses) ((ses)->dfs_root_ses ?: (ses))
225 struct shash_desc *aes_cmac; /* block-cipher based MAC function, for SMB3 signatures */
227 struct crypto_aead *enc; /* smb3 encryption AEAD TFM (AES-CCM and AES-GCM) */
228 struct crypto_aead *dec; /* smb3 decryption AEAD TFM (AES-CCM and AES-GCM) */
340 * message field DataRemaining for out-of-band data read (e.g through
472 /* open a file for non-posix mounts */
475 /* set fid protocol-specific info */
497 /* open dir, start readdir */
506 /* close dir */
658 #define HEADER_SIZE(server) (server->vals->header_size)
659 #define MAX_HEADER_SIZE(server) (server->vals->max_header_size)
660 #define HEADER_PREAMBLE_SIZE(server) (server->vals->header_preamble_size)
661 #define MID_HEADER_SIZE(server) (HEADER_SIZE(server) - 1 - HEADER_PREAMBLE_SIZE(server))
756 /* message size the server can send or receive for non-raw SMBs */
764 __u64 current_mid; /* multiplex id - rotating counter, protected by mid_counter_lock */
783 bool sec_iakerb; /* supports pass-through auth for Kerberos (krb5 proxy) */
798 atomic_t num_cmds[NUMBER_OF_SMB2_COMMANDS]; /* total requests by cmd */
800 __u64 time_per_cmd[NUMBER_OF_SMB2_COMMANDS]; /* total time per cmd */
836 bool noblockcnt; /* use non-blocking connect() */
840 * primary_server holds the ref-counted
843 #define SERVER_IS_CHAN(server) (!!(server)->primary_server)
871 mutex_lock(&server->_srv_mutex); in cifs_server_lock()
872 server->nofs_flag = nofs_flag; in cifs_server_lock()
877 unsigned int nofs_flag = server->nofs_flag; in cifs_server_unlock()
879 mutex_unlock(&server->_srv_mutex); in cifs_server_unlock()
896 spin_lock(&server->req_lock); in in_flight()
897 num = server->in_flight; in in_flight()
898 spin_unlock(&server->req_lock); in in_flight()
907 spin_lock(&server->req_lock); in has_credits()
909 spin_unlock(&server->req_lock); in has_credits()
917 server->ops->add_credits(server, credits, optype); in add_credits()
924 if (credits->value) { in add_credits_and_wake_if()
925 server->ops->add_credits(server, credits, optype); in add_credits_and_wake_if()
926 wake_up(&server->request_q); in add_credits_and_wake_if()
927 credits->value = 0; in add_credits_and_wake_if()
934 server->ops->set_credits(server, val); in set_credits()
941 return server->ops->adjust_credits ? in adjust_credits()
942 server->ops->adjust_credits(server, subreq, trace) : 0; in adjust_credits()
948 return cpu_to_le64(server->ops->get_next_mid(server)); in get_next_mid64()
954 __u16 mid = server->ops->get_next_mid(server); in get_next_mid()
957 * on-the-wire decoding. in get_next_mid()
965 if (server->ops->revert_current_mid) in revert_current_mid()
966 server->ops->revert_current_mid(server, val); in revert_current_mid()
973 unsigned int num = le16_to_cpu(shdr->CreditCharge); in revert_current_mid_from_hdr()
981 return le16_to_cpu(smb->Mid); in get_mid()
987 return mid == le16_to_cpu(smb->Mid); in compare_mid()
992 * we can allow up to 2^24-1, minus the size of a READ/WRITE_AND_X header, not
1003 #define CIFS_MAX_WSIZE ((1<<24) - 1 - sizeof(WRITE_REQ) + 4)
1004 #define CIFS_MAX_RSIZE ((1<<24) - sizeof(READ_RSP) + 4)
1008 * of 2^17-1 minus the size of the call header. That allows for a read or
1011 #define CIFS_MAX_RFC1002_WSIZE ((1<<17) - 1 - sizeof(WRITE_REQ) + 4)
1012 #define CIFS_MAX_RFC1002_RSIZE ((1<<17) - 1 - sizeof(READ_RSP) + 4)
1023 …s.msdn.com/b/openspecification/archive/2009/04/10/smb-maximum-transmit-buffer-size-and-performance…
1029 * Macros to allow the TCP_Server_Info->net field and related code to drop out
1037 return srv->net; in cifs_net_ns()
1042 srv->net = net; in cifs_set_net_ns()
1104 unsigned int overrideSecFlg; /* if non-zero override global sec flags */
1153 #define CIFS_INVAL_CHAN_INDEX (-1)
1155 ((1UL << (ses)->chan_count) - 1)
1157 (!(ses)->chans_need_reconnect)
1159 ((ses)->chans_need_reconnect == CIFS_ALL_CHANNELS_SET(ses))
1161 ((ses)->chans_need_reconnect = CIFS_ALL_CHANNELS_SET(ses))
1163 test_bit((index), &(ses)->chans_need_reconnect)
1165 ((ses)->chans[(index)].in_reconnect)
1192 return ses->server->vals->cap_unix & ses->capabilities; in cap_unix()
1244 char *password; /* for share-level security */
1311 __u64 snapshot_time; /* for timewarp tokens - timestamp of snapshot */
1361 return tlink->tl_tcon; in tlink_tcon()
1367 return cifs_sb->master_tlink; in cifs_sb_master_tlink()
1376 atomic_inc(&tlink->tl_count); in cifs_get_tlink()
1434 #define ACL_NO_MODE ((umode_t)(-1))
1473 /* following two lists are protected by tcon->open_file_lock */
1476 /* lock list below protected by cifsi->lock_sem */
1545 * cfile->file_info_lock held.
1550 ++cifs_file->count; in cifsFileInfo_get_locked()
1570 #define CIFS_CACHE_READ(cinode) ((cinode->oplock & CIFS_CACHE_READ_FLG) || (CIFS_SB(cinode->netfs.i…
1571 #define CIFS_CACHE_HANDLE(cinode) (cinode->oplock & CIFS_CACHE_HANDLE_FLG)
1572 #define CIFS_CACHE_WRITE(cinode) ((cinode->oplock & CIFS_CACHE_WRITE_FLG) || (CIFS_SB(cinode->netfs…
1624 return sb->s_fs_info; in CIFS_SB()
1630 return CIFS_SB(file_inode(file)->i_sb); in CIFS_FILE_SB()
1635 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) in CIFS_DIR_SEP()
1662 spin_lock(&tcon->stat_lock); in cifs_stats_bytes_written()
1663 tcon->bytes_written += bytes; in cifs_stats_bytes_written()
1664 spin_unlock(&tcon->stat_lock); in cifs_stats_bytes_written()
1671 spin_lock(&tcon->stat_lock); in cifs_stats_bytes_read()
1672 tcon->bytes_read += bytes; in cifs_stats_bytes_read()
1673 spin_unlock(&tcon->stat_lock); in cifs_stats_bytes_read()
1682 * - This will be called by cifsd, with no locks held.
1683 * - The mid will still be on the pending_mid_q.
1684 * - mid->resp_buf will point to the current buffer.
1697 * - it will be called by cifsd, with no locks held
1698 * - the mid will be removed from any lists
1749 __u16 cmd; member
1756 atomic_inc(&server->in_send); in cifs_in_send_inc()
1761 atomic_dec(&server->in_send); in cifs_in_send_dec()
1766 atomic_inc(&server->num_waiters); in cifs_num_waiters_inc()
1771 atomic_dec(&server->num_waiters); in cifs_num_waiters_dec()
1777 mid->when_sent = jiffies; in cifs_save_when_sent()
1825 kfree(param->path_name); in __free_dfs_info_param()
1826 kfree(param->node_name); in __free_dfs_info_param()
1860 case -EINTR: in is_interrupt_error()
1861 case -ERESTARTSYS: in is_interrupt_error()
1862 case -ERESTARTNOHAND: in is_interrupt_error()
1863 case -ERESTARTNOINTR: in is_interrupt_error()
1871 if (is_interrupt_error(error) || error == -EAGAIN) in is_retryable_error()
1878 if (error == -EAGAIN || error == -ECONNABORTED) in is_replayable_error()
1912 #define CIFS_LOG_ERROR 0x010 /* log NT STATUS if non-zero */
1997 * vol_info->ctx_lock vol_info->ctx
1998 * cifs_sb_info->tlink_tree_lock cifs_sb_info->tlink_tree cifs_setup_cifs_sb
1999 * TCP_Server_Info-> TCP_Server_Info cifs_get_tcp_session
2001 * TCP_Server_Info->srv_mutex TCP_Server_Info cifs_get_tcp_session
2002 * cifs_ses->session_mutex cifs_ses sesInfoAlloc
2003 * cifs_tcon->open_file_lock cifs_tcon->openFileList tconInfoAlloc
2004 * cifs_tcon->pending_opens
2005 * cifs_tcon->stat_lock cifs_tcon->bytes_read tconInfoAlloc
2006 * cifs_tcon->bytes_written
2011 * TCP_Server_Info->srv_lock (anything in struct not protected by another lock and can change)
2012 * TCP_Server_Info->mid_queue_lock TCP_Server_Info->pending_mid_q cifs_get_tcp_session
2013 * mid_q_entry->deleted_from_q
2014 * TCP_Server_Info->mid_counter_lock TCP_Server_Info->current_mid cifs_get_tcp_session
2015 * TCP_Server_Info->req_lock TCP_Server_Info->in_flight cifs_get_tcp_session
2016 * ->credits
2017 * ->echo_credits
2018 * ->oplock_credits
2019 * ->reconnect_instance
2020 * cifs_ses->ses_lock (anything that is not protected by another lock and can change)
2022 * cifs_ses->iface_lock cifs_ses->iface_list sesInfoAlloc
2023 * ->iface_count
2024 * ->iface_last_update
2025 * cifs_ses->chan_lock cifs_ses->chans sesInfoAlloc
2026 * ->chans_need_reconnect
2027 * ->chans_in_reconnect
2028 * cifs_tcon->tc_lock (anything that is not protected by another lock and can change)
2030 * inode->i_rwsem, taken by fs/netfs/locking.c e.g. should be taken before cifsInodeInfo locks
2031 * cifsInodeInfo->open_file_lock cifsInodeInfo->openFileList cifs_alloc_inode
2032 * cifsInodeInfo->writers_lock cifsInodeInfo->writers cifsInodeInfo_alloc
2033 * cifsInodeInfo->lock_sem cifsInodeInfo->llist cifs_init_once
2034 * ->can_cache_brlcks
2035 * cifsInodeInfo->deferred_lock cifsInodeInfo->deferred_closes cifsInodeInfo_alloc
2036 * cached_fids->cfid_list_lock cifs_tcon->cfids->entries init_cached_dirs
2037 * cached_fid->fid_lock (anything that is not protected by another lock and can change)
2039 * cifsFileInfo->fh_mutex cifsFileInfo cifs_new_fileinfo
2040 * cifsFileInfo->file_info_lock cifsFileInfo->count cifs_new_fileinfo
2041 * ->invalidHandle initiate_cifs_search
2042 * ->oplock_break_cancelled
2043 * mid_q_entry->mid_lock mid_q_entry->callback alloc_mid
2068 * tcon->open_file_lock and that before file->file_info_lock since the
2069 * structure order is cifs_socket-->cifs_ses-->cifs_tcon-->cifs_file
2106 extern bool enable_gcm_256; /* allow optional negotiate of strongest signing (aes-gcm-256) */
2107 extern bool require_gcm_256; /* require use of strongest signing (aes-gcm-256) */
2114 extern unsigned int dir_cache_timeout; /* max time for directory lease caching of dir */
2174 return strcmp(server->vals->version_string, SMB1_VERSION_STRING) == 0; in is_smb1_server()
2180 * For SMB1, see MS-CIFS 2.4.55 SMB_COM_TREE_CONNECT_ANDX (0x75) and MS-CIFS 3.3.4.4 DFS in is_tcon_dfs()
2183 * For SMB2+, see MS-SMB2 2.2.10 SMB2 TREE_CONNECT Response and MS-SMB2 3.3.4.14 Server in is_tcon_dfs()
2186 if (!tcon || !tcon->ses || !tcon->ses->server) in is_tcon_dfs()
2188 return is_smb1_server(tcon->ses->server) ? tcon->Flags & SMB_SHARE_IS_IN_DFS : in is_tcon_dfs()
2189 tcon->share_flags & (SHI1005_FLAGS_DFS | SHI1005_FLAGS_DFS_ROOT); in is_tcon_dfs()
2197 * MS-DFSC 2.2.4 RESP_GET_DFS_REFERRAL. in cifs_is_referral_server()
2199 return is_tcon_dfs(tcon) || (ref && (ref->flags & DFSREF_REFERRAL_SERVER)); in cifs_is_referral_server()
2204 return (u64)fl->fl_end - fl->fl_start + 1; in cifs_flock_len()
2209 if (WARN_ON_ONCE(!ses || !ses->server)) in ntlmssp_workstation_name_size()
2215 if (ses->server->dialect <= SMB20_PROT_ID) in ntlmssp_workstation_name_size()
2216 return min_t(size_t, sizeof(ses->workstation_name), RFC1001_NAME_LEN_WITH_NULL); in ntlmssp_workstation_name_size()
2217 return sizeof(ses->workstation_name); in ntlmssp_workstation_name_size()
2222 memcpy(dst, src, (size_t)((u8 *)&src->EASize - (u8 *)src)); in move_cifs_info_to_smb2()
2223 dst->IndexNumber = 0; in move_cifs_info_to_smb2()
2224 dst->EASize = src->EASize; in move_cifs_info_to_smb2()
2225 dst->AccessFlags = 0; in move_cifs_info_to_smb2()
2226 dst->CurrentByteOffset = 0; in move_cifs_info_to_smb2()
2227 dst->Mode = 0; in move_cifs_info_to_smb2()
2228 dst->AlignmentRequirement = 0; in move_cifs_info_to_smb2()
2229 dst->FileNameLength = src->FileNameLength; in move_cifs_info_to_smb2()
2234 const u8 *sig) in cifs_get_num_sgs() argument
2259 * Instead, we convert to a BVEC-type iterator higher up. in cifs_get_num_sgs()
2263 return -EIO; in cifs_get_num_sgs()
2270 return -EIO; in cifs_get_num_sgs()
2275 addr = (unsigned long)iov->iov_base + skip; in cifs_get_num_sgs()
2277 len = iov->iov_len - skip; in cifs_get_num_sgs()
2288 nents += DIV_ROUND_UP(offset_in_page(sig) + SMB2_SIGNATURE_SIZE, PAGE_SIZE); in cifs_get_num_sgs()
2305 unsigned int len = min_t(unsigned int, buflen, PAGE_SIZE - off); in cifs_sg_set_buf()
2307 sg_set_page(&sgtable->sgl[sgtable->nents++], in cifs_sg_set_buf()
2312 buflen -= len; in cifs_sg_set_buf()
2315 sg_set_page(&sgtable->sgl[sgtable->nents++], in cifs_sg_set_buf()
2351 spin_lock(&ses->ses_lock); in cifs_ses_exiting()
2352 ret = ses->ses_status == SES_EXITING; in cifs_ses_exiting()
2353 spin_unlock(&ses->ses_lock); in cifs_ses_exiting()
2378 * Execute mid callback atomically - ensures callback runs exactly once
2385 spin_lock(&mid->mid_lock); in mid_execute_callback()
2386 callback = mid->callback; in mid_execute_callback()
2387 mid->callback = NULL; /* Mark as executed, */ in mid_execute_callback()
2388 spin_unlock(&mid->mid_lock); in mid_execute_callback()
2395 ((tcon)->posix_extensions || \
2396 (le32_to_cpu((tcon)->fsAttrInfo.Attributes) & \