Skip to content

Commit b8ea3b1

Browse files
bharathsm-msSteve French
authored andcommitted
smb: enable reuse of deferred file handles for write operations
Previously, deferred file handles were reused only for read operations, this commit extends to reusing deferred handles for write operations. By reusing these handles we can reduce the need for open/close operations over the wire. Signed-off-by: Bharath SM <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 4bbf902 commit b8ea3b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/smb/client/file.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,11 @@ int cifs_open(struct inode *inode, struct file *file)
990990
}
991991

992992
/* Get the cached handle as SMB2 close is deferred */
993-
rc = cifs_get_readable_path(tcon, full_path, &cfile);
993+
if (OPEN_FMODE(file->f_flags) & FMODE_WRITE) {
994+
rc = cifs_get_writable_path(tcon, full_path, FIND_WR_FSUID_ONLY, &cfile);
995+
} else {
996+
rc = cifs_get_readable_path(tcon, full_path, &cfile);
997+
}
994998
if (rc == 0) {
995999
if (file->f_flags == cfile->f_flags) {
9961000
file->private_data = cfile;

0 commit comments

Comments
 (0)