From patchwork Tue Feb 15 15:16:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Broz X-Patchwork-Id: 559071 X-Patchwork-Delegate: agk@redhat.com Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1FFImDb002741 for ; Tue, 15 Feb 2011 15:19:10 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1FFGVcN014948; Tue, 15 Feb 2011 10:16:32 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1FFGVSk013184 for ; Tue, 15 Feb 2011 10:16:31 -0500 Received: from [10.36.6.176] (vpn1-6-176.ams2.redhat.com [10.36.6.176]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1FFGNMr011695; Tue, 15 Feb 2011 10:16:24 -0500 Message-ID: <4D5A98C7.3070803@redhat.com> Date: Tue, 15 Feb 2011 16:16:23 +0100 From: Milan Broz User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101213 Thunderbird/3.1.7 MIME-Version: 1.0 To: device-mapper development References: <4D57E67E.1030707@redhat.com> <4D57F357.6060708@tao.ma> <4D580A8B.5050508@redhat.com> <20110214103026.GA18742@htj.dyndns.org> <4D591664.6090203@redhat.com> <4D592AD1.6020500@redhat.com> <20110214140940.GM18742@htj.dyndns.org> <4D593AD8.7070901@redhat.com> <20110214154430.GR18742@htj.dyndns.org> <20110215101506.43d41ca8@notabene.brown> <20110215020351.GD5825@agk-dp.fab.redhat.com> <4D5A6EF4.3030905@redhat.com> In-Reply-To: <4D5A6EF4.3030905@redhat.com> X-Enigmail-Version: 1.1.2 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-loop: dm-devel@redhat.com Cc: Tejun Heo , Jens Axboe , Tao Ma , linux-kernel@vger.kernel.org Subject: [dm-devel] [PATCH] Return EROFS if read-only detected on block device X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 15 Feb 2011 15:19:10 +0000 (UTC) diff --git a/fs/block_dev.c b/fs/block_dev.c index c9cf9f7..db2c8db 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1219,7 +1219,7 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder) /* __blkdev_get() may alter read only status, check it afterwards */ if (!res && (mode & FMODE_WRITE) && bdev_read_only(bdev)) { __blkdev_put(bdev, mode, 0); - res = -EACCES; + res = -EROFS; } if (whole) {