1 // SPDX-License-Identifier: LGPL-2.1
4 * Copyright (C) International Business Machines Corp., 2002, 2011
6 * Author(s): Pavel Shilovsky (pshilovsky@samba.org),
7 * Steve French (sfrench@us.ibm.com)
11 #include <linux/stat.h>
12 #include <linux/slab.h>
13 #include <linux/pagemap.h>
14 #include <asm/div64.h>
18 #include "cifsproto.h"
19 #include "cifs_debug.h"
20 #include "cifs_fs_sb.h"
21 #include "cifs_unicode.h"
25 #include "smb2proto.h"
26 #include "cached_dir.h"
27 #include "smb2status.h"
30 free_set_inf_compound(struct smb_rqst *rqst)
33 SMB2_set_info_free(&rqst[1]);
35 SMB2_close_free(&rqst[2]);
40 struct cifs_open_parms oparms;
41 struct kvec rsp_iov[3];
42 struct smb_rqst rqst[3];
43 struct kvec open_iov[SMB2_CREATE_IOV_SIZE];
44 struct kvec qi_iov[1];
45 struct kvec si_iov[SMB2_SET_INFO_IOV_SIZE];
46 struct kvec close_iov[1];
47 struct smb2_file_rename_info rename_info;
48 struct smb2_file_link_info link_info;
52 * note: If cfile is passed, the reference to it is dropped here.
53 * So make sure that you do not reuse cfile after return from this func.
55 * If passing @err_iov and @err_buftype, ensure to make them both large enough (>= 3) to hold all
56 * error responses. Caller is also responsible for freeing them up.
58 static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
59 struct cifs_sb_info *cifs_sb, const char *full_path,
60 __u32 desired_access, __u32 create_disposition, __u32 create_options,
61 umode_t mode, void *ptr, int command, struct cifsFileInfo *cfile,
62 struct kvec *err_iov, int *err_buftype)
64 struct cop_vars *vars = NULL;
66 struct smb_rqst *rqst;
68 __le16 *utf16_path = NULL;
69 __u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
71 struct cifs_ses *ses = tcon->ses;
72 struct TCP_Server_Info *server;
75 struct smb2_query_info_rsp *qi_rsp = NULL;
76 struct cifs_open_info_data *idata;
78 __u8 delete_pending[8] = {1, 0, 0, 0, 0, 0, 0, 0};
83 vars = kzalloc(sizeof(*vars), GFP_ATOMIC);
86 rqst = &vars->rqst[0];
87 rsp_iov = &vars->rsp_iov[0];
89 server = cifs_pick_channel(ses);
91 if (smb3_encryption_required(tcon))
92 flags |= CIFS_TRANSFORM_REQ;
94 resp_buftype[0] = resp_buftype[1] = resp_buftype[2] = CIFS_NO_BUFFER;
96 /* We already have a handle so we can skip the open */
101 utf16_path = cifs_convert_path_to_utf16(full_path, cifs_sb);
107 vars->oparms.tcon = tcon;
108 vars->oparms.desired_access = desired_access;
109 vars->oparms.disposition = create_disposition;
110 vars->oparms.create_options = cifs_create_options(cifs_sb, create_options);
111 vars->oparms.fid = &fid;
112 vars->oparms.reconnect = false;
113 vars->oparms.mode = mode;
114 vars->oparms.cifs_sb = cifs_sb;
116 rqst[num_rqst].rq_iov = &vars->open_iov[0];
117 rqst[num_rqst].rq_nvec = SMB2_CREATE_IOV_SIZE;
118 rc = SMB2_open_init(tcon, server,
119 &rqst[num_rqst], &oplock, &vars->oparms,
125 smb2_set_next_command(tcon, &rqst[num_rqst]);
132 case SMB2_OP_QUERY_INFO:
133 rqst[num_rqst].rq_iov = &vars->qi_iov[0];
134 rqst[num_rqst].rq_nvec = 1;
137 rc = SMB2_query_info_init(tcon, server,
139 cfile->fid.persistent_fid,
140 cfile->fid.volatile_fid,
141 FILE_ALL_INFORMATION,
143 sizeof(struct smb2_file_all_info) +
144 PATH_MAX * 2, 0, NULL);
146 rc = SMB2_query_info_init(tcon, server,
150 FILE_ALL_INFORMATION,
152 sizeof(struct smb2_file_all_info) +
153 PATH_MAX * 2, 0, NULL);
155 smb2_set_next_command(tcon, &rqst[num_rqst]);
156 smb2_set_related(&rqst[num_rqst]);
163 trace_smb3_query_info_compound_enter(xid, ses->Suid, tcon->tid,
166 case SMB2_OP_POSIX_QUERY_INFO:
167 rqst[num_rqst].rq_iov = &vars->qi_iov[0];
168 rqst[num_rqst].rq_nvec = 1;
171 rc = SMB2_query_info_init(tcon, server,
173 cfile->fid.persistent_fid,
174 cfile->fid.volatile_fid,
175 SMB_FIND_FILE_POSIX_INFO,
177 /* TBD: fix following to allow for longer SIDs */
178 sizeof(struct smb311_posix_qinfo *) + (PATH_MAX * 2) +
179 (sizeof(struct cifs_sid) * 2), 0, NULL);
181 rc = SMB2_query_info_init(tcon, server,
185 SMB_FIND_FILE_POSIX_INFO,
187 sizeof(struct smb311_posix_qinfo *) + (PATH_MAX * 2) +
188 (sizeof(struct cifs_sid) * 2), 0, NULL);
190 smb2_set_next_command(tcon, &rqst[num_rqst]);
191 smb2_set_related(&rqst[num_rqst]);
198 trace_smb3_posix_query_info_compound_enter(xid, ses->Suid, tcon->tid, full_path);
201 trace_smb3_delete_enter(xid, ses->Suid, tcon->tid, full_path);
205 * Directories are created through parameters in the
208 trace_smb3_mkdir_enter(xid, ses->Suid, tcon->tid, full_path);
211 rqst[num_rqst].rq_iov = &vars->si_iov[0];
212 rqst[num_rqst].rq_nvec = 1;
214 size[0] = 1; /* sizeof __u8 See MS-FSCC section 2.4.11 */
215 data[0] = &delete_pending[0];
217 rc = SMB2_set_info_init(tcon, server,
218 &rqst[num_rqst], COMPOUND_FID,
219 COMPOUND_FID, current->tgid,
220 FILE_DISPOSITION_INFORMATION,
221 SMB2_O_INFO_FILE, 0, data, size);
224 smb2_set_next_command(tcon, &rqst[num_rqst]);
225 smb2_set_related(&rqst[num_rqst++]);
226 trace_smb3_rmdir_enter(xid, ses->Suid, tcon->tid, full_path);
228 case SMB2_OP_SET_EOF:
229 rqst[num_rqst].rq_iov = &vars->si_iov[0];
230 rqst[num_rqst].rq_nvec = 1;
232 size[0] = 8; /* sizeof __le64 */
235 rc = SMB2_set_info_init(tcon, server,
236 &rqst[num_rqst], COMPOUND_FID,
237 COMPOUND_FID, current->tgid,
238 FILE_END_OF_FILE_INFORMATION,
239 SMB2_O_INFO_FILE, 0, data, size);
242 smb2_set_next_command(tcon, &rqst[num_rqst]);
243 smb2_set_related(&rqst[num_rqst++]);
244 trace_smb3_set_eof_enter(xid, ses->Suid, tcon->tid, full_path);
246 case SMB2_OP_SET_INFO:
247 rqst[num_rqst].rq_iov = &vars->si_iov[0];
248 rqst[num_rqst].rq_nvec = 1;
251 size[0] = sizeof(FILE_BASIC_INFO);
255 rc = SMB2_set_info_init(tcon, server,
257 cfile->fid.persistent_fid,
258 cfile->fid.volatile_fid, current->tgid,
259 FILE_BASIC_INFORMATION,
260 SMB2_O_INFO_FILE, 0, data, size);
262 rc = SMB2_set_info_init(tcon, server,
265 COMPOUND_FID, current->tgid,
266 FILE_BASIC_INFORMATION,
267 SMB2_O_INFO_FILE, 0, data, size);
269 smb2_set_next_command(tcon, &rqst[num_rqst]);
270 smb2_set_related(&rqst[num_rqst]);
277 trace_smb3_set_info_compound_enter(xid, ses->Suid, tcon->tid,
281 rqst[num_rqst].rq_iov = &vars->si_iov[0];
282 rqst[num_rqst].rq_nvec = 2;
284 len = (2 * UniStrnlen((wchar_t *)ptr, PATH_MAX));
286 vars->rename_info.ReplaceIfExists = 1;
287 vars->rename_info.RootDirectory = 0;
288 vars->rename_info.FileNameLength = cpu_to_le32(len);
290 size[0] = sizeof(struct smb2_file_rename_info);
291 data[0] = &vars->rename_info;
293 size[1] = len + 2 /* null */;
294 data[1] = (__le16 *)ptr;
297 rc = SMB2_set_info_init(tcon, server,
299 cfile->fid.persistent_fid,
300 cfile->fid.volatile_fid,
301 current->tgid, FILE_RENAME_INFORMATION,
302 SMB2_O_INFO_FILE, 0, data, size);
304 rc = SMB2_set_info_init(tcon, server,
306 COMPOUND_FID, COMPOUND_FID,
307 current->tgid, FILE_RENAME_INFORMATION,
308 SMB2_O_INFO_FILE, 0, data, size);
310 smb2_set_next_command(tcon, &rqst[num_rqst]);
311 smb2_set_related(&rqst[num_rqst]);
317 trace_smb3_rename_enter(xid, ses->Suid, tcon->tid, full_path);
319 case SMB2_OP_HARDLINK:
320 rqst[num_rqst].rq_iov = &vars->si_iov[0];
321 rqst[num_rqst].rq_nvec = 2;
323 len = (2 * UniStrnlen((wchar_t *)ptr, PATH_MAX));
325 vars->link_info.ReplaceIfExists = 0;
326 vars->link_info.RootDirectory = 0;
327 vars->link_info.FileNameLength = cpu_to_le32(len);
329 size[0] = sizeof(struct smb2_file_link_info);
330 data[0] = &vars->link_info;
332 size[1] = len + 2 /* null */;
333 data[1] = (__le16 *)ptr;
335 rc = SMB2_set_info_init(tcon, server,
336 &rqst[num_rqst], COMPOUND_FID,
337 COMPOUND_FID, current->tgid,
338 FILE_LINK_INFORMATION,
339 SMB2_O_INFO_FILE, 0, data, size);
342 smb2_set_next_command(tcon, &rqst[num_rqst]);
343 smb2_set_related(&rqst[num_rqst++]);
344 trace_smb3_hardlink_enter(xid, ses->Suid, tcon->tid, full_path);
347 cifs_dbg(VFS, "Invalid command\n");
353 /* We already have a handle so we can skip the close */
357 flags |= CIFS_CP_CREATE_CLOSE_OP;
358 rqst[num_rqst].rq_iov = &vars->close_iov[0];
359 rqst[num_rqst].rq_nvec = 1;
360 rc = SMB2_close_init(tcon, server,
361 &rqst[num_rqst], COMPOUND_FID,
362 COMPOUND_FID, false);
363 smb2_set_related(&rqst[num_rqst]);
370 rc = compound_send_recv(xid, ses, server,
372 &rqst[1], &resp_buftype[1],
375 rc = compound_send_recv(xid, ses, server,
382 cifsFileInfo_put(cfile);
384 SMB2_open_free(&rqst[0]);
385 if (rc == -EREMCHG) {
386 pr_warn_once("server share %s deleted\n", tcon->tree_name);
387 tcon->need_reconnect = true;
391 case SMB2_OP_QUERY_INFO:
393 if (rc == 0 && cfile && cfile->symlink_target) {
394 idata->symlink_target = kstrdup(cfile->symlink_target, GFP_KERNEL);
395 if (!idata->symlink_target)
399 qi_rsp = (struct smb2_query_info_rsp *)
401 rc = smb2_validate_and_copy_iov(
402 le16_to_cpu(qi_rsp->OutputBufferOffset),
403 le32_to_cpu(qi_rsp->OutputBufferLength),
404 &rsp_iov[1], sizeof(idata->fi), (char *)&idata->fi);
407 SMB2_query_info_free(&rqst[1]);
409 SMB2_close_free(&rqst[2]);
411 trace_smb3_query_info_compound_err(xid, ses->Suid,
414 trace_smb3_query_info_compound_done(xid, ses->Suid,
417 case SMB2_OP_POSIX_QUERY_INFO:
419 if (rc == 0 && cfile && cfile->symlink_target) {
420 idata->symlink_target = kstrdup(cfile->symlink_target, GFP_KERNEL);
421 if (!idata->symlink_target)
425 qi_rsp = (struct smb2_query_info_rsp *)
427 rc = smb2_validate_and_copy_iov(
428 le16_to_cpu(qi_rsp->OutputBufferOffset),
429 le32_to_cpu(qi_rsp->OutputBufferLength),
430 &rsp_iov[1], sizeof(idata->posix_fi) /* add SIDs */,
431 (char *)&idata->posix_fi);
434 SMB2_query_info_free(&rqst[1]);
436 SMB2_close_free(&rqst[2]);
438 trace_smb3_posix_query_info_compound_err(xid, ses->Suid, tcon->tid, rc);
440 trace_smb3_posix_query_info_compound_done(xid, ses->Suid, tcon->tid);
444 trace_smb3_delete_err(xid, ses->Suid, tcon->tid, rc);
446 trace_smb3_delete_done(xid, ses->Suid, tcon->tid);
448 SMB2_close_free(&rqst[1]);
452 trace_smb3_mkdir_err(xid, ses->Suid, tcon->tid, rc);
454 trace_smb3_mkdir_done(xid, ses->Suid, tcon->tid);
456 SMB2_close_free(&rqst[1]);
458 case SMB2_OP_HARDLINK:
460 trace_smb3_hardlink_err(xid, ses->Suid, tcon->tid, rc);
462 trace_smb3_hardlink_done(xid, ses->Suid, tcon->tid);
463 free_set_inf_compound(rqst);
467 trace_smb3_rename_err(xid, ses->Suid, tcon->tid, rc);
469 trace_smb3_rename_done(xid, ses->Suid, tcon->tid);
470 free_set_inf_compound(rqst);
474 trace_smb3_rmdir_err(xid, ses->Suid, tcon->tid, rc);
476 trace_smb3_rmdir_done(xid, ses->Suid, tcon->tid);
477 free_set_inf_compound(rqst);
479 case SMB2_OP_SET_EOF:
481 trace_smb3_set_eof_err(xid, ses->Suid, tcon->tid, rc);
483 trace_smb3_set_eof_done(xid, ses->Suid, tcon->tid);
484 free_set_inf_compound(rqst);
486 case SMB2_OP_SET_INFO:
488 trace_smb3_set_info_compound_err(xid, ses->Suid,
491 trace_smb3_set_info_compound_done(xid, ses->Suid,
493 free_set_inf_compound(rqst);
497 if (rc && err_iov && err_buftype) {
498 memcpy(err_iov, rsp_iov, 3 * sizeof(*err_iov));
499 memcpy(err_buftype, resp_buftype, 3 * sizeof(*err_buftype));
501 free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base);
502 free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
503 free_rsp_buf(resp_buftype[2], rsp_iov[2].iov_base);
509 int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
510 struct cifs_sb_info *cifs_sb, const char *full_path,
511 struct cifs_open_info_data *data, bool *adjust_tz, bool *reparse)
514 __u32 create_options = 0;
515 struct cifsFileInfo *cfile;
516 struct cached_fid *cfid = NULL;
517 struct kvec err_iov[3] = {};
518 int err_buftype[3] = {};
523 if (strcmp(full_path, ""))
526 rc = open_cached_dir(xid, tcon, full_path, cifs_sb, false, &cfid);
527 /* If it is a root and its handle is cached then use it */
529 if (cfid->file_all_info_is_valid) {
530 memcpy(&data->fi, &cfid->file_all_info, sizeof(data->fi));
532 rc = SMB2_query_info(xid, tcon, cfid->fid.persistent_fid,
533 cfid->fid.volatile_fid, &data->fi);
535 close_cached_dir(cfid);
539 cifs_get_readable_path(tcon, full_path, &cfile);
540 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, FILE_READ_ATTRIBUTES, FILE_OPEN,
541 create_options, ACL_NO_MODE, data, SMB2_OP_QUERY_INFO, cfile,
542 err_iov, err_buftype);
543 if (rc == -EOPNOTSUPP) {
544 if (err_iov[0].iov_base && err_buftype[0] != CIFS_NO_BUFFER &&
545 ((struct smb2_hdr *)err_iov[0].iov_base)->Command == SMB2_CREATE &&
546 ((struct smb2_hdr *)err_iov[0].iov_base)->Status == STATUS_STOPPED_ON_SYMLINK) {
547 rc = smb2_parse_symlink_response(cifs_sb, err_iov, &data->symlink_target);
552 create_options |= OPEN_REPARSE_POINT;
554 /* Failed on a symbolic link - query a reparse point info */
555 cifs_get_readable_path(tcon, full_path, &cfile);
556 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, FILE_READ_ATTRIBUTES,
557 FILE_OPEN, create_options, ACL_NO_MODE, data,
558 SMB2_OP_QUERY_INFO, cfile, NULL, NULL);
562 free_rsp_buf(err_buftype[0], err_iov[0].iov_base);
563 free_rsp_buf(err_buftype[1], err_iov[1].iov_base);
564 free_rsp_buf(err_buftype[2], err_iov[2].iov_base);
569 int smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
570 struct cifs_sb_info *cifs_sb, const char *full_path,
571 struct cifs_open_info_data *data, bool *adjust_tz, bool *reparse)
574 __u32 create_options = 0;
575 struct cifsFileInfo *cfile;
576 struct kvec err_iov[3] = {};
577 int err_buftype[3] = {};
583 * BB TODO: Add support for using the cached root handle.
584 * Create SMB2_query_posix_info worker function to do non-compounded query
585 * when we already have an open file handle for this. For now this is fast enough
586 * (always using the compounded version).
589 cifs_get_readable_path(tcon, full_path, &cfile);
590 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, FILE_READ_ATTRIBUTES, FILE_OPEN,
591 create_options, ACL_NO_MODE, data, SMB2_OP_POSIX_QUERY_INFO, cfile,
592 err_iov, err_buftype);
593 if (rc == -EOPNOTSUPP) {
594 /* BB TODO: When support for special files added to Samba re-verify this path */
595 if (err_iov[0].iov_base && err_buftype[0] != CIFS_NO_BUFFER &&
596 ((struct smb2_hdr *)err_iov[0].iov_base)->Command == SMB2_CREATE &&
597 ((struct smb2_hdr *)err_iov[0].iov_base)->Status == STATUS_STOPPED_ON_SYMLINK) {
598 rc = smb2_parse_symlink_response(cifs_sb, err_iov, &data->symlink_target);
603 create_options |= OPEN_REPARSE_POINT;
605 /* Failed on a symbolic link - query a reparse point info */
606 cifs_get_readable_path(tcon, full_path, &cfile);
607 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, FILE_READ_ATTRIBUTES,
608 FILE_OPEN, create_options, ACL_NO_MODE, data,
609 SMB2_OP_POSIX_QUERY_INFO, cfile, NULL, NULL);
613 free_rsp_buf(err_buftype[0], err_iov[0].iov_base);
614 free_rsp_buf(err_buftype[1], err_iov[1].iov_base);
615 free_rsp_buf(err_buftype[2], err_iov[2].iov_base);
620 smb2_mkdir(const unsigned int xid, struct inode *parent_inode, umode_t mode,
621 struct cifs_tcon *tcon, const char *name,
622 struct cifs_sb_info *cifs_sb)
624 return smb2_compound_op(xid, tcon, cifs_sb, name,
625 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
626 CREATE_NOT_FILE, mode, NULL, SMB2_OP_MKDIR,
631 smb2_mkdir_setinfo(struct inode *inode, const char *name,
632 struct cifs_sb_info *cifs_sb, struct cifs_tcon *tcon,
633 const unsigned int xid)
635 FILE_BASIC_INFO data;
636 struct cifsInodeInfo *cifs_i;
637 struct cifsFileInfo *cfile;
641 memset(&data, 0, sizeof(data));
642 cifs_i = CIFS_I(inode);
643 dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
644 data.Attributes = cpu_to_le32(dosattrs);
645 cifs_get_writable_path(tcon, name, FIND_WR_ANY, &cfile);
646 tmprc = smb2_compound_op(xid, tcon, cifs_sb, name,
647 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
648 CREATE_NOT_FILE, ACL_NO_MODE,
649 &data, SMB2_OP_SET_INFO, cfile, NULL, NULL);
651 cifs_i->cifsAttrs = dosattrs;
655 smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
656 struct cifs_sb_info *cifs_sb)
658 return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
659 CREATE_NOT_FILE, ACL_NO_MODE,
660 NULL, SMB2_OP_RMDIR, NULL, NULL, NULL);
664 smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
665 struct cifs_sb_info *cifs_sb)
667 return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
668 CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT,
669 ACL_NO_MODE, NULL, SMB2_OP_DELETE, NULL, NULL, NULL);
673 smb2_set_path_attr(const unsigned int xid, struct cifs_tcon *tcon,
674 const char *from_name, const char *to_name,
675 struct cifs_sb_info *cifs_sb, __u32 access, int command,
676 struct cifsFileInfo *cfile)
678 __le16 *smb2_to_name = NULL;
681 smb2_to_name = cifs_convert_path_to_utf16(to_name, cifs_sb);
682 if (smb2_to_name == NULL) {
684 goto smb2_rename_path;
686 rc = smb2_compound_op(xid, tcon, cifs_sb, from_name, access,
687 FILE_OPEN, 0, ACL_NO_MODE, smb2_to_name,
688 command, cfile, NULL, NULL);
695 smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon,
696 const char *from_name, const char *to_name,
697 struct cifs_sb_info *cifs_sb)
699 struct cifsFileInfo *cfile;
701 cifs_get_writable_path(tcon, from_name, FIND_WR_WITH_DELETE, &cfile);
703 return smb2_set_path_attr(xid, tcon, from_name, to_name,
704 cifs_sb, DELETE, SMB2_OP_RENAME, cfile);
708 smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
709 const char *from_name, const char *to_name,
710 struct cifs_sb_info *cifs_sb)
712 return smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb,
713 FILE_READ_ATTRIBUTES, SMB2_OP_HARDLINK,
718 smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
719 const char *full_path, __u64 size,
720 struct cifs_sb_info *cifs_sb, bool set_alloc)
722 __le64 eof = cpu_to_le64(size);
723 struct cifsFileInfo *cfile;
725 cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile);
726 return smb2_compound_op(xid, tcon, cifs_sb, full_path,
727 FILE_WRITE_DATA, FILE_OPEN, 0, ACL_NO_MODE,
728 &eof, SMB2_OP_SET_EOF, cfile, NULL, NULL);
732 smb2_set_file_info(struct inode *inode, const char *full_path,
733 FILE_BASIC_INFO *buf, const unsigned int xid)
735 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
736 struct tcon_link *tlink;
737 struct cifs_tcon *tcon;
738 struct cifsFileInfo *cfile;
741 if ((buf->CreationTime == 0) && (buf->LastAccessTime == 0) &&
742 (buf->LastWriteTime == 0) && (buf->ChangeTime == 0) &&
743 (buf->Attributes == 0))
744 return 0; /* would be a no op, no sense sending this */
746 tlink = cifs_sb_tlink(cifs_sb);
748 return PTR_ERR(tlink);
749 tcon = tlink_tcon(tlink);
751 cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile);
752 rc = smb2_compound_op(xid, tcon, cifs_sb, full_path,
753 FILE_WRITE_ATTRIBUTES, FILE_OPEN,
754 0, ACL_NO_MODE, buf, SMB2_OP_SET_INFO, cfile,
756 cifs_put_tlink(tlink);