Commit f87092c4 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'ceph-for-5.0-rc2' of git://github.com/ceph/ceph-client

Pull ceph updates from Ilya Dryomov:
 "A patch to allow setting abort_on_full and a fix for an old "rbd
  unmap" edge case, marked for stable"

* tag 'ceph-for-5.0-rc2' of git://github.com/ceph/ceph-client:
  rbd: don't return 0 on unmap if RBD_DEV_FLAG_REMOVING is set
  ceph: use vmf_error() in ceph_filemap_fault()
  libceph: allow setting abort_on_full for rbd
parents 40a31da4 85f5a4d6
...@@ -5986,7 +5986,6 @@ static ssize_t do_rbd_remove(struct bus_type *bus, ...@@ -5986,7 +5986,6 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
struct list_head *tmp; struct list_head *tmp;
int dev_id; int dev_id;
char opt_buf[6]; char opt_buf[6];
bool already = false;
bool force = false; bool force = false;
int ret; int ret;
...@@ -6019,13 +6018,13 @@ static ssize_t do_rbd_remove(struct bus_type *bus, ...@@ -6019,13 +6018,13 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
spin_lock_irq(&rbd_dev->lock); spin_lock_irq(&rbd_dev->lock);
if (rbd_dev->open_count && !force) if (rbd_dev->open_count && !force)
ret = -EBUSY; ret = -EBUSY;
else else if (test_and_set_bit(RBD_DEV_FLAG_REMOVING,
already = test_and_set_bit(RBD_DEV_FLAG_REMOVING, &rbd_dev->flags))
&rbd_dev->flags); ret = -EINPROGRESS;
spin_unlock_irq(&rbd_dev->lock); spin_unlock_irq(&rbd_dev->lock);
} }
spin_unlock(&rbd_dev_list_lock); spin_unlock(&rbd_dev_list_lock);
if (ret < 0 || already) if (ret)
return ret; return ret;
if (force) { if (force) {
......
...@@ -1494,10 +1494,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf) ...@@ -1494,10 +1494,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf)
if (err < 0 || off >= i_size_read(inode)) { if (err < 0 || off >= i_size_read(inode)) {
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
if (err == -ENOMEM) ret = vmf_error(err);
ret = VM_FAULT_OOM;
else
ret = VM_FAULT_SIGBUS;
goto out_inline; goto out_inline;
} }
if (err < PAGE_SIZE) if (err < PAGE_SIZE)
......
...@@ -530,7 +530,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root) ...@@ -530,7 +530,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
seq_putc(m, ','); seq_putc(m, ',');
pos = m->count; pos = m->count;
ret = ceph_print_client_options(m, fsc->client); ret = ceph_print_client_options(m, fsc->client, false);
if (ret) if (ret)
return ret; return ret;
...@@ -640,7 +640,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, ...@@ -640,7 +640,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
opt = NULL; /* fsc->client now owns this */ opt = NULL; /* fsc->client now owns this */
fsc->client->extra_mon_dispatch = extra_mon_dispatch; fsc->client->extra_mon_dispatch = extra_mon_dispatch;
fsc->client->osdc.abort_on_full = true; ceph_set_opt(fsc->client, ABORT_ON_FULL);
if (!fsopt->mds_namespace) { if (!fsopt->mds_namespace) {
ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP, ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP,
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define CEPH_OPT_NOMSGAUTH (1<<4) /* don't require msg signing feat */ #define CEPH_OPT_NOMSGAUTH (1<<4) /* don't require msg signing feat */
#define CEPH_OPT_TCP_NODELAY (1<<5) /* TCP_NODELAY on TCP sockets */ #define CEPH_OPT_TCP_NODELAY (1<<5) /* TCP_NODELAY on TCP sockets */
#define CEPH_OPT_NOMSGSIGN (1<<6) /* don't sign msgs */ #define CEPH_OPT_NOMSGSIGN (1<<6) /* don't sign msgs */
#define CEPH_OPT_ABORT_ON_FULL (1<<7) /* abort w/ ENOSPC when full */
#define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY) #define CEPH_OPT_DEFAULT (CEPH_OPT_TCP_NODELAY)
...@@ -53,7 +54,7 @@ struct ceph_options { ...@@ -53,7 +54,7 @@ struct ceph_options {
unsigned long osd_request_timeout; /* jiffies */ unsigned long osd_request_timeout; /* jiffies */
/* /*
* any type that can't be simply compared or doesn't need need * any type that can't be simply compared or doesn't need
* to be compared should go beyond this point, * to be compared should go beyond this point,
* ceph_compare_options() should be updated accordingly * ceph_compare_options() should be updated accordingly
*/ */
...@@ -281,7 +282,8 @@ extern struct ceph_options *ceph_parse_options(char *options, ...@@ -281,7 +282,8 @@ extern struct ceph_options *ceph_parse_options(char *options,
const char *dev_name, const char *dev_name_end, const char *dev_name, const char *dev_name_end,
int (*parse_extra_token)(char *c, void *private), int (*parse_extra_token)(char *c, void *private),
void *private); void *private);
int ceph_print_client_options(struct seq_file *m, struct ceph_client *client); int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
bool show_all);
extern void ceph_destroy_options(struct ceph_options *opt); extern void ceph_destroy_options(struct ceph_options *opt);
extern int ceph_compare_options(struct ceph_options *new_opt, extern int ceph_compare_options(struct ceph_options *new_opt,
struct ceph_client *client); struct ceph_client *client);
......
...@@ -354,7 +354,6 @@ struct ceph_osd_client { ...@@ -354,7 +354,6 @@ struct ceph_osd_client {
struct rb_root linger_map_checks; struct rb_root linger_map_checks;
atomic_t num_requests; atomic_t num_requests;
atomic_t num_homeless; atomic_t num_homeless;
bool abort_on_full; /* abort w/ ENOSPC when full */
int abort_err; int abort_err;
struct delayed_work timeout_work; struct delayed_work timeout_work;
struct delayed_work osds_timeout_work; struct delayed_work osds_timeout_work;
......
...@@ -255,6 +255,7 @@ enum { ...@@ -255,6 +255,7 @@ enum {
Opt_nocephx_sign_messages, Opt_nocephx_sign_messages,
Opt_tcp_nodelay, Opt_tcp_nodelay,
Opt_notcp_nodelay, Opt_notcp_nodelay,
Opt_abort_on_full,
}; };
static match_table_t opt_tokens = { static match_table_t opt_tokens = {
...@@ -280,6 +281,7 @@ static match_table_t opt_tokens = { ...@@ -280,6 +281,7 @@ static match_table_t opt_tokens = {
{Opt_nocephx_sign_messages, "nocephx_sign_messages"}, {Opt_nocephx_sign_messages, "nocephx_sign_messages"},
{Opt_tcp_nodelay, "tcp_nodelay"}, {Opt_tcp_nodelay, "tcp_nodelay"},
{Opt_notcp_nodelay, "notcp_nodelay"}, {Opt_notcp_nodelay, "notcp_nodelay"},
{Opt_abort_on_full, "abort_on_full"},
{-1, NULL} {-1, NULL}
}; };
...@@ -535,6 +537,10 @@ ceph_parse_options(char *options, const char *dev_name, ...@@ -535,6 +537,10 @@ ceph_parse_options(char *options, const char *dev_name,
opt->flags &= ~CEPH_OPT_TCP_NODELAY; opt->flags &= ~CEPH_OPT_TCP_NODELAY;
break; break;
case Opt_abort_on_full:
opt->flags |= CEPH_OPT_ABORT_ON_FULL;
break;
default: default:
BUG_ON(token); BUG_ON(token);
} }
...@@ -549,7 +555,8 @@ ceph_parse_options(char *options, const char *dev_name, ...@@ -549,7 +555,8 @@ ceph_parse_options(char *options, const char *dev_name,
} }
EXPORT_SYMBOL(ceph_parse_options); EXPORT_SYMBOL(ceph_parse_options);
int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
bool show_all)
{ {
struct ceph_options *opt = client->options; struct ceph_options *opt = client->options;
size_t pos = m->count; size_t pos = m->count;
...@@ -574,6 +581,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) ...@@ -574,6 +581,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
seq_puts(m, "nocephx_sign_messages,"); seq_puts(m, "nocephx_sign_messages,");
if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0) if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0)
seq_puts(m, "notcp_nodelay,"); seq_puts(m, "notcp_nodelay,");
if (show_all && (opt->flags & CEPH_OPT_ABORT_ON_FULL))
seq_puts(m, "abort_on_full,");
if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT) if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
seq_printf(m, "mount_timeout=%d,", seq_printf(m, "mount_timeout=%d,",
......
...@@ -375,7 +375,7 @@ static int client_options_show(struct seq_file *s, void *p) ...@@ -375,7 +375,7 @@ static int client_options_show(struct seq_file *s, void *p)
struct ceph_client *client = s->private; struct ceph_client *client = s->private;
int ret; int ret;
ret = ceph_print_client_options(s, client); ret = ceph_print_client_options(s, client, true);
if (ret) if (ret)
return ret; return ret;
......
...@@ -2315,7 +2315,7 @@ static void __submit_request(struct ceph_osd_request *req, bool wrlocked) ...@@ -2315,7 +2315,7 @@ static void __submit_request(struct ceph_osd_request *req, bool wrlocked)
(ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) ||
pool_full(osdc, req->r_t.base_oloc.pool))) { pool_full(osdc, req->r_t.base_oloc.pool))) {
dout("req %p full/pool_full\n", req); dout("req %p full/pool_full\n", req);
if (osdc->abort_on_full) { if (ceph_test_opt(osdc->client, ABORT_ON_FULL)) {
err = -ENOSPC; err = -ENOSPC;
} else { } else {
pr_warn_ratelimited("FULL or reached pool quota\n"); pr_warn_ratelimited("FULL or reached pool quota\n");
...@@ -2545,7 +2545,7 @@ static void ceph_osdc_abort_on_full(struct ceph_osd_client *osdc) ...@@ -2545,7 +2545,7 @@ static void ceph_osdc_abort_on_full(struct ceph_osd_client *osdc)
{ {
bool victims = false; bool victims = false;
if (osdc->abort_on_full && if (ceph_test_opt(osdc->client, ABORT_ON_FULL) &&
(ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || have_pool_full(osdc))) (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || have_pool_full(osdc)))
for_each_request(osdc, abort_on_full_fn, &victims); for_each_request(osdc, abort_on_full_fn, &victims);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment