diff mbox series

Compounding patch

Message ID CAH2r5mtTjxz=09DqhSLHMK6VtwtwyT1uQidtpefXN6JAXdthHQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series Compounding patch | expand

Commit Message

Steve French Nov. 10, 2021, 6:13 a.m. UTC
Of the 8 compounding optimizations (to use an existing handle if we
already have it open), I removed 4 of the 8 sections, but merged the
other half.  See attached:


I left out mkdir and unlink since in those cases the open is what is
doing the work.   For the hardlink case I wanted to verify the
permissions needed (you are checking for a writable handle but the
code doesn't appear to be requesting that when no handle is found) so
I wanted to look at that in more detail (and also the rmdir case -
although that may be one we want to add back).

Even with those changes I see a few examples were we appear to not
reuse the already open handle in e.g. revalidate - so there may be
additional compounding optimizations that we can do.
diff mbox series

Patch

@@ -608,10 +614,13 @@  smb2_mkdir(const unsigned int xid, struct inode *parent_inode, umode_t mode,
 	   struct cifs_tcon *tcon, const char *name,
 	   struct cifs_sb_info *cifs_sb)
 {
+	struct cifsFileInfo *cfile;
+
+	cifs_get_writable_path(tcon, name, FIND_WR_ANY, &cfile);
 	return smb2_compound_op(xid, tcon, cifs_sb, name,
 				FILE_WRITE_ATTRIBUTES, FILE_CREATE,
 				CREATE_NOT_FILE, mode, NULL, SMB2_OP_MKDIR,
-				NULL);
+				cfile);
 }
 
 void
 static int
 @@ -642,18 +651,24 @@ int
 smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
 	   struct cifs_sb_info *cifs_sb)
 {
+	struct cifsFileInfo *cfile;
+
+	cifs_get_writable_path(tcon, name, FIND_WR_WITH_DELETE, &cfile);
 	return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
 				CREATE_NOT_FILE, ACL_NO_MODE,
-				NULL, SMB2_OP_RMDIR, NULL);
+				NULL, SMB2_OP_RMDIR, cfile);
 }
 
 int
 smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
 	    struct cifs_sb_info *cifs_sb)
 {
+	struct cifsFileInfo *cfile;
+
+	cifs_get_writable_path(tcon, name, FIND_WR_WITH_DELETE, &cfile);
 	return smb2_compound_op(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
 				CREATE_DELETE_ON_CLOSE | OPEN_REPARSE_POINT,
-				ACL_NO_MODE, NULL, SMB2_OP_DELETE, NULL);
+				ACL_NO_MODE, NULL, SMB2_OP_DELETE, cfile);
 }
 
 static int
@@ -696,9 +711,12 @@  smb2_create_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
 		     const char *from_name, const char *to_name,
 		     struct cifs_sb_info *cifs_sb)
 {
+	struct cifsFileInfo *cfile;
+
+	cifs_get_writable_path(tcon, from_name, FIND_WR_ANY, &cfile);
 	return smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb,
 				  FILE_READ_ATTRIBUTES, SMB2_OP_HARDLINK,
-				  NULL);
+				  cfile);
 }
 
 int