summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnzo Matsumiya <ematsumiya@suse.de>2024-11-13 17:31:03 -0300
committerEnzo Matsumiya <ematsumiya@suse.de>2024-11-13 17:31:03 -0300
commit5edd54dc0927cbebe34f00af66c04f27ccb0983c (patch)
tree48dc4e2d0fbc3b0b3931edcd8b42633f83da3bcf
parent472697f67cf64a2461ad1842927f3c8cc539f37e (diff)
downloadlinux-5edd54dc0927cbebe34f00af66c04f27ccb0983c.tar.gz
linux-5edd54dc0927cbebe34f00af66c04f27ccb0983c.tar.bz2
linux-5edd54dc0927cbebe34f00af66c04f27ccb0983c.zip
smb: client: replace function pointers with smb{2,3}_* functions
Continuation of previous commit. Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
-rw-r--r--fs/smb/client/cifs_debug.c7
-rw-r--r--fs/smb/client/cifsacl.c6
-rw-r--r--fs/smb/client/cifsfs.c1
-rw-r--r--fs/smb/client/cifsglob.h249
-rw-r--r--fs/smb/client/connect.c2
-rw-r--r--fs/smb/client/dfs.c1
-rw-r--r--fs/smb/client/dir.c7
-rw-r--r--fs/smb/client/file.c18
-rw-r--r--fs/smb/client/inode.c134
-rw-r--r--fs/smb/client/ioctl.c45
-rw-r--r--fs/smb/client/link.c27
-rw-r--r--fs/smb/client/misc.c7
-rw-r--r--fs/smb/client/readdir.c40
-rw-r--r--fs/smb/client/smb2inode.c6
-rw-r--r--fs/smb/client/smb2ops.c275
-rw-r--r--fs/smb/client/smb2pdu.c16
-rw-r--r--fs/smb/client/smb2proto.h203
-rw-r--r--fs/smb/client/smb2transport.c3
-rw-r--r--fs/smb/client/trace.h2
-rw-r--r--fs/smb/client/transport.c26
-rw-r--r--fs/smb/client/xattr.c18
21 files changed, 423 insertions, 670 deletions
diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c
index f78e197327b5..e58291e4a83f 100644
--- a/fs/smb/client/cifs_debug.c
+++ b/fs/smb/client/cifs_debug.c
@@ -26,6 +26,7 @@
#include "smbdirect.h"
#endif
#include "cifs_swn.h"
+#include "smb2proto.h"
void
cifs_dump_mem(char *label, void *data, int length)
@@ -44,10 +45,8 @@ static void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
smb->Command, smb->Status, smb->Flags, smb->MessageId, smb->Id.SyncId.ProcessId,
smb->StructureSize);
- if (!smb2_check_message(buf, server->total_read, server)) {
- cifs_dbg(VFS, "smb buf %p len %u\n", smb,
- smb2_calc_smb_size(smb));
- }
+ if (!smb2_check_message(buf, server->total_read, server))
+ cifs_dbg(VFS, "smb buf %p len %u\n", smb, smb2_calc_size(smb));
#endif /* CONFIG_CIFS_DEBUG2 */
}
diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c
index 114dd27ee918..467fa46bb435 100644
--- a/fs/smb/client/cifsacl.c
+++ b/fs/smb/client/cifsacl.c
@@ -25,6 +25,7 @@
#include "fs_context.h"
#include "cifs_fs_sb.h"
#include "cifs_unicode.h"
+#include "smb2proto.h"
/* security id for everyone/world system group */
static const struct cifs_sid sid_everyone = {
@@ -1510,12 +1511,9 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc);
- if (ops->set_acl == NULL)
- rc = -EOPNOTSUPP;
-
if (!rc) {
/* Set the security descriptor */
- rc = ops->set_acl(pnntsd, nsecdesclen, inode, path, aclflag);
+ rc = set_smb2_acl(pnntsd, nsecdesclen, inode, path, aclflag);
cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc);
}
cifs_put_tlink(tlink);
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index c6f517099eea..990bb7d4caab 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -49,6 +49,7 @@
#endif
#include "fs_context.h"
#include "cached_dir.h"
+#include "smb2proto.h"
/*
* DOS dates from 1980/1/1 through 2107/12/31
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index ef81676664a5..6a01b01ef8de 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -274,224 +274,6 @@ struct cifsInodeInfo;
struct cifs_open_parms;
struct cifs_credits;
-/* TODO: find a suitable place for these functions */
-extern struct mid_q_entry * smb2_find_mid(struct TCP_Server_Info *, char *);
-extern void smb2_dump_detail(void *buf, struct TCP_Server_Info *ptcp_info);
-extern void clear_stats(struct cifs_tcon *);
-extern void smb2_print_stats(struct seq_file *m, struct cifs_tcon *);
-extern bool smb2_is_valid_oplock_break(char *, struct TCP_Server_Info *);
-extern int smb2_handle_cancelled_mid(struct mid_q_entry *, struct TCP_Server_Info *);
-extern bool smb2_need_neg(struct TCP_Server_Info *);
-extern int smb2_negotiate(const unsigned int xid,
- struct cifs_ses *ses,
- struct TCP_Server_Info *server);
-extern int SMB2_sess_setup(const unsigned int, struct cifs_ses *,
- struct TCP_Server_Info *server,
- const struct nls_table *);
-extern int SMB2_logoff(const unsigned int, struct cifs_ses *);
-/* connect to a server share */
-extern int SMB2_tcon(const unsigned int, struct cifs_ses *, const char *,
- struct cifs_tcon *, const struct nls_table *);
-/* close tree connection */
-extern int SMB2_tdis(const unsigned int, struct cifs_tcon *);
-
-
-extern int smb2_get_dfs_refer(const unsigned int, struct cifs_ses *,
- const char *, struct dfs_info3_param **,
- unsigned int *, const struct nls_table *, int);
-/* check if a path is accessible or not */
-extern int smb2_is_path_accessible(const unsigned int, struct cifs_tcon *,
- struct cifs_sb_info *, const char *);
-/* query path data from the server */
-extern int smb2_query_path_info(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb,
- const char *full_path,
- struct cifs_open_info_data *data);
-/* query reparse point to determine which type of special file */
-extern int smb2_query_reparse_point(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb,
- const char *full_path,
- u32 *tag, struct kvec *rsp,
- int *rsp_buftype);
-/* get server index number */
-extern int smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb, const char *full_path, u64 *uniqueid,
- struct cifs_open_info_data *data);
-/* query file data from the server */
-extern int smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifsFileInfo *cfile, struct cifs_open_info_data *data);
-/* set size by path */
-extern int smb2_set_path_size(const unsigned int, struct cifs_tcon *,
- const char *, __u64, struct cifs_sb_info *, bool,
- struct dentry *);
-/* set size by file handle */
-extern int smb2_set_file_size(const unsigned int, struct cifs_tcon *,
- struct cifsFileInfo *, __u64, bool);
-/* set attributes */
-int smb2_set_file_info(struct inode *, const char *, FILE_BASIC_INFO *,
- const unsigned int);
-extern int smb2_set_compression(const unsigned int, struct cifs_tcon *,
- struct cifsFileInfo *);
-/* check if we can send an echo or nor */
-extern bool smb2_can_echo(struct TCP_Server_Info *);
-/* send echo request */
-extern int SMB2_echo(struct TCP_Server_Info *);
-extern int smb2_mkdir(const unsigned int xid, struct inode *inode, umode_t mode,
- struct cifs_tcon *tcon, const char *name,
- struct cifs_sb_info *sb);
-/* set info on created directory */
-extern void smb2_mkdir_setinfo(struct inode *, const char *,
- struct cifs_sb_info *, struct cifs_tcon *,
- const unsigned int);
-/* remove directory */
-extern int smb2_rmdir(const unsigned int, struct cifs_tcon *, const char *,
- struct cifs_sb_info *);
-/* unlink file */
-extern int smb2_unlink(const unsigned int, struct cifs_tcon *, const char *,
- struct cifs_sb_info *, struct dentry *);
-/* send rename request */
-extern int smb2_rename_path(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct dentry *source_dentry,
- const char *from_name, const char *to_name,
- struct cifs_sb_info *cifs_sb);
-extern int smb2_create_hardlink(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct dentry *source_dentry,
- const char *from_name, const char *to_name,
- struct cifs_sb_info *cifs_sb);
-/* open a file for non-posix mounts */
-extern int smb2_open(const unsigned int xid, struct cifs_open_parms *oparms, __u32 *oplock,
- void *buf);
-/* set fid protocol-specific info */
-extern void smb2_set_fid(struct cifsFileInfo *, struct cifs_fid *, __u32);
-/* close a file */
-extern int smb2_close(const unsigned int, struct cifs_tcon *,
- struct cifs_fid *);
-/* send a flush request to the server */
-extern int smb2_flush_file(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
-/* async read from the server */
-extern int smb2_async_readv(struct cifs_io_subrequest *);
-/* async write to the server */
-extern void smb2_async_writev(struct cifs_io_subrequest *);
-/* sync read from the server */
-extern int smb2_sync_read(const unsigned int, struct cifs_fid *,
- struct cifs_io_parms *, unsigned int *, char **,
- int *);
-/* sync write to the server */
-extern int smb2_sync_write(const unsigned int, struct cifs_fid *,
- struct cifs_io_parms *, unsigned int *, struct kvec *,
- unsigned long);
-/* open dir, start readdir */
-extern int smb2_query_dir_first(const unsigned int, struct cifs_tcon *,
- const char *, struct cifs_sb_info *,
- struct cifs_fid *, __u16,
- struct cifs_search_info *);
-/* continue readdir */
-extern int smb2_query_dir_next(const unsigned int, struct cifs_tcon *,
- struct cifs_fid *,
- __u16, struct cifs_search_info *srch_inf);
-/* close dir */
-extern int smb2_close_dir(const unsigned int, struct cifs_tcon *,
- struct cifs_fid *);
-/* calculate a size of SMB message */
-extern unsigned int smb2_calc_size(void *buf);
-/* check for STATUS_PENDING and process the response if yes */
-extern bool smb2_is_status_pending(char *buf, struct TCP_Server_Info *server);
-/* check for STATUS_NETWORK_SESSION_EXPIRED */
-extern bool smb2_is_session_expired(char *);
-/* send oplock break response */
-extern int smb2_oplock_response(struct cifs_tcon *tcon, __u64 persistent_fid, __u64 volatile_fid,
- __u16 net_fid, struct cifsInodeInfo *cifs_inode);
-/* send mandatory brlock to the server */
-extern int smb2_mand_lock(const unsigned int, struct cifsFileInfo *, __u64,
- __u64, __u32, int, int, bool);
-/* unlock range of mandatory locks */
-extern int smb2_unlock_range(struct cifsFileInfo *, struct file_lock *,
- const unsigned int);
-
-/* push brlocks from the cache to the server */
-extern int smb2_push_mandatory_locks(struct cifsFileInfo *);
-/* get lease key of the inode */
-extern void smb2_get_lease_key(struct inode *, struct cifs_fid *);
-/* set lease key of the inode */
-extern void smb2_set_lease_key(struct inode *, struct cifs_fid *);
-/* generate new lease key */
-extern void smb2_new_lease_key(struct cifs_fid *);
-extern int smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifsFileInfo *src_file, void __user *);
-extern int smb3_notify(const unsigned int xid, struct file *pfile,
- void __user *pbuf, bool return_changes);
-extern int smb3_query_mf_symlink(unsigned int, struct cifs_tcon *,
- struct cifs_sb_info *, const unsigned char *,
- char *, unsigned int *);
-extern int smb3_create_mf_symlink(unsigned int, struct cifs_tcon *,
- struct cifs_sb_info *, const unsigned char *,
- char *, unsigned int *);
-/* if we can do cache read operations */
-extern bool smb21_is_read_op(__u32);
-extern ssize_t copychunk_range)(const unsigned int,
- struct cifsFileInfo *src_file,
- struct cifsFileInfo *target_file,
- u64 src_off, u64 len, u64 dest_off);
-extern ssize_t smb2_query_eas(const unsigned int, struct cifs_tcon *,
- const unsigned char *, const unsigned char *, char *,
- size_t, struct cifs_sb_info *);
-extern int smb2_set_ea(const unsigned int, struct cifs_tcon *, const char *,
- const char *, const void *, const __u16,
- const struct nls_table *, struct cifs_sb_info *);
-extern struct cifs_ntsd * get_smb2_acl(struct cifs_sb_info *, struct inode *,
- const char *, u32 *, u32);
-extern struct cifs_ntsd * get_smb2_acl_by_fid(struct cifs_sb_info *,
- const struct cifs_fid *, u32 *, u32);
-extern int set_smb2_acl(struct cifs_ntsd *, __u32, struct inode *, const char *,
- int);
- /* writepages retry size */
-extern unsigned int smb2_wp_retry_size(struct inode *);
- /* check if we need to issue closedir */
-extern bool smb2_dir_needs_close(struct cifsFileInfo *);
-extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
- enum securityEnum);
-extern int smb2_next_header(struct TCP_Server_Info *server, char *buf,
- unsigned int *noff);
-/* ioctl passthrough for query_info */
-extern int smb2_ioctl_query_info(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb,
- __le16 *path, int is_dir,
- unsigned long p);
-/* make unix special files (block, char, fifo, socket) */
-extern int smb2_make_node(unsigned int xid,
- struct inode *inode,
- struct dentry *dentry,
- struct cifs_tcon *tcon,
- const char *full_path,
- umode_t mode,
- dev_t device_number);
-/* version specific fiemap implementation */
-extern int smb3_fiemap(struct cifs_tcon *tcon, struct cifsFileInfo *,
- struct fiemap_extent_info *, u64, u64);
-/* version specific llseek implementation */
-extern loff_t smb3_llseek(struct file *, struct cifs_tcon *, loff_t, int);
-
-/* Check for STATUS_IO_TIMEOUT */
-extern bool smb2_is_status_io_timeout(char *buf);
-
-/* Check for STATUS_NETWORK_NAME_DELETED */
-extern bool smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *srv);
-
-extern int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb,
- struct kvec *rsp_iov,
- struct cifs_open_info_data *data);
-extern int smb2_create_reparse_symlink(const unsigned int xid,
- struct inode *inode,
- struct dentry *dentry,
- struct cifs_tcon *tcon,
- const char *full_path,
- const char *symname);
-
struct smb_version_operations {
/* find mid corresponding to the response message */
void (*dump_share_caps)(struct seq_file *, struct cifs_tcon *);
@@ -817,12 +599,9 @@ has_credits(struct TCP_Server_Info *server, int *credits, int num_credits)
return num >= num_credits;
}
-static inline void
-add_credits(struct TCP_Server_Info *server, struct cifs_credits *credits,
- const int optype)
-{
- smb2_add_credits(server, credits, optype);
-}
+extern void
+smb2_add_credits(struct TCP_Server_Info *server,
+ struct cifs_credits *credits, const int optype);
static inline void
add_credits_and_wake_if(struct TCP_Server_Info *server,
@@ -835,11 +614,15 @@ add_credits_and_wake_if(struct TCP_Server_Info *server,
}
}
-static inline int
-adjust_credits(struct TCP_Server_Info *server, struct cifs_io_subrequest *subreq,
- unsigned int /* enum smb3_rw_credits_trace */ trace)
+static __u64
+smb2_get_next_mid(struct TCP_Server_Info *server)
{
- return smb2_adjust_credits(server, subreq, trace) : 0;
+ __u64 mid;
+ /* for SMB2 we need the current value */
+ spin_lock(&server->mid_lock);
+ mid = server->CurrentMid++;
+ spin_unlock(&server->mid_lock);
+ return mid;
}
static inline __le64
@@ -859,13 +642,21 @@ get_next_mid(struct TCP_Server_Info *server)
return cpu_to_le16(mid);
}
+static inline void smb2_revert_current_mid(struct TCP_Server_Info *server, const unsigned int val)
+{
+ spin_lock(&server->mid_lock);
+ if (server->CurrentMid >= val)
+ server->CurrentMid -= val;
+ spin_unlock(&server->mid_lock);
+}
+
static inline void
revert_current_mid_from_hdr(struct TCP_Server_Info *server,
const struct smb2_hdr *shdr)
{
unsigned int num = le16_to_cpu(shdr->CreditCharge);
- return smb2_revert_current_mid(server, num > 0 ? num : 1);
+ smb2_revert_current_mid(server, num > 0 ? num : 1);
}
/*
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 7dc9ea6cceb7..ed6812b888a5 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -2008,7 +2008,7 @@ void __cifs_put_smb_ses(struct cifs_ses *ses)
cifs_chan_clear_need_reconnect(ses, server);
spin_unlock(&ses->chan_lock);
- do_logoff = ses->ses_status == SES_GOOD && SMB2_logoff;
+ do_logoff = (ses->ses_status == SES_GOOD);
ses->ses_status = SES_EXITING;
tcon = ses->tcon_ipc;
ses->tcon_ipc = NULL;
diff --git a/fs/smb/client/dfs.c b/fs/smb/client/dfs.c
index 4c9d5e0441bf..f4da19617ee2 100644
--- a/fs/smb/client/dfs.c
+++ b/fs/smb/client/dfs.c
@@ -3,6 +3,7 @@
* Copyright (c) 2022 Paulo Alcantara <palcantara@suse.de>
*/
+#include "smb2proto.h"
#include "cifsproto.h"
#include "cifs_debug.h"
#include "dns_resolve.h"
diff --git a/fs/smb/client/dir.c b/fs/smb/client/dir.c
index 01bb87eaf1f2..cd6e4c0a92b7 100644
--- a/fs/smb/client/dir.c
+++ b/fs/smb/client/dir.c
@@ -23,6 +23,7 @@
#include "fs_context.h"
#include "cifs_ioctl.h"
#include "fscache.h"
+#include "smb2proto.h"
static void
renew_parental_timestamps(struct dentry *direntry)
@@ -186,7 +187,6 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
void *page = alloc_dentry_path();
struct inode *newinode = NULL;
int disposition;
- struct TCP_Server_Info *server = tcon->ses->server;
struct cifs_open_parms oparms;
int rdwr_for_fscache = 0;
@@ -499,10 +499,7 @@ int cifs_mknod(struct mnt_idmap *idmap, struct inode *inode,
trace_smb3_mknod_enter(xid, tcon->ses->Suid, tcon->tid, full_path);
- rc = smb2_make_node(xid, inode, direntry, tcon,
- full_path, mode,
- device_number);
-
+ rc = smb2_make_node(xid, inode, direntry, tcon, full_path, mode, device_number);
mknod_out:
if (rc)
trace_smb3_mknod_err(xid, tcon->ses->Suid, tcon->tid, rc);
diff --git a/fs/smb/client/file.c b/fs/smb/client/file.c
index 30b3abcfc904..23e75de833bc 100644
--- a/fs/smb/client/file.c
+++ b/fs/smb/client/file.c
@@ -112,7 +112,7 @@ static void cifs_issue_write(struct netfs_io_subrequest *subreq)
}
wdata->actual_len = wdata->subreq.len;
- rc = adjust_credits(wdata->server, wdata, cifs_trace_rw_credits_issue_write_adjust);
+ rc = smb2_adjust_credits(wdata->server, wdata, cifs_trace_rw_credits_issue_write_adjust);
if (rc)
goto fail;
@@ -465,7 +465,6 @@ static int cifs_nt_open(const char *full_path, struct inode *inode, struct cifs_
int desired_access;
int disposition;
int create_options = CREATE_NOT_DIR;
- struct TCP_Server_Info *server = tcon->ses->server;
struct cifs_open_parms oparms;
int rdwr_for_fscache = 0;
@@ -587,7 +586,6 @@ struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
struct cifsFileInfo *cfile;
struct cifs_fid_locks *fdlocks;
struct cifs_tcon *tcon = tlink_tcon(tlink);
- struct TCP_Server_Info *server = tcon->ses->server;
cfile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
if (cfile == NULL)
@@ -633,7 +631,7 @@ struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
* If the server returned a read oplock and we have mandatory brlocks,
* set oplock level to None.
*/
- if (server->ops->is_read_op(oplock) && cifs_has_mand_locks(cinode)) {
+ if (smb21_is_read_op(oplock) && cifs_has_mand_locks(cinode)) {
cifs_dbg(FYI, "Reset oplock val from read to None due to mand locks\n");
oplock = 0;
}
@@ -781,7 +779,6 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file,
{
struct inode *inode = d_inode(cifs_file->dentry);
struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink);
- struct TCP_Server_Info *server = tcon->ses->server;
struct cifsInodeInfo *cifsi = CIFS_I(inode);
struct super_block *sb = inode->i_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
@@ -988,7 +985,6 @@ static int
cifs_relock_file(struct cifsFileInfo *cfile)
{
struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
- struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
int rc = 0;
down_read_nested(&cinode->lock_sem, SINGLE_DEPTH_NESTING);
@@ -998,8 +994,7 @@ cifs_relock_file(struct cifsFileInfo *cfile)
return rc;
}
- rc = smb2_push_mandatory_locks(cfile);
-
+ rc = smb2_push_mandatory_locks(cfile);
up_read(&cinode->lock_sem);
return rc;
}
@@ -1147,7 +1142,7 @@ retry_open:
* If the server returned a read oplock and we have mandatory brlocks,
* set oplock level to None.
*/
- if (server->ops->is_read_op(oplock) && cifs_has_mand_locks(cinode)) {
+ if (smb21_is_read_op(oplock) && cifs_has_mand_locks(cinode)) {
cifs_dbg(FYI, "Reset oplock val from read to None due to mand locks\n");
oplock = 0;
}
@@ -1516,7 +1511,6 @@ static int
cifs_push_locks(struct cifsFileInfo *cfile)
{
struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
- struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
int rc = 0;
/* we are going to update can_cache_brlcks here - need a write access */
@@ -1659,8 +1653,6 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
int rc = 0;
__u64 length = cifs_flock_len(flock);
struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data;
- struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
- struct TCP_Server_Info *server = tcon->ses->server;
struct inode *inode = d_inode(cfile->dentry);
if (lock) {
@@ -2101,7 +2093,6 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
rc = smb2_flush_file(xid, tcon, &smbfile->fid);
}
-strict_fsync_exit:
free_xid(xid);
return rc;
}
@@ -2145,7 +2136,6 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
rc = smb2_flush_file(xid, tcon, &smbfile->fid);
}
-fsync_exit:
free_xid(xid);
return rc;
}
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index 8ce5adbb1588..234835e70bb1 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -546,14 +546,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
return PTR_ERR(tlink);
tcon = tlink_tcon(tlink);
- if (tcon->ses->server->ops->query_all_EAs == NULL) {
- cifs_put_tlink(tlink);
- return -EOPNOTSUPP;
- }
-
- rc = smb2_query_eas(xid, tcon, path,
- "SETFILEBITS", ea_value, 4 /* size of buf */,
- cifs_sb);
+ rc = smb2_query_eas(xid, tcon, path, "SETFILEBITS", ea_value, 4 /* size of buf */, cifs_sb);
cifs_put_tlink(tlink);
if (rc < 0)
return (int)rc;
@@ -723,16 +716,10 @@ cifs_get_file_info(struct file *filp)
struct inode *inode = file_inode(filp);
struct cifsFileInfo *cfile = filp->private_data;
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
- struct TCP_Server_Info *server = tcon->ses->server;
struct dentry *dentry = filp->f_path.dentry;
void *page = alloc_dentry_path();
const unsigned char *path;
- if (!server->ops->query_file_info) {
- free_dentry_path(page);
- return -ENOSYS;
- }
-
xid = get_xid();
rc = smb2_query_file_info(xid, tcon, cfile, &data);
switch (rc) {
@@ -802,7 +789,6 @@ static void cifs_set_fattr_ino(int xid, struct cifs_tcon *tcon, struct super_blo
struct cifs_open_info_data *data, struct cifs_fattr *fattr)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
- struct TCP_Server_Info *server = tcon->ses->server;
int rc;
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
@@ -859,21 +845,18 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
const char *full_path,
struct cifs_fattr *fattr)
{
- struct TCP_Server_Info *server = tcon->ses->server;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct kvec rsp_iov, *iov = NULL;
int rsp_buftype = CIFS_NO_BUFFER;
u32 tag = data->reparse.tag;
int rc = 0;
- if (!tag && server->ops->query_reparse_point) {
- rc = smb2_query_reparse_point(xid, tcon, cifs_sb,
- full_path, &tag,
- &rsp_iov, &rsp_buftype);
+ if (!tag) {
+ rc = smb2_query_reparse_point(xid, tcon, cifs_sb, full_path, &tag, &rsp_iov,
+ &rsp_buftype);
if (!rc)
iov = &rsp_iov;
- } else if (data->reparse.io.buftype != CIFS_NO_BUFFER &&
- data->reparse.io.iov.iov_base) {
+ } else if (data->reparse.io.buftype != CIFS_NO_BUFFER && data->reparse.io.iov.iov_base) {
iov = &data->reparse.io.iov;
}
@@ -902,12 +885,10 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
goto out;
default:
/* Check for cached reparse point data */
- if (data->symlink_target || data->reparse.buf) {
+ if (data->symlink_target || data->reparse.buf)
rc = 0;
- } else if (iov && server->ops->parse_reparse_point) {
- rc = smb2_parse_reparse_point(cifs_sb,
- iov, data);
- }
+ else if (iov)
+ rc = smb2_parse_reparse_point(cifs_sb, iov, data);
break;
}
@@ -1360,17 +1341,11 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid,
const char *full_path, __u32 dosattr)
{
bool set_time = false;
- struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct TCP_Server_Info *server;
FILE_BASIC_INFO info_buf;
if (attrs == NULL)
return -EINVAL;
- server = cifs_sb_master_tcon(cifs_sb)->ses->server;
- if (!server->ops->set_file_info)
- return -ENOSYS;
-
info_buf.Pad = 0;
if (attrs->ia_valid & ATTR_ATIME) {
@@ -1470,14 +1445,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
cifs_close_deferred_file_under_dentry(tcon, full_path);
retry_std_delete:
- if (!server->ops->unlink) {
- rc = -ENOSYS;
- goto psx_del_no_retry;
- }
-
rc = smb2_unlink(xid, tcon, full_path, cifs_sb, dentry);
-
-psx_del_no_retry:
if (!rc) {
if (inode) {
cifs_mark_open_handles_for_deleted_file(inode, full_path);
@@ -1572,22 +1540,18 @@ cifs_mkdir_qinfo(struct inode *parent, struct dentry *dentry, umode_t mode,
if (parent->i_mode & S_ISGID)
mode |= S_ISGID;
- {
- struct TCP_Server_Info *server = tcon->ses->server;
- if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) &&
- (mode & S_IWUGO) == 0 && server->ops->mkdir_setinfo)
- smb2_mkdir_setinfo(inode, full_path, cifs_sb,
- tcon, xid);
- if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)
- inode->i_mode = (mode | S_IFDIR);
-
- if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
- inode->i_uid = current_fsuid();
- if (inode->i_mode & S_ISGID)
- inode->i_gid = parent->i_gid;
- else
- inode->i_gid = current_fsgid();
- }
+ if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) && (mode & S_IWUGO) == 0)
+ smb2_mkdir_setinfo(inode, full_path, cifs_sb, tcon, xid);
+
+ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)
+ inode->i_mode = (mode | S_IFDIR);
+
+ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+ inode->i_uid = current_fsuid();
+ if (inode->i_mode & S_ISGID)
+ inode->i_gid = parent->i_gid;
+ else
+ inode->i_gid = current_fsgid();
}
d_instantiate(dentry, inode);
return 0;
@@ -1635,12 +1599,6 @@ int cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
goto mkdir_out;
}
-
- if (!server->ops->mkdir) {
- rc = -ENOSYS;
- goto mkdir_out;
- }
-
/* BB add setting the equivalent of mode via CreateX w/ACLs */
rc = smb2_mkdir(xid, inode, mode, tcon, full_path, cifs_sb);
if (rc) {
@@ -1700,12 +1658,6 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
tcon = tlink_tcon(tlink);
server = tcon->ses->server;
- if (!server->ops->rmdir) {
- rc = -ENOSYS;
- cifs_put_tlink(tlink);
- goto rmdir_exit;
- }
-
if (tcon->nodelete) {
rc = -EACCES;
cifs_put_tlink(tlink);
@@ -1759,12 +1711,8 @@ cifs_do_rename(const unsigned int xid, struct dentry *from_dentry,
tcon = tlink_tcon(tlink);
server = tcon->ses->server;
- if (!server->ops->rename)
- return -ENOSYS;
-
/* try path-based rename first */
- rc = smb2_rename_path(xid, tcon, from_dentry,
- from_path, to_path, cifs_sb);
+ rc = smb2_rename_path(xid, tcon, from_dentry, from_path, to_path, cifs_sb);
/*
* Don't bother with rename by filehandle unless file is busy and
@@ -2156,7 +2104,6 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start,
struct cifsInodeInfo *cifs_i = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(cifs_i->netfs.inode.i_sb);
struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
- struct TCP_Server_Info *server = tcon->ses->server;
struct cifsFileInfo *cfile;
int rc;
@@ -2180,14 +2127,9 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start,
if (cfile == NULL)
return -EINVAL;
- if (server->ops->fiemap) {
- rc = smb3_fiemap(tcon, cfile, fei, start, len);
- cifsFileInfo_put(cfile);
- return rc;
- }
-
+ rc = smb3_fiemap(tcon, cfile, fei, start, len);
cifsFileInfo_put(cfile);
- return -EOPNOTSUPP;
+ return rc;
}
int cifs_truncate_page(struct address_space *mapping, loff_t from)
@@ -2245,11 +2187,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
if (open_file) {
tcon = tlink_tcon(open_file->tlink);
server = tcon->ses->server;
- if (server->ops->set_file_size)
- rc = smb2_set_file_size(xid, tcon, open_file,
- attrs->ia_size, false);
- else
- rc = -ENOSYS;
+ rc = smb2_set_file_size(xid, tcon, open_file, attrs->ia_size, false);
cifsFileInfo_put(open_file);
cifs_dbg(FYI, "SetFSize for attrs rc = %d\n", rc);
} else
@@ -2271,11 +2209,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
* valid, writeable file handle for it was found or because there was
* an error setting it by handle.
*/
- if (server->ops->set_path_size)
- rc = smb2_set_path_size(xid, tcon, full_path,
- attrs->ia_size, cifs_sb, false, dentry);
- else
- rc = -ENOSYS;
+ rc = smb2_set_path_size(xid, tcon, full_path, attrs->ia_size, cifs_sb, false, dentry);
cifs_dbg(FYI, "SetEOF by path (setattrs) rc = %d\n", rc);
if (tlink)
@@ -2403,8 +2337,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
goto cifs_setattr_exit;
}
}
- } else
- if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID))
+ } else if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID))
attrs->ia_valid &= ~(ATTR_UID | ATTR_GID);
/* skip mode change if it's just for clearing setuid/setgid */
@@ -2430,18 +2363,13 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
*/
if (mode != attrs->ia_mode)
attrs->ia_mode = mode;
- } else
- if (((mode & S_IWUGO) == 0) &&
- (cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
-
+ } else if (((mode & S_IWUGO) == 0) && (cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
dosattr = cifsInode->cifsAttrs | ATTR_READONLY;
/* fix up mode if we're not using dynperm */
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) == 0)
attrs->ia_mode = inode->i_mode & ~S_IWUGO;
- } else if ((mode & S_IWUGO) &&
- (cifsInode->cifsAttrs & ATTR_READONLY)) {
-
+ } else if ((mode & S_IWUGO) && (cifsInode->cifsAttrs & ATTR_READONLY)) {
dosattr = cifsInode->cifsAttrs & ~ATTR_READONLY;
/* Attributes of 0 are ignored */
if (dosattr == 0)
@@ -2451,11 +2379,9 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) {
attrs->ia_mode &= ~(S_IALLUGO);
if (S_ISDIR(inode->i_mode))
- attrs->ia_mode |=
- cifs_sb->ctx->dir_mode;
+ attrs->ia_mode |= cifs_sb->ctx->dir_mode;
else
- attrs->ia_mode |=
- cifs_sb->ctx->file_mode;
+ attrs->ia_mode |= cifs_sb->ctx->file_mode;
}
} else if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) {
/* ignore mode change - ATTR_READONLY hasn't changed */
diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c
index c15057c5de00..18078f23bdb1 100644
--- a/fs/smb/client/ioctl.c
+++ b/fs/smb/client/ioctl.c
@@ -54,14 +54,8 @@ static long cifs_ioctl_query_info(unsigned int xid, struct file *filep,
}
}
- if (tcon->ses->server->ops->ioctl_query_info)
- rc = smb2_ioctl_query_info(
- xid, tcon, cifs_sb, utf16_path,
- filep->private_data ? 0 : 1, p);
- else
- rc = -EOPNOTSUPP;
-
- ici_exit:
+ rc = smb2_ioctl_query_info( xid, tcon, cifs_sb, utf16_path, filep->private_data ? 0 : 1, p);
+ici_exit:
if (utf16_path != &root_path)
kfree(utf16_path);
free_dentry_path(page);
@@ -408,11 +402,8 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
break;
/* Try to set compress flag */
- if (tcon->ses->server->ops->set_compression) {
- rc = smb2_set_compression(
- xid, tcon, pSMBFile);
- cifs_dbg(FYI, "set compress flag rc %d\n", rc);
- }
+ rc = smb2_set_compression(xid, tcon, pSMBFile);
+ cifs_dbg(FYI, "set compress flag rc %d\n", rc);
break;
case CIFS_IOC_COPYCHUNK_FILE:
rc = cifs_ioctl_copychunk(xid, filep, arg);
@@ -455,11 +446,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
goto cifs_ioc_exit;
}
tcon = tlink_tcon(pSMBFile->tlink);
- if (tcon->ses->server->ops->enum_snapshots)
- rc = smb3_enum_snapshots(xid, tcon,
- pSMBFile, (void __user *)arg);
- else
- rc = -EOPNOTSUPP;
+ rc = smb3_enum_snapshots(xid, tcon, pSMBFile, (void __user *)arg);
break;
case CIFS_DUMP_KEY:
/*
@@ -533,13 +520,12 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
break;
}
tcon = tlink_tcon(tlink);
- if (tcon && tcon->ses->server->ops->notify) {
- rc = smb3_notify(xid,
- filep, (void __user *)arg,
- false /* no ret data */);
+ rc = -EOPNOTSUPP;
+ if (tcon) {
+ rc = smb3_notify(xid, filep, (void __user *)arg,
+ false /* no ret data */);
cifs_dbg(FYI, "ioctl notify rc %d\n", rc);
- } else
- rc = -EOPNOTSUPP;
+ }
cifs_put_tlink(tlink);
break;
case CIFS_IOC_NOTIFY_INFO:
@@ -555,13 +541,12 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
break;
}
tcon = tlink_tcon(tlink);
- if (tcon && tcon->ses->server->ops->notify) {
- rc = smb3_notify(xid,
- filep, (void __user *)arg,
- true /* return details */);
+ rc = -EOPNOTSUPP;
+ if (tcon) {
+ rc = smb3_notify(xid, filep, (void __user *)arg,
+ true /* return details */);
cifs_dbg(FYI, "ioctl notify info rc %d\n", rc);
- } else
- rc = -EOPNOTSUPP;
+ }
cifs_put_tlink(tlink);
break;
case CIFS_IOC_SHUTDOWN:
diff --git a/fs/smb/client/link.c b/fs/smb/client/link.c
index 6affff53f422..8f97b9089183 100644
--- a/fs/smb/client/link.c
+++ b/fs/smb/client/link.c
@@ -173,12 +173,7 @@ create_mf_symlink(const unsigned int xid, struct cifs_tcon *tcon,
if (rc)
goto out;
- if (tcon->ses->server->ops->create_mf_symlink)
- rc = smb3_create_mf_symlink(xid, tcon,
- cifs_sb, fromName, buf, &bytes_written);
- else
- rc = -EOPNOTSUPP;
-
+ rc = smb3_create_mf_symlink(xid, tcon, cifs_sb, fromName, buf, &bytes_written);
if (rc)
goto out;
@@ -208,12 +203,7 @@ check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
if (!buf)
return -ENOMEM;
- if (tcon->ses->server->ops->query_mf_symlink)
- rc = smb3_query_mf_symlink(xid, tcon,
- cifs_sb, path, buf, &bytes_read);
- else
- rc = -ENOSYS;
-
+ rc = smb3_query_mf_symlink(xid, tcon, cifs_sb, path, buf, &bytes_read);
if (rc)
goto out;
@@ -412,12 +402,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
{
server = tcon->ses->server;
- if (!server->ops->create_hardlink) {
- rc = -ENOSYS;
- goto cifs_hl_exit;
- }
- rc = smb2_create_hardlink(xid, tcon, old_file,
- from_name, to_name, cifs_sb);
+ rc = smb2_create_hardlink(xid, tcon, old_file, from_name, to_name, cifs_sb);
if ((rc == -EIO) || (rc == -EINVAL))
rc = -EOPNOTSUPP;
}
@@ -512,10 +497,8 @@ cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,
/* BB what if DFS and this volume is on different share? BB */
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
rc = create_mf_symlink(xid, pTcon, cifs_sb, full_path, symname);
- } else if (server->ops->create_reparse_symlink) {
- rc = smb2_create_reparse_symlink(xid, inode, direntry,
- pTcon, full_path,
- symname);
+ } else {
+ rc = smb2_create_reparse_symlink(xid, inode, direntry, pTcon, full_path, symname);
goto symlink_exit;
}
diff --git a/fs/smb/client/misc.c b/fs/smb/client/misc.c
index 10eecdc0e10d..24959b13558e 100644
--- a/fs/smb/client/misc.c
+++ b/fs/smb/client/misc.c
@@ -24,6 +24,7 @@
#endif
#include "fs_context.h"
#include "cached_dir.h"
+#include "smb2proto.h"
/* The xid serves as a useful identifier for each incoming vfs request,
in a similar way to the mid which is useful to track each sent smb,
@@ -1005,10 +1006,8 @@ int cifs_inval_name_dfs_link_error(const unsigned int xid,
* need during failover.
*/
ses = CIFS_DFS_ROOT_SES(ses);
- if (ses->server->ops->get_dfs_refer &&
- !smb2_get_dfs_refer(xid, ses, ref_path, &refs,
- &num_refs, cifs_sb->local_nls,
- cifs_remap(cifs_sb)))
+ if (!smb2_get_dfs_refer(xid, ses, ref_path, &refs, &num_refs, cifs_sb->local_nls,
+ cifs_remap(cifs_sb)))
*islink = refs[0].server_type == DFS_TYPE_LINK;
free_dfs_info_array(refs, num_refs);
kfree(ref_path);
diff --git a/fs/smb/client/readdir.c b/fs/smb/client/readdir.c
index 5383387b6368..5c0d002fe8cb 100644
--- a/fs/smb/client/readdir.c
+++ b/fs/smb/client/readdir.c
@@ -359,12 +359,6 @@ _initiate_cifs_search(const unsigned int xid, struct file *file,
}
server = tcon->ses->server;
-
- if (!server->ops->query_dir_first) {
- rc = -ENOSYS;
- goto error_exit;
- }
-
cifsFile->invalidHandle = true;
cifsFile->srch_inf.endOfSearch = false;
@@ -378,27 +372,23 @@ ffirst_retry:
cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX;
else if (tcon->posix_extensions)
cifsFile->srch_inf.info_level = SMB_FIND_FILE_POSIX_INFO;
- else if ((tcon->ses->capabilities &
- tcon->ses->server->vals->cap_nt_find) == 0) {
+ else if ((tcon->ses->capabilities & server->vals->cap_nt_find) == 0)
cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD;
- } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
+ else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
cifsFile->srch_inf.info_level = SMB_FIND_FILE_ID_FULL_DIR_INFO;
- } else /* not srvinos - BB fixme add check for backlevel? */ {
+ else
+ /* not srvinos - BB fixme add check for backlevel? */
cifsFile->srch_inf.info_level = SMB_FIND_FILE_FULL_DIRECTORY_INFO;
- }
search_flags = CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME;
if (backup_cred(cifs_sb))
search_flags |= CIFS_SEARCH_BACKUP_SEARCH;
- rc = smb2_query_dir_first(xid, tcon, full_path, cifs_sb,
- &cifsFile->fid, search_flags,
- &cifsFile->srch_inf);
-
+ rc = smb2_query_dir_first(xid, tcon, full_path, cifs_sb, &cifsFile->fid, search_flags,
+ &cifsFile->srch_inf);
if (rc == 0) {
cifsFile->invalidHandle = false;
- } else if ((rc == -EOPNOTSUPP) &&
- (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
+ } else if ((rc == -EOPNOTSUPP) && (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
goto ffirst_retry;
}
@@ -677,12 +667,8 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos,
loff_t index_to_find = pos;
struct cifsFileInfo *cfile = file->private_data;
struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
- struct TCP_Server_Info *server = tcon->ses->server;
/* check if index in the buffer */
- if (!server->ops->query_dir_first || !server->ops->query_dir_next)
- return -ENOSYS;
-
if ((cfile == NULL) || (current_entry == NULL) || (num_to_ret == NULL))
return -ENOENT;
@@ -707,18 +693,16 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos,
if (smb2_dir_needs_close(cfile)) {
cfile->invalidHandle = true;
spin_unlock(&cfile->file_info_lock);
- if (server->ops->close_dir)
- smb2_close_dir(xid, tcon, &cfile->fid);
- } else
+ smb2_close_dir(xid, tcon, &cfile->fid);
+ } else {
spin_unlock(&cfile->file_info_lock);
+ }
if (cfile->srch_inf.ntwrk_buf_start) {
cifs_dbg(FYI, "freeing SMB ff cache buf on search rewind\n");
if (cfile->srch_inf.smallBuf)
- cifs_small_buf_release(cfile->srch_inf.
- ntwrk_buf_start);
+ cifs_small_buf_release(cfile->srch_inf.ntwrk_buf_start);
else
- cifs_buf_release(cfile->srch_inf.
- ntwrk_buf_start);
+ cifs_buf_release(cfile->srch_inf.ntwrk_buf_start);
cfile->srch_inf.ntwrk_buf_start = NULL;
}
rc = initiate_cifs_search(xid, file, full_path);
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 510d42b57265..83a5c2c164f0 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -242,7 +242,7 @@ replay_again:
*/
if (dentry) {
inode = d_inode(dentry);
- if (CIFS_I(inode)->lease_granted && server->ops->get_lease_key) {
+ if (CIFS_I(inode)->lease_granted) {
oplock = SMB2_OPLOCK_LEVEL_LEASE;
smb2_get_lease_key(inode, &fid);
}
@@ -1161,9 +1161,9 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
}
int
-smb2_set_file_info(struct inode *inode, const char *full_path,
- FILE_BASIC_INFO *buf, const unsigned int xid)
+smb2_set_file_info(struct inode *inode, const char *full_path, void *info_buf, const unsigned int xid)
{
+ FILE_BASIC_INFO *buf = info_buf;
struct cifs_open_parms oparms;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink;
diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
index 6d009cf5d571..7b834fcf96c9 100644
--- a/fs/smb/client/smb2ops.c
+++ b/fs/smb/client/smb2ops.c
@@ -64,7 +64,7 @@ change_conf(struct TCP_Server_Info *server)
return server->credits + server->echo_credits + server->oplock_credits;
}
-static void
+void
smb2_add_credits(struct TCP_Server_Info *server,
struct cifs_credits *credits, const int optype)
{
@@ -180,8 +180,7 @@ smb2_add_credits(struct TCP_Server_Info *server,
cifs_dbg(FYI, "%s: added %u credits total=%d\n", __func__, add, scredits);
}
-static void
-smb2_set_credits(struct TCP_Server_Info *server, const int val)
+void smb2_set_credits(struct TCP_Server_Info *server, const int val)
{
int scredits, in_flight;
@@ -211,8 +210,7 @@ smb2_set_credits(struct TCP_Server_Info *server, const int val)
cifs_dbg(FYI, "set credits to 1 due to smb2 reconnect\n");
}
-static int *
-smb2_get_credits_field(struct TCP_Server_Info *server, const int optype)
+int *smb2_get_credits_field(struct TCP_Server_Info *server, const int optype)
{
switch (optype) {
case CIFS_ECHO_OP:
@@ -224,14 +222,12 @@ smb2_get_credits_field(struct TCP_Server_Info *server, const int optype)
}
}
-static unsigned int
-smb2_get_credits(struct mid_q_entry *mid)
+unsigned int smb2_get_credits(struct mid_q_entry *mid)
{
return mid->credits_received;
}
-static int
-smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
+int smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
size_t *num, struct cifs_credits *credits)
{
int rc = 0;
@@ -295,7 +291,7 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
return rc;
}
-static int
+int
smb2_adjust_credits(struct TCP_Server_Info *server,
struct cifs_io_subrequest *subreq,
unsigned int /*enum smb3_rw_credits_trace*/ trace)
@@ -367,26 +363,6 @@ smb2_adjust_credits(struct TCP_Server_Info *server,
return 0;
}
-static __u64
-smb2_get_next_mid(struct TCP_Server_Info *server)
-{
- __u64 mid;
- /* for SMB2 we need the current value */
- spin_lock(&server->mid_lock);
- mid = server->CurrentMid++;
- spin_unlock(&server->mid_lock);
- return mid;
-}
-
-static void
-smb2_revert_current_mid(struct TCP_Server_Info *server, const unsigned int val)
-{
- spin_lock(&server->mid_lock);
- if (server->CurrentMid >= val)
- server->CurrentMid -= val;
- spin_unlock(&server->mid_lock);
-}
-
static struct mid_q_entry *
__smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue)
{
@@ -417,7 +393,7 @@ __smb2_find_mid(struct TCP_Server_Info *server, char *buf, bool dequeue)
return NULL;
}
-static struct mid_q_entry *
+struct mid_q_entry *
smb2_find_mid(struct TCP_Server_Info *server, char *buf)
{
return __smb2_find_mid(server, buf, false);
@@ -429,8 +405,7 @@ smb2_find_dequeue_mid(struct TCP_Server_Info *server, char *buf)
return __smb2_find_mid(server, buf, true);
}
-static void
-smb2_dump_detail(void *buf, struct TCP_Server_Info *server)
+void smb2_dump_detail(void *buf, struct TCP_Server_Info *server)
{
#ifdef CONFIG_CIFS_DEBUG2
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
@@ -445,16 +420,12 @@ smb2_dump_detail(void *buf, struct TCP_Server_Info *server)
#endif
}
-static bool
-smb2_need_neg(struct TCP_Server_Info *server)
+bool smb2_need_neg(struct TCP_Server_Info *server)
{
return server->max_read == 0;
}
-static int
-smb2_negotiate(const unsigned int xid,
- struct cifs_ses *ses,
- struct TCP_Server_Info *server)
+int smb2_negotiate(const unsigned int xid, struct cifs_ses *ses, struct TCP_Server_Info *server)
{
int rc;
@@ -912,9 +883,8 @@ smb2_qfs_tcon(const unsigned int xid, struct cifs_tcon *tcon,
SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid);
}
-static int
-smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb, const char *full_path)
+int smb2_is_path_accessible(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb, const char *full_path)
{
__le16 *utf16_path;
__u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
@@ -980,7 +950,7 @@ out:
return rc;
}
-static int smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
+int smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb, const char *full_path,
u64 *uniqueid, struct cifs_open_info_data *data)
{
@@ -988,8 +958,8 @@ static int smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
return 0;
}
-static int smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifsFileInfo *cfile, struct cifs_open_info_data *data)
+int smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifsFileInfo *cfile, struct cifs_open_info_data *data)
{
struct cifs_fid *fid = &cfile->fid;
@@ -1086,8 +1056,7 @@ out:
return (ssize_t)rc;
}
-static ssize_t
-smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
+ssize_t smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
const unsigned char *path, const unsigned char *ea_name,
char *ea_data, size_t buf_size,
struct cifs_sb_info *cifs_sb)
@@ -1135,7 +1104,7 @@ smb2_query_eas(const unsigned int xid, struct cifs_tcon *tcon,
return rc;
}
-static int
+int
smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
const char *path, const char *ea_name, const void *ea_value,
const __u16 ea_value_len, const struct nls_table *nls_codepage,
@@ -1187,45 +1156,38 @@ replay_again:
rqst = vars->rqst;
rsp_iov = vars->rsp_iov;
- if (ses->server->ops->query_all_EAs) {
- if (!ea_value) {
- rc = smb2_query_eas(xid, tcon, path,
- ea_name, NULL, 0,
- cifs_sb);
- if (rc == -ENODATA)
- goto sea_exit;
- } else {
- /* If we are adding a attribute we should first check
- * if there will be enough space available to store
- * the new EA. If not we should not add it since we
- * would not be able to even read the EAs back.
- */
- rc = smb2_query_info_compound(xid, tcon, path,
- FILE_READ_EA,
- FILE_FULL_EA_INFORMATION,
- SMB2_O_INFO_FILE,
- CIFSMaxBufSize -
- MAX_SMB2_CREATE_RESPONSE_SIZE -
- MAX_SMB2_CLOSE_RESPONSE_SIZE,
- &rsp_iov[1], &resp_buftype[1], cifs_sb);
- if (rc == 0) {
- rsp = (struct smb2_query_info_rsp *)rsp_iov[1].iov_base;
- used_len = le32_to_cpu(rsp->OutputBufferLength);
- }
- free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
- resp_buftype[1] = CIFS_NO_BUFFER;
- memset(&rsp_iov[1], 0, sizeof(rsp_iov[1]));
- rc = 0;
+ if (!ea_value) {
+ rc = smb2_query_eas(xid, tcon, path, ea_name, NULL, 0, cifs_sb);
+ if (rc == -ENODATA)
+ goto sea_exit;
+ } else {
+ /* If we are adding a attribute we should first check
+ * if there will be enough space available to store
+ * the new EA. If not we should not add it since we
+ * would not be able to even read the EAs back.
+ */
+ rc = smb2_query_info_compound(xid, tcon, path, FILE_READ_EA,
+ FILE_FULL_EA_INFORMATION, SMB2_O_INFO_FILE,
+ CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
+ MAX_SMB2_CLOSE_RESPONSE_SIZE,
+ &rsp_iov[1], &resp_buftype[1], cifs_sb);
+ if (rc == 0) {
+ rsp = (struct smb2_query_info_rsp *)rsp_iov[1].iov_base;
+ used_len = le32_to_cpu(rsp->OutputBufferLength);
+ }
+ free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
+ resp_buftype[1] = CIFS_NO_BUFFER;
+ memset(&rsp_iov[1], 0, sizeof(rsp_iov[1]));
+ rc = 0;
- /* Use a fudge factor of 256 bytes in case we collide
- * with a different set_EAs command.
- */
- if (CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
- MAX_SMB2_CLOSE_RESPONSE_SIZE - 256 <
- used_len + ea_name_len + ea_value_len + 1) {
- rc = -ENOSPC;
- goto sea_exit;
- }
+ /* Use a fudge factor of 256 bytes in case we collide
+ * with a different set_EAs command.
+ */
+ if (CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
+ MAX_SMB2_CLOSE_RESPONSE_SIZE - 256 < used_len + ea_name_len +
+ ea_value_len + 1) {
+ rc = -ENOSPC;
+ goto sea_exit;
}
}
@@ -1319,14 +1281,12 @@ out_free_path:
}
#endif
-static bool
-smb2_can_echo(struct TCP_Server_Info *server)
+bool smb2_can_echo(struct TCP_Server_Info *server)
{
return server->echoes;
}
-static void
-smb2_clear_stats(struct cifs_tcon *tcon)
+void smb2_clear_stats(struct cifs_tcon *tcon)
{
int i;
@@ -1369,8 +1329,7 @@ smb2_dump_share_caps(struct seq_file *m, struct cifs_tcon *tcon)
seq_printf(m, "\tMaximal Access: 0x%x", tcon->maximal_access);
}
-static void
-smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
+void smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
{
atomic_t *sent = tcon->stats.smb2_stats.smb2_com_sent;
atomic_t *failed = tcon->stats.smb2_stats.smb2_com_failed;
@@ -1429,8 +1388,7 @@ smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
atomic_read(&failed[SMB2_OPLOCK_BREAK_HE]));
}
-static void
-smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
+void smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
{
struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server;
@@ -1447,9 +1405,7 @@ smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
memcpy(cfile->fid.create_guid, fid->create_guid, 16);
}
-static int
-smb2_close_file(const unsigned int xid, struct cifs_tcon *tcon,
- struct cifs_fid *fid)
+int smb2_close_file(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *fid)
{
return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
}
@@ -1529,12 +1485,8 @@ req_res_key_exit:
return rc;
}
-static int
-smb2_ioctl_query_info(const unsigned int xid,
- struct cifs_tcon *tcon,
- struct cifs_sb_info *cifs_sb,
- __le16 *path, int is_dir,
- unsigned long p)
+int smb2_ioctl_query_info(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb, __le16 *path, int is_dir, unsigned long p)
{
struct smb2_compound_vars *vars;
struct smb_rqst *rqst;
@@ -1779,7 +1731,7 @@ free_vars:
return rc;
}
-static ssize_t
+ssize_t
smb2_copychunk_range(const unsigned int xid,
struct cifsFileInfo *srcfile,
struct cifsFileInfo *trgtfile, u64 src_off,
@@ -1915,23 +1867,20 @@ cchunk_out:
return total_bytes_written;
}
-static int
-smb2_flush_file(const unsigned int xid, struct cifs_tcon *tcon,
+int smb2_flush_file(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_fid *fid)
{
return SMB2_flush(xid, tcon, fid->persistent_fid, fid->volatile_fid);
}
-static unsigned int
-smb2_read_data_offset(char *buf)
+unsigned int smb2_read_data_offset(char *buf)
{
struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
return rsp->DataOffset;
}
-static unsigned int
-smb2_read_data_length(char *buf, bool in_remaining)
+unsigned int smb2_read_data_length(char *buf, bool in_remaining)
{
struct smb2_read_rsp *rsp = (struct smb2_read_rsp *)buf;
@@ -1941,9 +1890,7 @@ smb2_read_data_length(char *buf, bool in_remaining)
return le32_to_cpu(rsp->DataLength);
}
-
-static int
-smb2_sync_read(const unsigned int xid, struct cifs_fid *pfid,
+int smb2_sync_read(const unsigned int xid, struct cifs_fid *pfid,
struct cifs_io_parms *parms, unsigned int *bytes_read,
char **buf, int *buf_type)
{
@@ -1952,8 +1899,7 @@ smb2_sync_read(const unsigned int xid, struct cifs_fid *pfid,
return SMB2_read(xid, parms, bytes_read, buf, buf_type);
}
-static int
-smb2_sync_write(const unsigned int xid, struct cifs_fid *pfid,
+int smb2_sync_write(const unsigned int xid, struct cifs_fid *pfid,
struct cifs_io_parms *parms, unsigned int *written,
struct kvec *iov, unsigned long nr_segs)
{
@@ -2009,8 +1955,7 @@ static bool smb2_set_sparse(const unsigned int xid, struct cifs_tcon *tcon,
return true;
}
-static int
-smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
+int smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *cfile, __u64 size, bool set_alloc)
{
struct inode *inode;
@@ -2099,8 +2044,7 @@ duplicate_extents_out:
return rc;
}
-static int
-smb2_set_compression(const unsigned int xid, struct cifs_tcon *tcon,
+int smb2_set_compression(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *cfile)
{
return SMB2_set_compression(xid, tcon, cfile->fid.persistent_fid,
@@ -2137,8 +2081,7 @@ smb3_set_integrity(const unsigned int xid, struct cifs_tcon *tcon,
* Input buffer contains (empty) struct smb_snapshot array with size filled in
* For output see struct SRV_SNAPSHOT_ARRAY in MS-SMB2 section 2.2.32.2
*/
-static int
-smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
+int smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *cfile, void __user *ioc_buf)
{
char *retbuf = NULL;
@@ -2219,10 +2162,7 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
return rc;
}
-
-
-static int
-smb3_notify(const unsigned int xid, struct file *pfile,
+int smb3_notify(const unsigned int xid, struct file *pfile,
void __user *ioc_buf, bool return_changes)
{
struct smb3_notify_info notify;
@@ -2304,8 +2244,7 @@ notify_exit:
return rc;
}
-static int
-smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
+int smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
const char *path, struct cifs_sb_info *cifs_sb,
struct cifs_fid *fid, __u16 search_flags,
struct cifs_search_info *srch_inf)
@@ -2443,8 +2382,7 @@ replay_again:
return rc;
}
-static int
-smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon,
+int smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_fid *fid, __u16 search_flags,
struct cifs_search_info *srch_inf)
{
@@ -2452,8 +2390,7 @@ smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon,
fid->volatile_fid, 0, srch_inf);
}
-static int
-smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon,
+int smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_fid *fid)
{
return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
@@ -2463,8 +2400,7 @@ smb2_close_dir(const unsigned int xid, struct cifs_tcon *tcon,
* If we negotiate SMB2 protocol and get STATUS_PENDING - update
* the number of credits and return true. Otherwise - return false.
*/
-static bool
-smb2_is_status_pending(char *buf, struct TCP_Server_Info *server)
+bool smb2_is_status_pending(char *buf, struct TCP_Server_Info *server)
{
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
int scredits, in_flight;
@@ -2490,8 +2426,7 @@ smb2_is_status_pending(char *buf, struct TCP_Server_Info *server)
return true;
}
-static bool
-smb2_is_session_expired(char *buf)
+bool smb2_is_session_expired(char *buf)
{
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
@@ -2508,8 +2443,7 @@ smb2_is_session_expired(char *buf)
return true;
}
-static bool
-smb2_is_status_io_timeout(char *buf)
+bool smb2_is_status_io_timeout(char *buf)
{
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
@@ -2519,8 +2453,7 @@ smb2_is_status_io_timeout(char *buf)
return false;
}
-static bool
-smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
+bool smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
{
struct smb2_hdr *shdr = (struct smb2_hdr *)buf;
struct TCP_Server_Info *pserver;
@@ -2554,8 +2487,7 @@ smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *server)
return false;
}
-static int
-smb2_oplock_response(struct cifs_tcon *tcon, __u64 persistent_fid,
+int smb2_oplock_response(struct cifs_tcon *tcon, __u64 persistent_fid,
__u64 volatile_fid, __u16 net_fid, struct cifsInodeInfo *cinode)
{
if (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LEASING)
@@ -2911,15 +2843,13 @@ smb311_queryfs(const unsigned int xid, struct cifs_tcon *tcon,
return rc;
}
-static bool
-smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2)
+bool smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2)
{
return ob1->fid.persistent_fid == ob2->fid.persistent_fid &&
ob1->fid.volatile_fid == ob2->fid.volatile_fid;
}
-static int
-smb2_mand_lock(const unsigned int xid, struct cifsFileInfo *cfile, __u64 offset,
+int smb2_mand_lock(const unsigned int xid, struct cifsFileInfo *cfile, __u64 offset,
__u64 length, __u32 type, int lock, int unlock, bool wait)
{
if (unlock && !lock)
@@ -2929,26 +2859,22 @@ smb2_mand_lock(const unsigned int xid, struct cifsFileInfo *cfile, __u64 offset,
current->tgid, length, offset, type, wait);
}
-static void
-smb2_get_lease_key(struct inode *inode, struct cifs_fid *fid)
+void smb2_get_lease_key(struct inode *inode, struct cifs_fid *fid)
{
memcpy(fid->lease_key, CIFS_I(inode)->lease_key, SMB2_LEASE_KEY_SIZE);
}
-static void
-smb2_set_lease_key(struct inode *inode, struct cifs_fid *fid)
+void smb2_set_lease_key(struct inode *inode, struct cifs_fid *fid)
{
memcpy(CIFS_I(inode)->lease_key, fid->lease_key, SMB2_LEASE_KEY_SIZE);
}
-static void
-smb2_new_lease_key(struct cifs_fid *fid)
+void smb2_new_lease_key(struct cifs_fid *fid)
{
generate_random_uuid(fid->lease_key);
}
-static int
-smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
+int smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
const char *search_name,
struct dfs_info3_param **target_nodes,
unsigned int *num_of_nodes,
@@ -3054,8 +2980,7 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
return rc;
}
-static struct cifs_ntsd *
-get_smb2_acl_by_fid(struct cifs_sb_info *cifs_sb,
+struct cifs_ntsd *get_smb2_acl_by_fid(struct cifs_sb_info *cifs_sb,
const struct cifs_fid *cifsfid, u32 *pacllen, u32 info)
{
struct cifs_ntsd *pntsd = NULL;
@@ -3149,8 +3074,7 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
return pntsd;
}
-static int
-set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
+int set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
struct inode *inode, const char *path, int aclflag)
{
u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
@@ -3208,8 +3132,7 @@ set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
}
/* Retrieve an ACL from the server */
-static struct cifs_ntsd *
-get_smb2_acl(struct cifs_sb_info *cifs_sb,
+struct cifs_ntsd *get_smb2_acl(struct cifs_sb_info *cifs_sb,
struct inode *inode, const char *path,
u32 *pacllen, u32 info)
{
@@ -3744,7 +3667,7 @@ out_2:
return rc;
}
-static loff_t smb3_llseek(struct file *file, struct cifs_tcon *tcon, loff_t offset, int whence)
+loff_t smb3_llseek(struct file *file, struct cifs_tcon *tcon, loff_t offset, int whence)
{
struct cifsFileInfo *wrcfile, *cfile = file->private_data;
struct cifsInodeInfo *cifsi;
@@ -3828,7 +3751,7 @@ static loff_t smb3_llseek(struct file *file, struct cifs_tcon *tcon, loff_t offs
return rc;
}
-static int smb3_fiemap(struct cifs_tcon *tcon,
+int smb3_fiemap(struct cifs_tcon *tcon,
struct cifsFileInfo *cfile,
struct fiemap_extent_info *fei, u64 start, u64 len)
{
@@ -4058,8 +3981,7 @@ smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
}
-static bool
-smb21_is_read_op(__u32 oplock)
+bool smb21_is_read_op(__u32 oplock)
{
return (oplock & SMB2_LEASE_READ_CACHING_HE) &&
!(oplock & SMB2_LEASE_WRITE_CACHING_HE);
@@ -4154,15 +4076,13 @@ smb3_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key)
return le32_to_cpu(lc->lcontext.LeaseState);
}
-static unsigned int
-smb2_wp_retry_size(struct inode *inode)
+unsigned int smb2_wp_retry_size(struct inode *inode)
{
return min_t(unsigned int, CIFS_SB(inode->i_sb)->ctx->wsize,
SMB2_MAX_BUFFER_SIZE);
}
-static bool
-smb2_dir_needs_close(struct cifsFileInfo *cfile)
+bool smb2_dir_needs_close(struct cifsFileInfo *cfile)
{
return !cfile->invalidHandle;
}
@@ -4594,15 +4514,13 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
return -EOPNOTSUPP;
}
- if (server->ops->is_session_expired &&
- smb2_is_session_expired(buf)) {
+ if (smb2_is_session_expired(buf)) {
if (!is_offloaded)
cifs_reconnect(server, true);
return -1;
}
- if (server->ops->is_status_pending &&
- smb2_is_status_pending(buf, server))
+ if (smb2_is_status_pending(buf, server))
return -1;
/* set up first two iov to get credits */
@@ -4889,12 +4807,8 @@ receive_encrypted_read(struct TCP_Server_Info *server, struct mid_q_entry **mid,
rc = handle_read_data(server, *mid, buf,
server->vals->read_rsp_size,
&dw->buffer, dw->len, false);
- if (rc >= 0) {
- if (server->ops->is_network_name_deleted) {
- smb2_is_network_name_deleted(buf,
- server);
- }
- }
+ if (rc >= 0)
+ smb2_is_network_name_deleted(buf, server);
}
free_pages:
@@ -5042,8 +4956,7 @@ smb3_handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid)
NULL, 0, false);
}
-static int smb2_next_header(struct TCP_Server_Info *server, char *buf,
- unsigned int *noff)
+int smb2_next_header(struct TCP_Server_Info *server, char *buf, unsigned int *noff)
{
struct smb2_hdr *hdr = (struct smb2_hdr *)buf;
struct smb2_transform_hdr *t_hdr = (struct smb2_transform_hdr *)buf;
@@ -5144,7 +5057,7 @@ int cifs_sfu_make_node(unsigned int xid, struct inode *inode,
return rc;
}
-static int smb2_make_node(unsigned int xid, struct inode *inode,
+int smb2_make_node(unsigned int xid, struct inode *inode,
struct dentry *dentry, struct cifs_tcon *tcon,
const char *full_path, umode_t mode, dev_t dev)
{
@@ -5175,7 +5088,6 @@ struct smb_version_operations smb21_operations = {
.qfs_tcon = smb2_qfs_tcon,
.queryfs = smb2_queryfs,
.calc_signature = smb2_calc_signature,
- .is_read_op = smb21_is_read_op,
.set_oplock_level = smb21_set_oplock_level,
.create_lease_buf = smb2_create_lease_buf,
.parse_lease_buf = smb2_parse_lease_buf,
@@ -5194,7 +5106,6 @@ struct smb_version_operations smb30_operations = {
.generate_signingkey = generate_smb30signingkey,
.calc_signature = smb3_calc_signature,
.set_integrity = smb3_set_integrity,
- .is_read_op = smb21_is_read_op,
.set_oplock_level = smb3_set_oplock_level,
.create_lease_buf = smb3_create_lease_buf,
.parse_lease_buf = smb3_parse_lease_buf,
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index fc1ee6f263f8..ecd31baa8c6c 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -424,8 +424,7 @@ skip_sess_setup:
ses->flags |= CIFS_SES_FLAG_SCALE_CHANNELS;
spin_unlock(&ses->ses_lock);
- if (!rc &&
- (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL) &&
+ if (!rc && (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL) &&
server->ops->query_server_interfaces) {
mutex_unlock(&ses->session_mutex);
@@ -4097,7 +4096,7 @@ smb2_echo_callback(struct mid_q_entry *mid)
}
release_mid(mid);
- add_credits(server, &credits, CIFS_ECHO_OP);
+ smb2_add_credits(server, &credits, CIFS_ECHO_OP);
}
void smb2_reconnect_server(struct work_struct *work)
@@ -4248,8 +4247,7 @@ SMB2_echo(struct TCP_Server_Info *server)
cifs_dbg(FYI, "In echo request for conn_id %lld\n", server->conn_id);
spin_lock(&server->srv_lock);
- if (server->ops->need_neg &&
- smb2_need_neg(server)) {
+ if (smb2_need_neg(server)) {
spin_unlock(&server->srv_lock);
/* No need to send echo on newly established connections */
mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
@@ -4624,7 +4622,7 @@ smb2_readv_callback(struct mid_q_entry *mid)
trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, 0,
server->credits, server->in_flight,
credits.value, cifs_trace_rw_credits_read_response_add);
- add_credits(server, &credits, 0);
+ smb2_add_credits(server, &credits, 0);
}
/* smb2_async_readv - send an async read, and set up mid to handle result */
@@ -4683,7 +4681,7 @@ smb2_async_readv(struct cifs_io_subrequest *rdata)
min_t(int, server->max_credits -
server->credits, credit_request));
- rc = adjust_credits(server, rdata, cifs_trace_rw_credits_call_readv_adjust);
+ rc = smb2_adjust_credits(server, rdata, cifs_trace_rw_credits_call_readv_adjust);
if (rc)
goto async_readv_out;
@@ -4889,7 +4887,7 @@ smb2_writev_callback(struct mid_q_entry *mid)
trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, 0,
server->credits, server->in_flight,
credits.value, cifs_trace_rw_credits_write_response_add);
- add_credits(server, &credits, 0);
+ smb2_add_credits(server, &credits, 0);
}
/* smb2_async_writev - send an async write, and set up mid to handle result */
@@ -5017,7 +5015,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
min_t(int, server->max_credits -
server->credits, credit_request));
- rc = adjust_credits(server, wdata, cifs_trace_rw_credits_call_writev_adjust);
+ rc = smb2_adjust_credits(server, wdata, cifs_trace_rw_credits_call_writev_adjust);
if (rc)
goto async_writev_out;
diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h
index 5e0855fefcfe..dca7399e0577 100644
--- a/fs/smb/client/smb2proto.h
+++ b/fs/smb/client/smb2proto.h
@@ -12,8 +12,40 @@
#include <linux/nls.h>
#include <linux/key-type.h>
+struct dentry;
struct statfs;
+struct kstatfs;
+struct fiemap_extent_info;
+struct kvec;
+struct file_lock;
+struct work_struct;
+struct super_block;
+
+struct smb2_hdr;
struct smb_rqst;
+struct mid_q_entry;
+struct TCP_Server_Info;
+struct cifs_ses;
+struct cifs_credits;
+struct cifs_io_subrequest;
+struct cifs_sb_info;
+struct cifsFileInfo;
+struct cifs_fid;
+struct cifs_open_info_data;
+struct cifsInodeInfo;
+struct cifs_io_parms;
+struct cifs_open_parms;
+struct cifs_search_info;
+struct dfs_info3_param;
+struct smb2_fs_full_size_info;
+struct smb2_posix_info_parsed;
+struct smb2_file_all_info;
+struct smb2_file_full_ea_info;
+struct smb2_lock_element;
+struct create_posix_rsp;
+struct cifs_ntsd;
+struct smb2_file_network_open_info;
+struct smb311_posix_qinfo;
/*
*****************************************************************
@@ -80,7 +112,7 @@ extern int smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
struct cifs_sb_info *cifs_sb, bool set_alloc,
struct dentry *dentry);
extern int smb2_set_file_info(struct inode *inode, const char *full_path,
- FILE_BASIC_INFO *buf, const unsigned int xid);
+ void *info_buf, const unsigned int xid);
extern int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
umode_t mode, struct cifs_tcon *tcon,
const char *full_path,
@@ -116,6 +148,7 @@ extern int smb3_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
int smb2_parse_symlink_response(struct cifs_sb_info *cifs_sb, const struct kvec *iov, char **path);
int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32 *oplock,
void *buf);
+extern int smb2_close_file(const unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *fid);
extern int smb2_unlock_range(struct cifsFileInfo *cfile,
struct file_lock *flock, const unsigned int xid);
extern int smb2_push_mandatory_locks(struct cifsFileInfo *cfile);
@@ -318,4 +351,172 @@ int smb2_make_nfs_node(unsigned int xid, struct inode *inode,
struct dentry *dentry, struct cifs_tcon *tcon,
const char *full_path, umode_t mode, dev_t dev);
+extern struct mid_q_entry * smb2_find_mid(struct TCP_Server_Info *, char *);
+extern void smb2_dump_detail(void *buf, struct TCP_Server_Info *ptcp_info);
+extern void clear_stats(struct cifs_tcon *);
+extern void smb2_print_stats(struct seq_file *m, struct cifs_tcon *);
+extern bool smb2_is_valid_oplock_break(char *, struct TCP_Server_Info *);
+extern int smb2_handle_cancelled_mid(struct mid_q_entry *, struct TCP_Server_Info *);
+extern bool smb2_need_neg(struct TCP_Server_Info *);
+extern int smb2_negotiate(const unsigned int xid,
+ struct cifs_ses *ses,
+ struct TCP_Server_Info *server);
+
+extern int smb2_get_dfs_refer(const unsigned int, struct cifs_ses *,
+ const char *, struct dfs_info3_param **,
+ unsigned int *, const struct nls_table *, int);
+extern int smb2_is_path_accessible(const unsigned int, struct cifs_tcon *,
+ struct cifs_sb_info *, const char *);
+extern int smb2_query_path_info(const unsigned int xid,
+ struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb,
+ const char *full_path,
+ struct cifs_open_info_data *data);
+extern int smb2_query_reparse_point(const unsigned int xid,
+ struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb,
+ const char *full_path,
+ u32 *tag, struct kvec *rsp,
+ int *rsp_buftype);
+extern int smb2_get_srv_inum(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb, const char *full_path, u64 *uniqueid,
+ struct cifs_open_info_data *data);
+extern int smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifsFileInfo *cfile, struct cifs_open_info_data *data);
+extern int smb2_set_path_size(const unsigned int, struct cifs_tcon *,
+ const char *, __u64, struct cifs_sb_info *, bool,
+ struct dentry *);
+extern int smb2_set_file_size(const unsigned int, struct cifs_tcon *,
+ struct cifsFileInfo *, __u64, bool);
+extern int smb2_set_compression(const unsigned int, struct cifs_tcon *,
+ struct cifsFileInfo *);
+extern bool smb2_can_echo(struct TCP_Server_Info *);
+extern void smb2_clear_stats(struct cifs_tcon *tcon);
+extern int SMB2_echo(struct TCP_Server_Info *);
+extern int smb2_mkdir(const unsigned int xid, struct inode *inode, umode_t mode,
+ struct cifs_tcon *tcon, const char *name,
+ struct cifs_sb_info *sb);
+extern void smb2_mkdir_setinfo(struct inode *, const char *,
+ struct cifs_sb_info *, struct cifs_tcon *,
+ const unsigned int);
+extern int smb2_rmdir(const unsigned int, struct cifs_tcon *, const char *,
+ struct cifs_sb_info *);
+extern int smb2_unlink(const unsigned int, struct cifs_tcon *, const char *,
+ struct cifs_sb_info *, struct dentry *);
+extern int smb2_rename_path(const unsigned int xid,
+ struct cifs_tcon *tcon,
+ struct dentry *source_dentry,
+ const char *from_name, const char *to_name,
+ struct cifs_sb_info *cifs_sb);
+extern int smb2_create_hardlink(const unsigned int xid,
+ struct cifs_tcon *tcon,
+ struct dentry *source_dentry,
+ const char *from_name, const char *to_name,
+ struct cifs_sb_info *cifs_sb);
+extern int smb2_open(const unsigned int xid, struct cifs_open_parms *oparms, __u32 *oplock,
+ void *buf);
+extern void smb2_set_fid(struct cifsFileInfo *, struct cifs_fid *, __u32);
+extern int smb2_close(const unsigned int, struct cifs_tcon *,
+ struct cifs_fid *);
+extern int smb2_flush_file(const unsigned int, struct cifs_tcon *, struct cifs_fid *);
+extern int smb2_async_readv(struct cifs_io_subrequest *);
+extern void smb2_async_writev(struct cifs_io_subrequest *);
+extern int smb2_sync_read(const unsigned int, struct cifs_fid *,
+ struct cifs_io_parms *, unsigned int *, char **,
+ int *);
+extern int smb2_sync_write(const unsigned int, struct cifs_fid *,
+ struct cifs_io_parms *, unsigned int *, struct kvec *,
+ unsigned long);
+extern int smb2_query_dir_first(const unsigned int, struct cifs_tcon *,
+ const char *, struct cifs_sb_info *,
+ struct cifs_fid *, __u16,
+ struct cifs_search_info *);
+extern int smb2_query_dir_next(const unsigned int, struct cifs_tcon *,
+ struct cifs_fid *,
+ __u16, struct cifs_search_info *srch_inf);
+extern int smb2_close_dir(const unsigned int, struct cifs_tcon *,
+ struct cifs_fid *);
+extern bool smb2_is_status_pending(char *buf, struct TCP_Server_Info *server);
+extern bool smb2_is_session_expired(char *);
+extern int smb2_oplock_response(struct cifs_tcon *tcon, __u64 persistent_fid, __u64 volatile_fid,
+ __u16 net_fid, struct cifsInodeInfo *cifs_inode);
+extern bool smb2_compare_fids(struct cifsFileInfo *ob1, struct cifsFileInfo *ob2);
+extern int smb2_mand_lock(const unsigned int, struct cifsFileInfo *, __u64,
+ __u64, __u32, int, int, bool);
+extern int smb2_unlock_range(struct cifsFileInfo *, struct file_lock *,
+ const unsigned int);
+
+extern int smb2_push_mandatory_locks(struct cifsFileInfo *);
+extern void smb2_get_lease_key(struct inode *, struct cifs_fid *);
+extern void smb2_set_lease_key(struct inode *, struct cifs_fid *);
+extern void smb2_new_lease_key(struct cifs_fid *);
+extern int smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon,
+ struct cifsFileInfo *src_file, void __user *);
+extern int smb3_notify(const unsigned int xid, struct file *pfile,
+ void __user *pbuf, bool return_changes);
+extern int smb3_query_mf_symlink(unsigned int, struct cifs_tcon *,
+ struct cifs_sb_info *, const unsigned char *,
+ char *, unsigned int *);
+extern int smb3_create_mf_symlink(unsigned int, struct cifs_tcon *,
+ struct cifs_sb_info *, const unsigned char *,
+ char *, unsigned int *);
+extern bool smb21_is_read_op(__u32);
+extern ssize_t smb2_copychunk_range(const unsigned int,
+ struct cifsFileInfo *src_file,
+ struct cifsFileInfo *target_file,
+ u64 src_off, u64 len, u64 dest_off);
+extern ssize_t smb2_query_eas(const unsigned int, struct cifs_tcon *,
+ const unsigned char *, const unsigned char *, char *,
+ size_t, struct cifs_sb_info *);
+extern int smb2_set_ea(const unsigned int, struct cifs_tcon *, const char *,
+ const char *, const void *, const __u16,
+ const struct nls_table *, struct cifs_sb_info *);
+extern struct cifs_ntsd * get_smb2_acl(struct cifs_sb_info *, struct inode *,
+ const char *, u32 *, u32);
+extern struct cifs_ntsd * get_smb2_acl_by_fid(struct cifs_sb_info *,
+ const struct cifs_fid *, u32 *, u32);
+extern int set_smb2_acl(struct cifs_ntsd *, __u32, struct inode *, const char *,
+ int);
+ extern unsigned int smb2_wp_retry_size(struct inode *);
+ extern bool smb2_dir_needs_close(struct cifsFileInfo *);
+extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *,
+ enum securityEnum);
+extern int smb2_next_header(struct TCP_Server_Info *server, char *buf,
+ unsigned int *noff);
+extern int smb2_ioctl_query_info(const unsigned int xid,
+ struct cifs_tcon *tcon,
+ struct cifs_sb_info *cifs_sb,
+ __le16 *path, int is_dir,
+ unsigned long p);
+extern int smb2_make_node(unsigned int xid,
+ struct inode *inode,
+ struct dentry *dentry,
+ struct cifs_tcon *tcon,
+ const char *full_path,
+ umode_t mode,
+ dev_t device_number);
+extern int smb3_fiemap(struct cifs_tcon *tcon, struct cifsFileInfo *,
+ struct fiemap_extent_info *, u64, u64);
+extern loff_t smb3_llseek(struct file *, struct cifs_tcon *, loff_t, int);
+
+extern bool smb2_is_status_io_timeout(char *buf);
+
+extern bool smb2_is_network_name_deleted(char *buf, struct TCP_Server_Info *srv);
+
+extern int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb,
+ struct kvec *rsp_iov,
+ struct cifs_open_info_data *data);
+extern int
+smb2_adjust_credits(struct TCP_Server_Info *server,
+ struct cifs_io_subrequest *subreq,
+ unsigned int /*enum smb3_rw_credits_trace*/ trace);
+extern int *smb2_get_credits_field(struct TCP_Server_Info *server, const int optype);
+extern unsigned int smb2_get_credits(struct mid_q_entry *mid);
+extern int smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
+ size_t *num, struct cifs_credits *credits);
+extern void smb2_set_credits(struct TCP_Server_Info *server, const int val);
+
+extern unsigned int smb2_read_data_offset(char *buf);
+extern unsigned int smb2_read_data_length(char *buf, bool in_remaining);
+
#endif /* _SMB2PROTO_H */
diff --git a/fs/smb/client/smb2transport.c b/fs/smb/client/smb2transport.c
index 0b44af7066da..a42654498abe 100644
--- a/fs/smb/client/smb2transport.c
+++ b/fs/smb/client/smb2transport.c
@@ -654,8 +654,7 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server)
if (!is_signed)
return 0;
spin_lock(&server->srv_lock);
- if (server->ops->need_neg &&
- smb2_need_neg(server)) {
+ if (smb2_need_neg(server)) {
spin_unlock(&server->srv_lock);
return 0;
}
diff --git a/fs/smb/client/trace.h b/fs/smb/client/trace.h
index 3f49d29cad47..8e9964001e2a 100644
--- a/fs/smb/client/trace.h
+++ b/fs/smb/client/trace.h
@@ -1511,7 +1511,7 @@ DEFINE_SMB3_CREDIT_EVENT(pend_credits);
DEFINE_SMB3_CREDIT_EVENT(wait_credits);
DEFINE_SMB3_CREDIT_EVENT(waitff_credits);
DEFINE_SMB3_CREDIT_EVENT(overflow_credits);
-DEFINE_SMB3_CREDIT_EVENT(smb2_set_credits);
+DEFINE_SMB3_CREDIT_EVENT(set_credits);
TRACE_EVENT(smb3_tcon_ref,
diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
index 1a7bbea27344..3bad12b59b57 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -54,8 +54,7 @@ void __release_mid(struct kref *refcount)
if (midEntry->resp_buf && (midEntry->mid_flags & MID_WAIT_CANCELLED) &&
(midEntry->mid_state == MID_RESPONSE_RECEIVED ||
- midEntry->mid_state == MID_RESPONSE_READY) &&
- server->ops->handle_cancelled_mid)
+ midEntry->mid_state == MID_RESPONSE_READY))
smb2_handle_cancelled_mid(midEntry, server);
midEntry->mid_state = MID_FREE;
@@ -414,8 +413,7 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
cur_rqst[0].rq_iov = iov;
cur_rqst[0].rq_nvec = 1;
- rc = server->ops->init_transform_rq(server, num_rqst + 1,
- &cur_rqst[0], rqst);
+ rc = server->ops->init_transform_rq(server, num_rqst + 1, &cur_rqst[0], rqst);
if (rc)
goto out;
@@ -740,7 +738,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst,
rc = smb_send_rqst(server, 1, rqst, flags);
if (rc < 0) {
- revert_current_mid(server, mid->credits);
+ smb2_revert_current_mid(server, mid->credits);
server->sequence_number -= 2;
delete_mid(mid);
}
@@ -803,7 +801,7 @@ cifs_compound_callback(struct mid_q_entry *mid)
.instance = server->reconnect_instance,
};
- add_credits(server, &credits, mid->optype);
+ smb2_add_credits(server, &credits, mid->optype);
if (mid->mid_state == MID_RESPONSE_RECEIVED)
mid->mid_state = MID_RESPONSE_READY;
@@ -945,21 +943,21 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
if (instance != server->reconnect_instance) {
cifs_server_unlock(server);
for (j = 0; j < num_rqst; j++)
- add_credits(server, &credits[j], optype);
+ smb2_add_credits(server, &credits[j], optype);
return -EAGAIN;
}
for (i = 0; i < num_rqst; i++) {
midQ[i] = smb2_setup_request(ses, server, &rqst[i]);
if (IS_ERR(midQ[i])) {
- revert_current_mid(server, i);
+ smb2_revert_current_mid(server, i);
for (j = 0; j < i; j++)
delete_mid(midQ[j]);
cifs_server_unlock(server);
/* Update # of requests on wire to server */
for (j = 0; j < num_rqst; j++)
- add_credits(server, &credits[j], optype);
+ smb2_add_credits(server, &credits[j], optype);
return PTR_ERR(midQ[i]);
}
@@ -981,7 +979,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
cifs_save_when_sent(midQ[i]);
if (rc < 0) {
- revert_current_mid(server, num_rqst);
+ smb2_revert_current_mid(server, num_rqst);
server->sequence_number -= 2;
}
@@ -993,7 +991,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
*/
if (rc < 0 || (flags & CIFS_NO_SRV_RSP)) {
for (i = 0; i < num_rqst; i++)
- add_credits(server, &credits[i], optype);
+ smb2_add_credits(server, &credits[i], optype);
goto out;
}
@@ -1194,14 +1192,12 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
return length;
server->total_read += length;
- if (server->ops->is_session_expired &&
- smb2_is_session_expired(buf)) {
+ if (smb2_is_session_expired(buf)) {
cifs_reconnect(server, true);
return -1;
}
- if (server->ops->is_status_pending &&
- smb2_is_status_pending(buf, server)) {
+ if (smb2_is_status_pending(buf, server)) {
cifs_discard_remaining_data(server);
return -1;
}
diff --git a/fs/smb/client/xattr.c b/fs/smb/client/xattr.c
index 8a055ad58dbb..52063b11d3d6 100644
--- a/fs/smb/client/xattr.c
+++ b/fs/smb/client/xattr.c
@@ -18,6 +18,7 @@
#include "cifs_fs_sb.h"
#include "cifs_unicode.h"
#include "cifs_ioctl.h"
+#include "smb2proto.h"
#define MAX_EA_VALUE_SIZE CIFSMaxBufSize
#define CIFS_XATTR_CIFS_ACL "system.cifs_acl" /* DACL only */
@@ -290,23 +291,16 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
* fetch owner, DACL, and SACL if asked for full descriptor,
* fetch owner and DACL otherwise
*/
- u32 acllen, extra_info;
+ u32 acllen, extra_info = 0;
struct cifs_ntsd *pacl;
- if (pTcon->ses->server->ops->get_acl == NULL)
- goto out; /* rc already EOPNOTSUPP */
-
- if (handler->flags == XATTR_CIFS_NTSD_FULL) {
+ if (handler->flags == XATTR_CIFS_NTSD_FULL)
extra_info = SACL_SECINFO;
- } else {
- extra_info = 0;
- }
- pacl = pTcon->get_smb2_acl(cifs_sb,
- inode, full_path, &acllen, extra_info);
+
+ pacl = get_smb2_acl(cifs_sb, inode, full_path, &acllen, extra_info);
if (IS_ERR(pacl)) {
rc = PTR_ERR(pacl);
- cifs_dbg(VFS, "%s: error %zd getting sec desc\n",
- __func__, rc);
+ cifs_dbg(VFS, "%s: error %zd getting sec desc\n", __func__, rc);
} else {
if (value) {
if (acllen > size)