[230] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: st driver open(O_WRONLY) of write-protected tape

daemon@ATHENA.MIT.EDU (Andreas Koppenhoefer)
Tue Jun 6 08:24:22 1995

From: Andreas Koppenhoefer <koppenas@koppenas.informatik.uni-stuttgart.de>
To: Kai.Makisara@metla.fi
Date: Tue, 6 Jun 1995 12:57:25 +0200 (MET DST)
Cc: linux-scsi@vger.rutgers.edu
Reply-To: Andreas.Koppenhoefer@studbox.uni-stuttgart.de (Andreas Koppenhoefer)
In-Reply-To: <Pine.OSF.3.91.950604102133.3060A-100000@abies.metla.fi> from "Kai Makisara" at Jun 4, 95 10:29:56 am

-----BEGIN PGP SIGNED MESSAGE-----

> Date: Sun, 4 Jun 1995 10:29:56 +0300 (EET DST)
> From: Kai Makisara <makisara@abies.metla.fi>
> To: "Brandon S. Allbery KF8NH" <bsa@kf8nh.wariat.org>
> Cc: linux-scsi@vger.rutgers.edu
> Subject: Re: st driver open(O_WRONLY) of write-protected tape
>
> On Sat, 3 Jun 1995, Brandon S. Allbery KF8NH wrote:
> ...
> > and got a write error "Permission denied" and an aborted backup instead of a 
> > re-prompt for the device as GNU tar normally does.  This led me to look at 
> > st.c, where I found that opening a write-protected tape actuallty opens the 
> > tape read-only but causes writes to return -EPERM.
> > 
> > README.st makes no mention of this unexpected behavior.  Is it in fact 
> > deliberate, and if so why?  I would much prefer not having to start over in 
I agree with Brandon: st.c whould return -EPERM as fast as possible.

> The reason for this behavior is probably to prevent problems with the 
> programs that open the device for read/write even if they don't always
> need to write. I did not think about multivolume tars at that moment.

I think we can call it bad programming style if someone opens
files/devices O_RDWR if he/she never wants to write to.

> The quick patch at the end of this message changes the behaviour so that 
> the tar problem disappears. Returning EPERM if a write-protected tape is 
> opened O_WRONLY is certainly sensible but should we do that also for O_RDWR?

Yes! That's the way other OS are handling this (like Solaris/SunOS).
Please send your quick patch to Linus making it permanent.

Andreas
- -- 
Andreas Koppenhoefer, Student der Universitaet Stuttgart, BR Deutschland 
prefered languages: German, English, C, perl ("Just another Perl hacker,")
SMTP:   koppenas@informatik.uni-stuttgart.de            (university address)
        Andreas.Koppenhoefer@studbox.uni-stuttgart.de   (my home address)
privat: Belaustr. 5/3, D-70195 Stuttgart, Germany,
	Earth, Sector ZZ9 plural Z alpha
phone:  +49 711 694111 and +49 711 6999006 (19-22h MEZ=GMT+1)

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQBVAgUBL9Q0d0VdjNvyndGpAQHN3QIAuxIrwBdu+xUp9xPzuSFZUqmn4ZTNAFbf
bYYrIfyxfXKq9R0AiIkGOsm44lDzMVnYFk2P9Y0jTAZyQm5hU2dJpA==
=emjE
-----END PGP SIGNATURE-----

home help back first fref pref prev next nref lref last post