diff mbox series

[8/9] cifs: change SMB2_OP_SET_INFO to use compounding

Message ID 20180820033920.31435-9-lsahlber@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/9] cifs: add a smb2_compound_op and change QUERY_INFO to use it | expand

Commit Message

Ronnie Sahlberg Aug. 20, 2018, 3:39 a.m. UTC
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2inode.c | 33 +++++++++++++++++++++------------
 fs/cifs/smb2pdu.c   | 11 -----------
 fs/cifs/smb2proto.h |  3 ---
 3 files changed, 21 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 8822b5937449..f802e12e4138 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -146,6 +146,19 @@  smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 		smb2_set_next_command(server, &rqst[num_rqst]);
 		smb2_set_related(&rqst[num_rqst++]);
 		break;
+	case SMB2_OP_SET_INFO:
+		memset(&si_iov, 0, sizeof(si_iov));
+		rqst[num_rqst].rq_iov = si_iov;
+		rqst[num_rqst].rq_nvec = 1;
+
+		size = sizeof(FILE_BASIC_INFO);
+		rc = SMB2_set_info_init(tcon, &rqst[num_rqst], COMPOUND_FID,
+					COMPOUND_FID, current->tgid,
+					FILE_BASIC_INFORMATION,
+					SMB2_O_INFO_FILE, 0, &data, &size);
+		smb2_set_next_command(server, &rqst[num_rqst]);
+		smb2_set_related(&rqst[num_rqst++]);
+		break;
 	default:
 		cifs_dbg(VFS, "Invalid command\n");
 		rc = -EINVAL;
@@ -185,8 +198,9 @@  smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
 	case SMB2_OP_MKDIR:
 		SMB2_close_free(&rqst[1]);
 		break;
-	case SMB2_OP_SET_EOF:
 	case SMB2_OP_RMDIR:
+	case SMB2_OP_SET_EOF:
+	case SMB2_OP_SET_INFO:
 		SMB2_set_info_free(&rqst[1]);
 		SMB2_close_free(&rqst[2]);
 		break;
@@ -248,11 +262,6 @@  smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
 		tmprc = SMB2_set_hardlink(xid, tcon, fid.persistent_fid,
 					  fid.volatile_fid, (__le16 *)data);
 		break;
-	case SMB2_OP_SET_INFO:
-		tmprc = SMB2_set_basic_info(xid, tcon, fid.persistent_fid,
-					    fid.volatile_fid,
-					    (FILE_BASIC_INFO *)data);
-		break;
 	default:
 		cifs_dbg(VFS, "Invalid command\n");
 		break;
@@ -337,9 +346,9 @@  smb2_mkdir_setinfo(struct inode *inode, const char *name,
 	cifs_i = CIFS_I(inode);
 	dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
 	data.Attributes = cpu_to_le32(dosattrs);
-	tmprc = smb2_open_op_close(xid, tcon, cifs_sb, name,
-				   FILE_WRITE_ATTRIBUTES, FILE_CREATE,
-				   CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO);
+	tmprc = smb2_compound_op(xid, tcon, cifs_sb, name,
+				 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
+				 CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO);
 	if (tmprc == 0)
 		cifs_i->cifsAttrs = dosattrs;
 }
@@ -430,9 +439,9 @@  smb2_set_file_info(struct inode *inode, const char *full_path,
 	if (IS_ERR(tlink))
 		return PTR_ERR(tlink);
 
-	rc = smb2_open_op_close(xid, tlink_tcon(tlink), cifs_sb, full_path,
-				FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf,
-				SMB2_OP_SET_INFO);
+	rc = smb2_compound_op(xid, tlink_tcon(tlink), cifs_sb, full_path,
+			      FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf,
+			      SMB2_OP_SET_INFO);
 	cifs_put_tlink(tlink);
 	return rc;
 }
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index d934d40e039f..cf8d2f7d097c 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -3934,17 +3934,6 @@  SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
 }
 
 int
-SMB2_set_basic_info(const unsigned int xid, struct cifs_tcon *tcon,
-		    u64 persistent_fid, u64 volatile_fid, FILE_BASIC_INFO *buf)
-{
-	unsigned int size;
-	size = sizeof(FILE_BASIC_INFO);
-	return send_set_info(xid, tcon, persistent_fid, volatile_fid,
-		current->tgid, FILE_BASIC_INFORMATION, SMB2_O_INFO_FILE,
-		0, 1, (void **)&buf, &size);
-}
-
-int
 SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
 		u64 persistent_fid, u64 volatile_fid,
 		struct cifs_ntsd *pnntsd, int pacllen, int aclflag)
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index ae547e154c1b..91c261a71059 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -196,9 +196,6 @@  extern int SMB2_set_info_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
 			      u8 info_class, u8 info_type, u32 additional_info,
 			      void **data, unsigned int *size);
 extern void SMB2_set_info_free(struct smb_rqst *rqst);
-extern int SMB2_set_basic_info(const unsigned int xid, struct cifs_tcon *tcon,
-			       u64 persistent_fid, u64 volatile_fid,
-			       FILE_BASIC_INFO *buf);
 extern int SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
 			u64 persistent_fid, u64 volatile_fid,
 			struct cifs_ntsd *pnntsd, int pacllen, int aclflag);