diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2015-10-15 15:38:57 +0200 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-11-02 23:36:48 +0100 |
commit | b51c83c241910f66b0c9a2ab17cd57db8109a98f (patch) | |
tree | c8366f8776ecc5219722e25e1a3525044bddc9a5 /drivers/block/rbd.c | |
parent | 343128ce91836d4131ead74b53d83b72e93d55b2 (diff) | |
download | linux-b51c83c241910f66b0c9a2ab17cd57db8109a98f.tar.gz linux-b51c83c241910f66b0c9a2ab17cd57db8109a98f.tar.xz |
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>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 6 |
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, struct rbd_spec *spec = NULL; struct rbd_client *rbdc; bool read_only; - int rc = -ENOMEM; + int rc; if (!try_module_get(THIS_MODULE)) return -ENODEV; @@ -5432,8 +5432,10 @@ static ssize_t do_rbd_add(struct bus_type *bus, } rbd_dev = rbd_dev_create(rbdc, spec, rbd_opts); - if (!rbd_dev) + if (!rbd_dev) { + rc = -ENOMEM; goto err_out_client; + } rbdc = NULL; /* rbd_dev now owns this */ spec = NULL; /* rbd_dev now owns this */ rbd_opts = NULL; /* rbd_dev now owns this */ |