33 server->
credits += server->echo_credits + server->oplock_credits;
34 server->oplock_credits = server->echo_credits = 0;
39 server->echoes =
false;
41 cERROR(1,
"disabling echoes and oplocks");
44 server->echoes =
true;
46 server->echo_credits = 1;
47 cFYI(1,
"disabling oplocks");
50 server->echoes =
true;
52 server->echo_credits = 1;
53 server->oplock_credits = 1;
55 server->
credits -= server->echo_credits + server->oplock_credits;
65 val = server->
ops->get_credits_field(server, optype);
69 rc = change_conf(server);
74 else if (server->
in_flight > 0 && server->oplock_credits == 0 &&
78 server->oplock_credits++;
96 smb2_get_credits_field(
struct TCP_Server_Info *server,
const int optype)
100 return &server->echo_credits;
102 return &server->oplock_credits;
145 smb2_dump_detail(
void *buf)
147 #ifdef CONFIG_CIFS_DEBUG2
150 cERROR(1,
"Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d",
160 return server->max_read == 0;
164 smb2_negotiate(
const unsigned int xid,
struct cifs_ses *ses)
167 ses->
server->CurrentMid = 0;
183 wsize =
min_t(
unsigned int, wsize, server->max_write);
188 wsize =
min_t(
unsigned int, wsize, 2 << 15);
201 rsize =
min_t(
unsigned int, rsize, server->max_read);
206 rsize =
min_t(
unsigned int, rsize, 2 << 15);
212 smb2_is_path_accessible(
const unsigned int xid,
struct cifs_tcon *tcon,
216 __u64 persistent_fid, volatile_fid;
224 rc =
SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
231 rc =
SMB2_close(xid, tcon, persistent_fid, volatile_fid);
237 smb2_get_srv_inum(
const unsigned int xid,
struct cifs_tcon *tcon,
239 u64 *uniqueid, FILE_ALL_INFO *
data)
246 smb2_query_file_info(
const unsigned int xid,
struct cifs_tcon *tcon,
254 if (smb2_data ==
NULL)
257 rc =
SMB2_query_info(xid, tcon, fid->persistent_fid, fid->volatile_fid,
270 char *full_path =
NULL;
278 cERROR(1,
"prefixpath is not supported for SMB2 now");
285 return server->echoes;
291 #ifdef CONFIG_CIFS_STATS
294 atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0);
295 atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0);
303 #ifdef CONFIG_CIFS_STATS
304 atomic_t *sent = tcon->stats.smb2_stats.smb2_com_sent;
305 atomic_t *failed = tcon->stats.smb2_stats.smb2_com_failed;
306 seq_printf(m,
"\nNegotiates: %d sent %d failed",
309 seq_printf(m,
"\nSessionSetups: %d sent %d failed",
312 #define SMB2LOGOFF 0x0002
316 seq_printf(m,
"\nTreeConnects: %d sent %d failed",
319 seq_printf(m,
"\nTreeDisconnects: %d sent %d failed",
349 seq_printf(m,
"\nQueryDirectories: %d sent %d failed",
352 seq_printf(m,
"\nChangeNotifies: %d sent %d failed",
355 seq_printf(m,
"\nQueryInfos: %d sent %d failed",
358 seq_printf(m,
"\nSetInfos: %d sent %d failed",
361 seq_printf(m,
"\nOplockBreaks: %d sent %d failed",
371 cfile->
fid.persistent_fid = fid->persistent_fid;
372 cfile->
fid.volatile_fid = fid->volatile_fid;
378 smb2_close_file(
const unsigned int xid,
struct cifs_tcon *tcon,
381 SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
385 smb2_flush_file(
const unsigned int xid,
struct cifs_tcon *tcon,
388 return SMB2_flush(xid, tcon, fid->persistent_fid, fid->volatile_fid);
392 smb2_read_data_offset(
char *buf)
399 smb2_read_data_length(
char *buf)
407 smb2_sync_read(
const unsigned int xid,
struct cifsFileInfo *cfile,
409 char **buf,
int *buf_type)
411 parms->persistent_fid = cfile->
fid.persistent_fid;
412 parms->volatile_fid = cfile->
fid.volatile_fid;
413 return SMB2_read(xid, parms, bytes_read, buf, buf_type);
417 smb2_sync_write(
const unsigned int xid,
struct cifsFileInfo *cfile,
419 struct kvec *iov,
unsigned long nr_segs)
422 parms->persistent_fid = cfile->
fid.persistent_fid;
423 parms->volatile_fid = cfile->
fid.volatile_fid;
424 return SMB2_write(xid, parms, written, iov, nr_segs);
428 smb2_set_file_size(
const unsigned int xid,
struct cifs_tcon *tcon,
433 cfile->
fid.volatile_fid, cfile->
pid, &eof);
437 smb2_query_dir_first(
const unsigned int xid,
struct cifs_tcon *tcon,
445 __u64 persistent_fid, volatile_fid;
451 rc =
SMB2_open(xid, tcon, utf16_path, &persistent_fid, &volatile_fid,
456 cERROR(1,
"open dir failed");
462 fid->persistent_fid = persistent_fid;
463 fid->volatile_fid = volatile_fid;
468 cERROR(1,
"query directory failed");
469 SMB2_close(xid, tcon, persistent_fid, volatile_fid);
475 smb2_query_dir_next(
const unsigned int xid,
struct cifs_tcon *tcon,
480 fid->volatile_fid, 0, srch_inf);
484 smb2_close_dir(
const unsigned int xid,
struct cifs_tcon *tcon,
487 return SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
526 smb2_queryfs(
const unsigned int xid,
struct cifs_tcon *tcon,
530 u64 persistent_fid, volatile_fid;
534 rc =
SMB2_open(xid, tcon, &srch_path, &persistent_fid, &volatile_fid,
539 rc =
SMB2_QFS_info(xid, tcon, persistent_fid, volatile_fid, buf);
540 SMB2_close(xid, tcon, persistent_fid, volatile_fid);
547 return ob1->
fid.persistent_fid == ob2->
fid.persistent_fid &&
548 ob1->
fid.volatile_fid == ob2->
fid.volatile_fid;
558 cfile->
fid.persistent_fid, cfile->
fid.volatile_fid,
559 current->tgid, length, offset, type, wait);
569 smb2_set_lease_key(
struct inode *inode,
struct cifs_fid *fid)
575 smb2_new_lease_key(
struct cifs_fid *fid)
581 .compare_fids = smb2_compare_fids,
585 .add_credits = smb2_add_credits,
586 .set_credits = smb2_set_credits,
587 .get_credits_field = smb2_get_credits_field,
588 .get_credits = smb2_get_credits,
589 .get_next_mid = smb2_get_next_mid,
590 .read_data_offset = smb2_read_data_offset,
591 .read_data_length = smb2_read_data_length,
593 .find_mid = smb2_find_mid,
595 .dump_detail = smb2_dump_detail,
596 .clear_stats = smb2_clear_stats,
597 .print_stats = smb2_print_stats,
599 .need_neg = smb2_need_neg,
600 .negotiate = smb2_negotiate,
601 .negotiate_wsize = smb2_negotiate_wsize,
602 .negotiate_rsize = smb2_negotiate_rsize,
607 .is_path_accessible = smb2_is_path_accessible,
608 .can_echo = smb2_can_echo,
611 .get_srv_inum = smb2_get_srv_inum,
612 .query_file_info = smb2_query_file_info,
614 .set_file_size = smb2_set_file_size,
616 .build_path_to_root = smb2_build_path_to_root,
624 .set_fid = smb2_set_fid,
625 .close = smb2_close_file,
626 .flush = smb2_flush_file,
629 .sync_read = smb2_sync_read,
630 .sync_write = smb2_sync_write,
631 .query_dir_first = smb2_query_dir_first,
632 .query_dir_next = smb2_query_dir_next,
633 .close_dir = smb2_close_dir,
635 .is_status_pending = smb2_is_status_pending,
636 .oplock_response = smb2_oplock_response,
637 .queryfs = smb2_queryfs,
638 .mand_lock = smb2_mand_lock,
641 .get_lease_key = smb2_get_lease_key,
642 .set_lease_key = smb2_set_lease_key,
643 .new_lease_key = smb2_new_lease_key,
649 .req_capabilities = 0,
650 .large_lock_type = 0,
654 .header_size =
sizeof(
struct smb2_hdr),
667 .large_lock_type = 0,
671 .header_size =
sizeof(
struct smb2_hdr),