From patchwork Wed Feb 16 17:32:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Broz X-Patchwork-Id: 567861 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 p1GHYfSt022492 for ; Wed, 16 Feb 2011 17:35:02 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 p1GHWLbj027391; Wed, 16 Feb 2011 12:32:22 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1GHWKYZ015325 for ; Wed, 16 Feb 2011 12:32:20 -0500 Received: from tawny.mazyland.cz (tawny.brq.redhat.com [10.34.26.53]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p1GHWDkO017031; Wed, 16 Feb 2011 12:32:14 -0500 From: Milan Broz To: dm-devel@redhat.com Date: Wed, 16 Feb 2011 18:32:05 +0100 Message-Id: <1297877525-10163-1-git-send-email-mbroz@redhat.com> In-Reply-To: <1297777960-22662-2-git-send-email-mbroz@redhat.com> References: <1297777960-22662-2-git-send-email-mbroz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-loop: dm-devel@redhat.com Cc: Milan Broz Subject: [dm-devel] [PATCH] Use only specific errors when failing dm-ioctl 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: , MIME-Version: 1.0 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]); Wed, 16 Feb 2011 17:35:02 +0000 (UTC) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 38e4eb1..ca19e4d 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -532,7 +532,17 @@ EXPORT_SYMBOL_GPL(dm_set_device_limits); int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, struct dm_dev **result) { - return __table_get_device(ti->table, ti, path, mode, result); + int r = __table_get_device(ti->table, ti, path, mode, result); + + /* + * Return code is directly used for dm ioctl. + * Allow only ENOMEM here, all other codes + * means device lookup failed. + */ + if (r && r != -ENOMEM) + r = -ENXIO; + + return r; }