Date: Thu, 7 Apr 2011 13:20:53 -0700 From: Garrett Cooper <yanegomi@gmail.com> To: Andriy Gapon <avg@freebsd.org> Cc: freebsd-fs@freebsd.org, freebsd-scsi@freebsd.org, FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: retry mounting with ro when rw fails Message-ID: <BANLkTimAyh4-T0gQ1cuQn0nm8m7SHwW5iA@mail.gmail.com> In-Reply-To: <4D9DF375.4080506@FreeBSD.org> References: <4D9DF375.4080506@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 7, 2011 at 10:25 AM, Andriy Gapon <avg@freebsd.org> wrote: > > [sorry for double post, it should have been "hackers" not "hardware"] > > Guys, > could you please review and comment on the following patch? > http://people.freebsd.org/~avg/mount-retry-ro.diff > Thank you! > > The patch consists of two parts. > > The first part is in CAM/SCSI to make sure that ENODEV is consistently re= turned to > signal that an operation is not supported by a device (in accordance to i= ntro(2)) > and specifically to return ENODEV on write attempt to a read-only or > write-protected media. =A0Making this change in SCSI should cover real SC= SI devices, > as well as ATAPI through ahci/siis/atapicam or similar, plus majority (al= l?) of > USB Mass Storage devices. > > The second part is in vfs_mount code. =A0The idea is to re-try a mount ca= ll if we > get the ENODEV error, and mounting was not already in read-only mode, and= there > was no explicit rw or noro option; the second try is changed to ro. > > I did only basic testing with an SD card in write-protected mode and a US= B > card-reader. =A0Since I am not very familiar with vfs_mount code I might = have missed > some important details. As a generic question / observation, maybe we should just implement 'errors=3Dremount-ro' (or a reasonable facsimile) like Linux has in our mount(8) command? Doesn't look like NetBSD, OpenBSD, or [Open]Solaris sported similar functionality. Thanks, -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BANLkTimAyh4-T0gQ1cuQn0nm8m7SHwW5iA>