Bug 24221

Summary: mt_resid not updated by scsi_sa.c
Product: Base System Reporter: Jean-Francois Dockes <jean-francois.dockes>
Component: kernAssignee: Matt Jacob <mjacob>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-STABLE   
Hardware: Any   
OS: Any   

Description Jean-Francois Dockes 2001-01-10 14:00:00 UTC
mt_resid is not returned by ioctl MTIOCGET. While the value is 
accessible through ioctl MTIOCERRSTAT, the latter is not portable.
This is not a big issues for read() calls, but is ennoying for MTIOCTOP
operations like fsr, fsf, etc...

Fix: 

Update the mt_resid field,in MTIOCGET using the values from last_ctl_resid or
last_io_resid. This supposes that it's remembered somewhere which was
updated last.
Comment 1 Matt Jacob freebsd_committer freebsd_triage 2001-01-10 19:27:32 UTC
Responsible Changed
From-To: freebsd-bugs->mjacob
Comment 2 mjacob 2001-01-15 22:43:07 UTC
This was actually on purpose. The reason mt_resid is not being updated
is a 'short' is not big enough. I suppose one could make the argument
that you could change it to u_int16_t (which wouldn't change the size of
the struct) and this would serve for the current default 64KB physical
raw i/o blocksize limit. Then, if you get a resid to large, it can overflow.
I'd rather not have people depend on it at all in that case.

I suppose I could change the size in -current, but I can't backport it to 4.2.
I'm not even sure I should do it even in -current because this has implications
for the rmt protocols.

Your point about non-portability has *some* merit- but not too much. The
structure has no POSIX existence- but has become this sort of almost kind
of expected standard.

Given what I said above, what would you like?



Jean-Francois Dockes <jean-francois.dockes@wanadoo.fr> wrote:

> 
> >Number:         24221
> >Category:       kern
> >Synopsis:       mt_resid not updated by scsi_sa.c
> >Confidential:   no
> >Severity:       serious
> >Priority:       low
> >Responsible:    freebsd-bugs
> >State:          open
> >Quarter:        
> >Keywords:       
> >Date-Required:
> >Class:          sw-bug
> >Submitter-Id:   current-users
> >Arrival-Date:   Wed Jan 10 06:00:00 PST 2001
> >Closed-Date:
> >Last-Modified:
> >Originator:     Jean-Francois Dockes
> >Release:        4.2-STABLE
> >Organization:
> >Environment:
> FreeBSD mouton 4.2-STABLE FreeBSD 4.2-STABLE #0: Fri Dec  1 21:47:38 CET 2000     dockes@mouton:/usr/obj/hautmedoc/u/src/sys/HAUTMEDOC  i386
> 
> >Description:
> mt_resid is not returned by ioctl MTIOCGET. While the value is 
> accessible through ioctl MTIOCERRSTAT, the latter is not portable.
> This is not a big issues for read() calls, but is ennoying for MTIOCTOP
> operations like fsr, fsf, etc...
> 
> 
> 
> >How-To-Repeat:
> 
> >Fix:
> Update the mt_resid field,in MTIOCGET using the values from last_ctl_resid or
> last_io_resid. This supposes that it's remembered somewhere which was
> updated last.
> 
> 
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-bugs" in the body of the message
>
Comment 3 Matt Jacob freebsd_committer freebsd_triage 2001-01-16 07:27:30 UTC
State Changed
From-To: open->feedback

Waiting for feedback fom submitter.
Comment 4 Matt Jacob freebsd_committer freebsd_triage 2001-01-22 18:15:29 UTC
State Changed
From-To: feedback->closed

mt_resid is now updated. Even if it overflows.