bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] Invalid IOCTL command send to tape-driver


From: Frans Pop
Subject: [Bug-tar] Invalid IOCTL command send to tape-driver
Date: Sun, 19 Oct 2003 12:58:45 +0200
User-agent: KMail/1.5.4

tar version: 1.13.25

I have been debugging the Linux kernel ide-tape driver with 'tar cf /dev/tape 
--verify <filespec>'. While I was analysing and fixing some problems with the 
ide-tape driver I also noticed the following lines in my debug log:
    ide-tape: File operation idetape_chrdev_ioctl, cmd=Unknown IOCTL (587)
    ide-tape: Reached idetape_blkdev_ioctl [cmd 0x024b]
    ide-tape: hdc: Unsupported IOCTL: [cmd 0x024b]
(Some of the debug statements to print these lines were added by me.)

The cause of these errors seems to be a minor bug in the verify operation in 
tar. In compare.c I found the following code:

<----code snippet from compare.c---->
verify_volume (void)
{
  if (!diff_buffer)
    diff_init ();

  /* Verifying an archive is meant to check if the physical media got it
     correctly, so try to defeat clever in-memory buffering pertaining to
     this particular media.  On Linux, for example, the floppy drive would
     not even be accessed for the whole verification.

     The code was using fsync only when the ioctl is unavailable, but
     Marty Leisner says that the ioctl does not work when not preceded by
     fsync.  So, until we know better, or maybe to please Marty, let's do it
     the unbelievable way :-).  */

#if HAVE_FSYNC
  fsync (archive);
#endif
#ifdef FDFLUSH
  ioctl (archive, FDFLUSH);
#endif

#ifdef MTIOCTOP
  {
    struct mtop operation;
    int status;

    operation.mt_op = MTBSF;
    operation.mt_count = 1;
    if (status = rmtioctl (archive, MTIOCTOP, (char *) &operation),
        status < 0)
<----code snippet end---->

In /usr/include/linux/fd.h I found:
   #define FDFLUSH  _IO(2,0x4b)
So the IOCTL in my debug log seem to be caused by the line:
   ioctl (archive, FDFLUSH);

My conclusion is that tar is incorrectly sending an IOCTL (FDFLUSH) that is 
meant for floppy devices to my tape driver.


I am using Debian GNU/Linux 3.0r1 (Woody) with kernel updated to 2.4.21-pre4 
on i686 and libc6 2.2.5-11.2.

Kind regards,

Frans Pop

P.S: this bug has also been reported in Debian, see
     http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=184090





reply via email to

[Prev in Thread] Current Thread [Next in Thread]