Skip to content

Commit 2d7b8c6

Browse files
committed
Merge tag '6.5-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: "Three smb client fixes, all for stable: - fix for oops in unmount race with lease break of deferred close - debugging improvement for reconnect - fix for fscache deadlock (folio_wait_bit_common hang)" * tag '6.5-rc6-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: smb3: display network namespace in debug information cifs: Release folio lock on fscache read hit. cifs: fix potential oops in cifs_oplock_break
2 parents d4f8e13 + 7b38f6d commit 2d7b8c6

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

fs/smb/client/cifs_debug.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ cifs_dump_channel(struct seq_file *m, int i, struct cifs_chan *chan)
153153
in_flight(server),
154154
atomic_read(&server->in_send),
155155
atomic_read(&server->num_waiters));
156+
#ifdef CONFIG_NET_NS
157+
if (server->net)
158+
seq_printf(m, " Net namespace: %u ", server->net->ns.inum);
159+
#endif /* NET_NS */
160+
156161
}
157162

158163
static inline const char *smb_speed_to_str(size_t bps)
@@ -430,10 +435,15 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
430435
server->reconnect_instance,
431436
server->srv_count,
432437
server->sec_mode, in_flight(server));
438+
#ifdef CONFIG_NET_NS
439+
if (server->net)
440+
seq_printf(m, " Net namespace: %u ", server->net->ns.inum);
441+
#endif /* NET_NS */
433442

434443
seq_printf(m, "\nIn Send: %d In MaxReq Wait: %d",
435444
atomic_read(&server->in_send),
436445
atomic_read(&server->num_waiters));
446+
437447
if (server->leaf_fullpath) {
438448
seq_printf(m, "\nDFS leaf full path: %s",
439449
server->leaf_fullpath);

fs/smb/client/file.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4681,9 +4681,9 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
46814681

46824682
io_error:
46834683
kunmap(page);
4684-
unlock_page(page);
46854684

46864685
read_complete:
4686+
unlock_page(page);
46874687
return rc;
46884688
}
46894689

@@ -4878,9 +4878,11 @@ void cifs_oplock_break(struct work_struct *work)
48784878
struct cifsFileInfo *cfile = container_of(work, struct cifsFileInfo,
48794879
oplock_break);
48804880
struct inode *inode = d_inode(cfile->dentry);
4881+
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
48814882
struct cifsInodeInfo *cinode = CIFS_I(inode);
4882-
struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
4883-
struct TCP_Server_Info *server = tcon->ses->server;
4883+
struct cifs_tcon *tcon;
4884+
struct TCP_Server_Info *server;
4885+
struct tcon_link *tlink;
48844886
int rc = 0;
48854887
bool purge_cache = false, oplock_break_cancelled;
48864888
__u64 persistent_fid, volatile_fid;
@@ -4889,6 +4891,12 @@ void cifs_oplock_break(struct work_struct *work)
48894891
wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS,
48904892
TASK_UNINTERRUPTIBLE);
48914893

4894+
tlink = cifs_sb_tlink(cifs_sb);
4895+
if (IS_ERR(tlink))
4896+
goto out;
4897+
tcon = tlink_tcon(tlink);
4898+
server = tcon->ses->server;
4899+
48924900
server->ops->downgrade_oplock(server, cinode, cfile->oplock_level,
48934901
cfile->oplock_epoch, &purge_cache);
48944902

@@ -4938,18 +4946,19 @@ void cifs_oplock_break(struct work_struct *work)
49384946
/*
49394947
* MS-SMB2 3.2.5.19.1 and 3.2.5.19.2 (and MS-CIFS 3.2.5.42) do not require
49404948
* an acknowledgment to be sent when the file has already been closed.
4941-
* check for server null, since can race with kill_sb calling tree disconnect.
49424949
*/
49434950
spin_lock(&cinode->open_file_lock);
4944-
if (tcon->ses && tcon->ses->server && !oplock_break_cancelled &&
4945-
!list_empty(&cinode->openFileList)) {
4951+
/* check list empty since can race with kill_sb calling tree disconnect */
4952+
if (!oplock_break_cancelled && !list_empty(&cinode->openFileList)) {
49464953
spin_unlock(&cinode->open_file_lock);
4947-
rc = tcon->ses->server->ops->oplock_response(tcon, persistent_fid,
4948-
volatile_fid, net_fid, cinode);
4954+
rc = server->ops->oplock_response(tcon, persistent_fid,
4955+
volatile_fid, net_fid, cinode);
49494956
cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
49504957
} else
49514958
spin_unlock(&cinode->open_file_lock);
49524959

4960+
cifs_put_tlink(tlink);
4961+
out:
49534962
cifs_done_oplock_break(cinode);
49544963
}
49554964

0 commit comments

Comments
 (0)