aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2015-10-15 09:38:57 -0400
committerIlya Dryomov <idryomov@gmail.com>2015-11-02 17:36:48 -0500
commitb51c83c241910f66b0c9a2ab17cd57db8109a98f (patch)
treec8366f8776ecc5219722e25e1a3525044bddc9a5
parent343128ce91836d4131ead74b53d83b72e93d55b2 (diff)
rbd: return -ENOMEM instead of pool id if rbd_dev_create() fails
Returning pool id (i.e. >= 0) from a sysfs ->store() callback makes userspace think it needs to retry the write. Fix it - it's a leftover from the times when the equivalent of rbd_dev_create() was the first action in rbd_add(). Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--drivers/block/rbd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8f3dcb66c8ba..5e7234dbd836 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5397,7 +5397,7 @@ static ssize_t do_rbd_add(struct bus_type *bus,
5397 struct rbd_spec *spec = NULL; 5397 struct rbd_spec *spec = NULL;
5398 struct rbd_client *rbdc; 5398 struct rbd_client *rbdc;
5399 bool read_only; 5399 bool read_only;
5400 int rc = -ENOMEM; 5400 int rc;
5401 5401
5402 if (!try_module_get(THIS_MODULE)) 5402 if (!try_module_get(THIS_MODULE))
5403 return -ENODEV; 5403 return -ENODEV;
@@ -5432,8 +5432,10 @@ static ssize_t do_rbd_add(struct bus_type *bus,
5432 } 5432 }
5433 5433
5434 rbd_dev = rbd_dev_create(rbdc, spec, rbd_opts); 5434 rbd_dev = rbd_dev_create(rbdc, spec, rbd_opts);
5435 if (!rbd_dev) 5435 if (!rbd_dev) {
5436 rc = -ENOMEM;
5436 goto err_out_client; 5437 goto err_out_client;
5438 }
5437 rbdc = NULL; /* rbd_dev now owns this */ 5439 rbdc = NULL; /* rbd_dev now owns this */
5438 spec = NULL; /* rbd_dev now owns this */ 5440 spec = NULL; /* rbd_dev now owns this */
5439 rbd_opts = NULL; /* rbd_dev now owns this */ 5441 rbd_opts = NULL; /* rbd_dev now owns this */