Bug 2177196 - semantic error: unable to find member 'request' for struct scsi_cmnd - rawhide
Summary: semantic error: unable to find member 'request' for struct scsi_cmnd - rawhide
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: systemtap
Version: 39
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Frank Ch. Eigler
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-10 11:25 UTC by Martin Cermak
Modified: 2023-08-16 07:11 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Martin Cermak 2023-03-10 11:25:35 UTC
[root@rawh semantic-errors-bz1062076]# uname -r; rpm -qf `which stap`; stap -vp4 script.stp
6.2.0-0.rc8.57.fc39.x86_64
systemtap-devel-4.8-5.fc39.x86_64
systemtap-client-4.8-5.fc39.x86_64
Pass 1: parsed user script and 493 library scripts using 141076virt/111788res/15872shr/95156data kb, in 210usr/60sys/326real ms.
semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at /usr/share/systemtap/tapset/linux/scsi.stp:189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :189:66
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                                                                        ^

semantic error: unresolved type : operator '@cast' at :189:24
        source:         return timer_pending(&@cast(cmd, "scsi_cmnd", "kernel:scsi_mod")->request->q->timeout)
                                              ^

semantic error: unable to find member 'request' for struct scsi_cmnd (alternatives: result, retries, sdb, rcu, cmnd, eh_entry, flags, state, device, allowed, cmd_len, extra_len, prot_op, prot_sdb, sense_len, eh_eflags, resid_len, underflow, abort_work, prot_type, submitter, prot_flags, sense_buffer, transfersize, budget_token, host_scribble, sc_data_direction, jiffies_at_alloc): operator '->' at :145:17
        source:         req_addr = $cmd->request
                                       ^

Pass 2: analyzed script: 5 probes, 31 functions, 5 embeds, 1 global using 456008virt/419316res/20528shr/410088data kb, in 8420usr/1660sys/10179real ms.
Pass 2: analysis failed.  [man error::pass2]
[root@rawh semantic-errors-bz1062076]#

Comment 1 William Cohen 2023-08-10 20:22:04 UTC
The following patch in the kernel removes the request field from struct scsi_cmnd:

commit 2266a2def97ce11ec979b6c58a1b637a16eca7dd
Author: Bart Van Assche <bvanassche>
Date:   Mon Aug 9 16:03:55 2021 -0700

    scsi: core: Remove the request member from struct scsi_cmnd
    
    Since all scsi_cmnd.request users are gone, remove the request pointer
    from struct scsi_cmnd.
    
    Link: https://lore.kernel.org/r/20210809230355.8186-53-bvanassche@acm.org
    Cc: Christoph Hellwig <hch>
    Cc: Hannes Reinecke <hare>
    Cc: Ming Lei <ming.lei>
    Signed-off-by: Bart Van Assche <bvanassche>
    Signed-off-by: Martin K. Petersen <martin.petersen>

There is a replacement function scsi_cmd_to_rq() addeded by the following commit that provides the information originally stored in the request field:

commit 51f3a478892873337c54068d1185bcd797000a52
Author: Bart Van Assche <bvanassche>
Date:   Mon Aug 9 16:03:04 2021 -0700

    scsi: core: Introduce the scsi_cmd_to_rq() function
    
    The 'request' member of struct scsi_cmnd is superfluous. The struct request
    and struct scsi_cmnd data structures are adjacent and hence the request
    pointer can be derived easily from a scsi_cmnd pointer. Introduce a helper
    function that performs that conversion in a type-safe way. This patch is
    the first step towards removing the request member from struct
    scsi_cmnd. Making that change has the following advantages:
    
     - This is a performance optimization since adding an offset to a pointer
       takes less time than dereferencing a pointer.
    
     - struct scsi_cmnd becomes smaller.
    
    Link: https://lore.kernel.org/r/20210809230355.8186-2-bvanassche@acm.org
    Cc: Christoph Hellwig <hch>
    Cc: Hannes Reinecke <hare>
    Cc: Ming Lei <ming.lei>
    Reviewed-by: Hannes Reinecke <hare>

Need to have the scsi.stp tapset use scsi_cmd_to_rq() in newer kernels (kernel_v >= "5.15") for the various probes and scsi_timer_pending() accessing the request field.

Comment 2 Fedora Release Engineering 2023-08-16 07:11:26 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.


Note You need to log in before you can comment on or make changes to this bug.