Skip to content

Commit

Permalink
smb: enable reuse of deferred file handles for write operations
Browse files Browse the repository at this point in the history
Previously, deferred file handles were reused only for read
operations, this commit extends to reusing deferred handles
for write operations.

Signed-off-by: Bharath SM <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
bharathsm-ms authored and Steve French committed Dec 16, 2024
1 parent 69af449 commit 077df1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/smb/client/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,11 @@ int cifs_open(struct inode *inode, struct file *file)
}

/* Get the cached handle as SMB2 close is deferred */
rc = cifs_get_readable_path(tcon, full_path, &cfile);
if (OPEN_FMODE(file->f_flags) & FMODE_WRITE) {
rc = cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile);
} else {
rc = cifs_get_readable_path(tcon, full_path, &cfile);
}
if (rc == 0) {
if (file->f_flags == cfile->f_flags) {
file->private_data = cfile;
Expand Down

0 comments on commit 077df1a

Please sign in to comment.