From owner-freebsd-fs@FreeBSD.ORG Thu Apr 7 20:43:38 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E189106566B; Thu, 7 Apr 2011 20:43:38 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id D3DBA8FC15; Thu, 7 Apr 2011 20:43:37 +0000 (UTC) Received: by pvg11 with SMTP id 11so1297419pvg.13 for ; Thu, 07 Apr 2011 13:43:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=JX+fEMf/0gprv0XxszezUm4x3vq6rUMb2kC0B7E8C8o=; b=Hzgbeo2qKBMWoeW/1vZKQfTQ7UTwU+Tqq/kaOHYRuYnPP87vcM36ltak931OBX/Kz/ FYn/KsOa7kg5mlyXYgmlTm/FcLjqWKSRGPlZCav5aKMFbH6hQKc0vA6BpLKtmV611ZeT oxZcueCen43LkNE0fd6sX0KfR7LlDYfttsKvo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=pwrrDY5AguWvPp5dhR77gMc9VYODZJL3d70dzgqdO5k+7OOaqCfkOqt9e4hkJuz5Yr ISW+fU725NeZKGpfO4wWE4XN/4SUsO+QwyZe64zvFFe7HHPOkiCBtJSn0H9NnmsJzp3S /6n2Mt6F1/5B8YI6RfyKRFLM7Dh5vjOFQ7wtY= MIME-Version: 1.0 Received: by 10.143.39.17 with SMTP id r17mr964391wfj.113.1302207653707; Thu, 07 Apr 2011 13:20:53 -0700 (PDT) Received: by 10.68.42.3 with HTTP; Thu, 7 Apr 2011 13:20:53 -0700 (PDT) In-Reply-To: <4D9DF375.4080506@FreeBSD.org> References: <4D9DF375.4080506@FreeBSD.org> Date: Thu, 7 Apr 2011 13:20:53 -0700 Message-ID: From: Garrett Cooper To: Andriy Gapon Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-fs@freebsd.org, freebsd-scsi@freebsd.org, FreeBSD Hackers Subject: Re: retry mounting with ro when rw fails X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2011 20:43:38 -0000 On Thu, Apr 7, 2011 at 10:25 AM, Andriy Gapon 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