Skip to content

Commit 4c46b67

Browse files
bharathsm-mssmfrench
authored andcommitted
smb: client: add oplock level to smb3_open_done tracepoint
Add an oplock field to the smb3_open_done_class trace event to show the granted oplock/lease level. Move the trace_smb3_open_done call after smb2_parse_contexts() so the oplock value reflects the parsed lease state (R/W/H flags). Signed-off-by: Bharath SM <bharathsm@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent afab3f6 commit 4c46b67

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

fs/smb/client/smb2pdu.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,7 +3044,8 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
30443044
}
30453045

30463046
trace_smb3_posix_mkdir_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid,
3047-
CREATE_NOT_FILE, FILE_WRITE_ATTRIBUTES);
3047+
CREATE_NOT_FILE, FILE_WRITE_ATTRIBUTES,
3048+
rsp->OplockLevel);
30483049

30493050
SMB2_close(xid, tcon, rsp->PersistentFileId, rsp->VolatileFileId);
30503051

@@ -3321,9 +3322,6 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
33213322
goto creat_exit;
33223323
} else if (rsp == NULL) /* unlikely to happen, but safer to check */
33233324
goto creat_exit;
3324-
else
3325-
trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid,
3326-
oparms->create_options, oparms->desired_access);
33273325

33283326
atomic_inc(&tcon->num_remote_opens);
33293327
oparms->fid->persistent_fid = rsp->PersistentFileId;
@@ -3348,6 +3346,10 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
33483346

33493347
rc = smb2_parse_contexts(server, &rsp_iov, &oparms->fid->epoch,
33503348
oparms->fid->lease_key, oplock, buf, posix);
3349+
3350+
trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid,
3351+
oparms->create_options, oparms->desired_access,
3352+
*oplock);
33513353
creat_exit:
33523354
SMB2_open_free(&rqst);
33533355
free_rsp_buf(resp_buftype, rsp);

fs/smb/client/trace.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,15 +1321,17 @@ DECLARE_EVENT_CLASS(smb3_open_done_class,
13211321
__u32 tid,
13221322
__u64 sesid,
13231323
int create_options,
1324-
int desired_access),
1325-
TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
1324+
int desired_access,
1325+
__u8 oplock),
1326+
TP_ARGS(xid, fid, tid, sesid, create_options, desired_access, oplock),
13261327
TP_STRUCT__entry(
13271328
__field(unsigned int, xid)
13281329
__field(__u64, fid)
13291330
__field(__u32, tid)
13301331
__field(__u64, sesid)
13311332
__field(int, create_options)
13321333
__field(int, desired_access)
1334+
__field(__u8, oplock)
13331335
),
13341336
TP_fast_assign(
13351337
__entry->xid = xid;
@@ -1338,10 +1340,11 @@ DECLARE_EVENT_CLASS(smb3_open_done_class,
13381340
__entry->sesid = sesid;
13391341
__entry->create_options = create_options;
13401342
__entry->desired_access = desired_access;
1343+
__entry->oplock = oplock;
13411344
),
1342-
TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
1345+
TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x oplock=0x%x",
13431346
__entry->xid, __entry->sesid, __entry->tid, __entry->fid,
1344-
__entry->create_options, __entry->desired_access)
1347+
__entry->create_options, __entry->desired_access, __entry->oplock)
13451348
)
13461349

13471350
#define DEFINE_SMB3_OPEN_DONE_EVENT(name) \
@@ -1351,8 +1354,9 @@ DEFINE_EVENT(smb3_open_done_class, smb3_##name, \
13511354
__u32 tid, \
13521355
__u64 sesid, \
13531356
int create_options, \
1354-
int desired_access), \
1355-
TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
1357+
int desired_access, \
1358+
__u8 oplock), \
1359+
TP_ARGS(xid, fid, tid, sesid, create_options, desired_access, oplock))
13561360

13571361
DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
13581362
DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);

0 commit comments

Comments
 (0)