Introduce a new option abort_on_full, default to false. Then
we can get -ENOSPC when the pool is full, or reaches quota.
Signed-off-by: Dongsheng Yang <dongsheng.yang@xxxxxxxxxxxx>
---
drivers/block/rbd.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8e5140b..7cd35e2 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -744,6 +744,7 @@ enum {
Opt_lock_on_read,
Opt_exclusive,
Opt_notrim,
+ Opt_abort_on_full,
Opt_err
};
@@ -760,6 +761,7 @@ enum {
{Opt_lock_on_read, "lock_on_read"},
{Opt_exclusive, "exclusive"},
{Opt_notrim, "notrim"},
+ {Opt_abort_on_full, "abort_on_full"},
{Opt_err, NULL}
};
@@ -770,6 +772,7 @@ struct rbd_options {
bool lock_on_read;
bool exclusive;
bool trim;
+ bool abort_on_full;
};
#define RBD_QUEUE_DEPTH_DEFAULT BLKDEV_MAX_RQ
@@ -778,6 +781,7 @@ struct rbd_options {
#define RBD_LOCK_ON_READ_DEFAULT false
#define RBD_EXCLUSIVE_DEFAULT false
#define RBD_TRIM_DEFAULT true
+#define RBD_ABORT_ON_FULL_DEFAULT false
struct parse_rbd_opts_ctx {
struct rbd_spec *spec;
@@ -841,6 +845,9 @@ static int parse_rbd_opts_token(char *c, void *private)
case Opt_notrim:
pctx->opts->trim = false;
break;
+ case Opt_abort_on_full:
+ pctx->opts->abort_on_full = true;
+ break;
default:
/* libceph prints "bad option" msg */
return -EINVAL;
@@ -5393,6 +5400,7 @@ static int rbd_add_parse_args(const char *buf,
pctx.opts->lock_on_read = RBD_LOCK_ON_READ_DEFAULT;
pctx.opts->exclusive = RBD_EXCLUSIVE_DEFAULT;
pctx.opts->trim = RBD_TRIM_DEFAULT;
+ pctx.opts->abort_on_full = RBD_ABORT_ON_FULL_DEFAULT;
copts = ceph_parse_options(options, mon_addrs,
mon_addrs + mon_addrs_size - 1,
@@ -5851,6 +5859,8 @@ static ssize_t do_rbd_add(struct bus_type *bus,
goto err_out_args;
}
+ rbdc->client->osdc.abort_on_full = rbd_opts->abort_on_full;
+
/* pick the pool */
rc = ceph_pg_poolid_by_name(rbdc->client->osdc.osdmap, spec->pool_name);
if (rc < 0) {