Date: Thu, 10 Oct 2002 15:47:44 +0300 (EEST) From: "Diomidis D. Spinellis" <dds@istlab.dmst.aueb.gr> To: FreeBSD-gnats-submit@FreeBSD.org Subject: docs/43891: Undocumented behavior: write(2) over a disk label returns EROFS Message-ID: <200210101247.g9ACliFJ030892@istlab.dmst.aueb.gr>
next in thread | raw e-mail | index | archive | help
>Number: 43891 >Category: docs >Synopsis: Undocumented behavior: write(2) over a disk label returns EROFS >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 10 05:50:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Diomidis D. Spinellis >Release: FreeBSD 4.6.2-RELEASE-p2 i386 >Organization: AUEB >Environment: System: FreeBSD istlab.dmst.aueb.gr 4.6.2-RELEASE-p2 FreeBSD 4.6.2-RELEASE-p2 #5: Wed Sep 18 12:07:12 EEST 2002 root@istlab.dmst.aueb.gr:/usr/obj/usr/src/sys/ISTLAB i386 >Description: Writing over a disk label results in write(2) returning EROFS. The EROFS return value is not documented in the write(2) man page. The disklabel(8) man page claims that the driver does silently ignore writing over disk labels. >How-To-Repeat: strace dd if=/dev/zero of=/dev/ad0 If you feel nervous abour running the above command (I certainly would, it can trash the entire disk) search for EROFS in src/sys/kern/subr_diskslice.c >Fix: I propose fixing the documentation to conform to the code; silently ignoring requests is bad behaviour. Apply the following fix: *** disklabel.8 2002/10/10 11:52:48 1.1 --- disklabel.8 2002/10/10 11:58:07 *************** *** 311,317 **** .Ss Enabling and disabling writing to the disk label area .Pp By default, it is not possible to write to the disk label area at the beginning ! of a disk. The disk driver silently ignores any attempt to do so. If you need to write to this area (for example, to obliterate the label), use the form .Pp .Nm --- 311,320 ---- .Ss Enabling and disabling writing to the disk label area .Pp By default, it is not possible to write to the disk label area at the beginning ! of a disk. The disk driver arranges for ! .Xr write 2 ! and similar system calls ! to return EROFS on any attempt to do so. If you need to write to this area (for example, to obliterate the label), use the form .Pp .Nm *** write.2 2002/10/10 11:52:48 1.1 --- write.2 2002/10/10 12:08:09 *************** *** 171,176 **** --- 171,183 ---- .It Bq Er EAGAIN The file was marked for non-blocking I/O, and no data could be written immediately. + .It Bq Er EROFS + An attempt was made to write over a disk label area at the beginning + of a disk. + Use + .Xr disklabel 8 + .Fl W + to enable writing on the disk label area. .El .Pp In addition, >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210101247.g9ACliFJ030892>