Skip to contentSkip to conversation

ceph kernel client ENOSPC handling

PATCH In review John Spray 2 participants 9 messages Nov 4, 2014

Subsystems (2)
lore
Share & tools
lore

John Spray

author
#0 lore raw

cover ceph kernel client ENOSPC handling

This series implements the kclient equivalents of recent userspace changes for http://tracker.ceph.com/issues/7317

We modify the client's behaviour on the OSD map full flag to cancel ops instead of blocking them, and we add a new 'osd epoch barrier' concept in the client-server protocol to ensure that nobody else can touch a file who had an operation cancelled until they have the subsequent OSD map, to ensure ordering. The epoch barrier will also be important in the future for stricter client eviction.

John Spray (7):
ceph: update ceph_msg_header structure
ceph: remove unused map_waiters from osdc client
ceph: add ceph_osdc_cancel_writes
ceph: handle full condition by cancelling ops
ceph: update CAPRELEASE message format
ceph: handle new osdmap barrier field in CLIENTCAPS
ceph: include osd epoch barrier in debugfs

 fs/ceph/caps.c                  | 110 +++++++++++++++++++++++++++++++++++--
 fs/ceph/debugfs.c               |   3 ++
 fs/ceph/mds_client.c            | 116 +++++++++++++++++++++++++++++++++++++++-
 fs/ceph/mds_client.h            |  18 ++++++-
 fs/ceph/super.h                 |   3 +-
 include/linux/ceph/msgr.h       |   3 +-
 include/linux/ceph/osd_client.h |   9 +++-
 net/ceph/osd_client.c           |  68 ++++++++++++++++++++++-
 8 files changed, 319 insertions(+), 11 deletions(-)
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH 1/7 ceph: update ceph_msg_header structure

2 bytes of what was reserved space is now used by
userspace for the compat_version field.

---
 include/linux/ceph/msgr.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/linux/ceph/msgr.h +2 -1
index cac4b28..1c18872 100644
@@ -152,7 +152,8 @@ struct ceph_msg_header {
 			     receiver: mask against ~PAGE_MASK */
 
 	struct ceph_entity_name src;
-	__le32 reserved;
+	__le16 compat_version;
+	__le16 reserved;
 	__le32 crc;       /* header crc32c */
 } __attribute__ ((packed));
 
Signature · 1 line
1.9.3
author
#2 lore raw

PATCH 2/7 ceph: remove unused `map_waiters` from osdc client

In reply to John Spray

This is initialized but never used.

---
 include/linux/ceph/osd_client.h | 1 -
 net/ceph/osd_client.c           | 1 -
 2 files changed, 2 deletions(-)
include/linux/ceph/osd_client.h +0 -1
index 03aeb27..7cb5cea 100644
@@ -197,7 +197,6 @@ struct ceph_osd_client {
 
 	struct ceph_osdmap     *osdmap;       /* current map */
 	struct rw_semaphore    map_sem;
-	struct completion      map_waiters;
 	u64                    last_requested_map;
 
 	struct mutex           request_mutex;
net/ceph/osd_client.c +0 -1
index 5a75395..75ab07c 100644
@@ -2537,7 +2537,6 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)
 	osdc->client = client;
 	osdc->osdmap = NULL;
 	init_rwsem(&osdc->map_sem);
-	init_completion(&osdc->map_waiters);
 	osdc->last_requested_map = 0;
 	mutex_init(&osdc->request_mutex);
 	osdc->last_tid = 0;
Signature · 1 line
1.9.3
author
#3 lore raw

PATCH 3/7 ceph: add ceph_osdc_cancel_writes

In reply to John Spray

To allow us to abort writes in ENOSPC conditions, instead of having them block indefinitely.

---
 include/linux/ceph/osd_client.h |  8 +++++
 net/ceph/osd_client.c           | 67 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
include/linux/ceph/osd_client.h +8 -0
index 7cb5cea..f82000c 100644
@@ -21,6 +21,7 @@ struct ceph_authorizer;
 /*
  * completion callback for async writepages
  */
+typedef void (*ceph_osdc_full_callback_t)(struct ceph_osd_client *, void *);
 typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *,
 				     struct ceph_msg *);
 typedef void (*ceph_osdc_unsafe_callback_t)(struct ceph_osd_request *, bool);
@@ -226,6 +227,9 @@ struct ceph_osd_client {
 	u64			event_count;
 
 	struct workqueue_struct	*notify_wq;
+
+    ceph_osdc_full_callback_t map_cb;
+    void                     *map_p;
 };
 
 extern int ceph_osdc_setup(void);
@@ -331,6 +335,7 @@ extern void ceph_osdc_put_request(struct ceph_osd_request *req);
 extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
 				   struct ceph_osd_request *req,
 				   bool nofail);
+extern u32 ceph_osdc_cancel_writes(struct ceph_osd_client *osdc, int r);
 extern void ceph_osdc_cancel_request(struct ceph_osd_request *req);
 extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
 				  struct ceph_osd_request *req);
@@ -361,5 +366,8 @@ extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
 				  void *data, struct ceph_osd_event **pevent);
 extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
 extern void ceph_osdc_put_event(struct ceph_osd_event *event);
+
+extern void ceph_osdc_register_map_cb(struct ceph_osd_client *osdc,
+				  ceph_osdc_full_callback_t cb, void *data);
 #endif
 
net/ceph/osd_client.c +67 -0

91 lines not on this page · raw message

Signature · 1 line
1.9.3
#4 lore raw

Re: [PATCH 3/7] ceph: add ceph_osdc_cancel_writes

Quoted 2 lines · John Spray

To allow us to abort writes in ENOSPC conditions, instead of having them block indefinitely.

I just saw the word "cancel", and as we've had trouble in this area in libceph in the past, a couple nit-pickings.

First, in my mind at least, "cancel" is sort of reserved for the "get rid of this request and don't call any completions or callbacks" kind of thing - see ceph_osdc_cancel_request(). Here you do both of those, so maybe rename to something like ceph_osdc_complete_writes() to keep the distinction?

Second, you should go through Documentation/CodingStyle in the kernel tree. Mostly indentation is what's wrong, also don't indent dout()s, drop braces around single-statement if and the two parameters of ceph_osdc_cancel_writes() will fit on a single line.

Third, this patch should have a "libceph:" prefix.

Finally, this patch seems to also introduce a concept of a osdmap callback. Either it should be a separate libceph patch or you should mention this somewhere in the description.

Quoted 69 lines
---
 include/linux/ceph/osd_client.h |  8 +++++
 net/ceph/osd_client.c           | 67 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
include/linux/ceph/osd_client.h +8 -0
index 7cb5cea..f82000c 100644
@@ -21,6 +21,7 @@ struct ceph_authorizer;
 /*
  * completion callback for async writepages
  */
+typedef void (*ceph_osdc_full_callback_t)(struct ceph_osd_client *, void *);
 typedef void (*ceph_osdc_callback_t)(struct ceph_osd_request *,
                                     struct ceph_msg *);
 typedef void (*ceph_osdc_unsafe_callback_t)(struct ceph_osd_request *, bool);
@@ -226,6 +227,9 @@ struct ceph_osd_client {
        u64                     event_count;
 
        struct workqueue_struct *notify_wq;
+
+    ceph_osdc_full_callback_t map_cb;
+    void                     *map_p;
 };
 
 extern int ceph_osdc_setup(void);
@@ -331,6 +335,7 @@ extern void ceph_osdc_put_request(struct ceph_osd_request *req);
 extern int ceph_osdc_start_request(struct ceph_osd_client *osdc,
                                   struct ceph_osd_request *req,
                                   bool nofail);
+extern u32 ceph_osdc_cancel_writes(struct ceph_osd_client *osdc, int r);
 extern void ceph_osdc_cancel_request(struct ceph_osd_request *req);
 extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc,
                                  struct ceph_osd_request *req);
@@ -361,5 +366,8 @@ extern int ceph_osdc_create_event(struct ceph_osd_client *osdc,
                                  void *data, struct ceph_osd_event **pevent);
 extern void ceph_osdc_cancel_event(struct ceph_osd_event *event);
 extern void ceph_osdc_put_event(struct ceph_osd_event *event);
+
+extern void ceph_osdc_register_map_cb(struct ceph_osd_client *osdc,
+                                 ceph_osdc_full_callback_t cb, void *data);
 #endif
 
net/ceph/osd_client.c +15 -0
index 75ab07c..eb7e735 100644
@@ -836,6 +836,59 @@ __lookup_request_ge(struct ceph_osd_client *osdc,
        return NULL;
 }
 
+/*
+ * Drop all pending write/modify requests and complete
+ * them with the `r` as return code.
+ *
+ * Returns the highest OSD map epoch of a request that was
+ * cancelled, or 0 if none were cancelled.
+ */
+u32 ceph_osdc_cancel_writes(
+        struct ceph_osd_client *osdc,
+        int r)
+{
+    struct ceph_osd_request *req;
+    struct rb_node *n = osdc->requests.rb_node;
+    u32 latest_epoch = 0;
+

net/ceph/osd_client.c __lookup_request_ge(struct ceph_osd_client *osdc, · line 863

Quoted 10 lines
net/ceph/osd_client.c +10 -0
+       dout("enter cancel_writes r=%d", r);
+
+    mutex_lock(&osdc->request_mutex);
+
+    while (n) {
+        req = rb_entry(n, struct ceph_osd_request, r_node);
+        n = rb_next(n);
+
+        ceph_osdc_get_request(req);
+        if (req->r_flags && CEPH_OSD_FLAG_WRITE) {

req->r_flags & CEPH_OSD_FLAG_WRITE ?

Quoted 43 lines
net/ceph/osd_client.c +32 -0
+            req->r_result = r;
+            complete_all(&req->r_completion);
+            complete_all(&req->r_safe_completion);
+
+            if (req->r_callback) {
+                // Requires callbacks used for write ops are
+                // amenable to being called with NULL msg
+                // (e.g. writepages_finish)
+                req->r_callback(req, NULL);
+            }
+
+            __unregister_request(osdc, req);
+
+            if (*req->r_request_osdmap_epoch > latest_epoch) {
+                latest_epoch = *req->r_request_osdmap_epoch;
+            }
+        }
+        ceph_osdc_put_request(req);
+    }
+
+    mutex_unlock(&osdc->request_mutex);
+
+       dout("complete cancel_writes latest_epoch=%ul", latest_epoch);
+
+    return latest_epoch;
+}
+EXPORT_SYMBOL(ceph_osdc_cancel_writes);
+
 static void __kick_linger_request(struct ceph_osd_request *req)
 {
        struct ceph_osd_client *osdc = req->r_osdc;
@@ -2102,6 +2155,10 @@ done:
        downgrade_write(&osdc->map_sem);
        ceph_monc_got_osdmap(&osdc->client->monc, osdc->osdmap->epoch);
 
+       if (osdc->map_cb) {
+               osdc->map_cb(osdc, osdc->map_p);
+       }
+
        /*
         * subscribe to subsequent osdmap updates if full to ensure
         * we find out when we are no longer full and stop returning

net/ceph/osd_client.c bad: · line 2186

Quoted 5 lines
net/ceph/osd_client.c +2 -0
@@ -2125,6 +2182,14 @@ bad:
        up_write(&osdc->map_sem);
 }
 
+void ceph_osdc_register_map_cb(struct ceph_osd_client *osdc,
+        ceph_osdc_full_callback_t cb, void *data)

ceph_osdc_map_callback_t? It's called on the way out from handle map and doesn't look specific to ENOSPC handling.

Thanks,

Ilya

Quoted 25 lines
net/ceph/osd_client.c +8 -1
+{
+    osdc->map_cb = cb;
+    osdc->map_p = data;
+}
+EXPORT_SYMBOL(ceph_osdc_register_map_cb);
+
 /*
  * watch/notify callback event infrastructure
  *
@@ -2553,6 +2618,8 @@ int ceph_osdc_init(struct ceph_osd_client *osdc, struct ceph_client *client)
        spin_lock_init(&osdc->event_lock);
        osdc->event_tree = RB_ROOT;
        osdc->event_count = 0;
+       osdc->map_cb = NULL;
+       osdc->map_p = NULL;
 
        schedule_delayed_work(&osdc->osds_timeout_work,
           round_jiffies_relative(osdc->client->options->osd_idle_ttl * HZ));
--

1.9.3

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#5 lore raw

PATCH 4/7 ceph: handle full condition by cancelling ops

In reply to John Spray

While cancelling, we store the OSD epoch at time
of cancellation, this will be used later in
CAPRELEASE messages.

---
 fs/ceph/mds_client.c | 21 +++++++++++++++++++++
 fs/ceph/mds_client.h |  1 +
 2 files changed, 22 insertions(+)
fs/ceph/mds_client.c +21 -0
index 9f00853..dce7977 100644
@@ -3265,6 +3265,23 @@ static void delayed_work(struct work_struct *work)
 	schedule_delayed(mdsc);
 }
 
+/**
+ * Call this with map_sem held for read
+ */
+static void handle_osd_map(struct ceph_osd_client *osdc, void *p)
+{
+	struct ceph_mds_client *mdsc = (struct ceph_mds_client*)p;
+	u32 cancelled_epoch = 0;
+
+	if (osdc->osdmap->flags & CEPH_OSDMAP_FULL) {
+		cancelled_epoch = ceph_osdc_cancel_writes(osdc, -ENOSPC);
+		if (cancelled_epoch) {
+			mdsc->cap_epoch_barrier = max(cancelled_epoch + 1,
+						      mdsc->cap_epoch_barrier);
+		}
+	}
+}
+
 int ceph_mdsc_init(struct ceph_fs_client *fsc)
 
 {
@@ -3311,6 +3328,10 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
 
 	ceph_caps_init(mdsc);
 	ceph_adjust_min_caps(mdsc, fsc->min_caps);
+	mdsc->cap_epoch_barrier = 0;
+
+	ceph_osdc_register_map_cb(&fsc->client->osdc,
+				  handle_osd_map, (void*)mdsc);
 
 	return 0;
 }
fs/ceph/mds_client.h +1 -0
index 230bda7..7b40568 100644
@@ -298,6 +298,7 @@ struct ceph_mds_client {
 	int               num_cap_flushing; /* # caps we are flushing */
 	spinlock_t        cap_dirty_lock;   /* protects above items */
 	wait_queue_head_t cap_flushing_wq;
+	u32               cap_epoch_barrier;
 
 	/*
 	 * Cap reservations
Signature · 1 line
1.9.3
author
#6 lore raw

PATCH 5/7 ceph: update CAPRELEASE message format

In reply to John Spray

Version 2 includes the new osd epoch barrier
field.

This allows clients to inform servers that their
released caps may not be used until a particular
OSD map epoch.

---
 fs/ceph/mds_client.c | 13 +++++++++++++
 fs/ceph/mds_client.h |  8 ++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
fs/ceph/mds_client.c +13 -0
index dce7977..3f5bc23 100644
@@ -1508,12 +1508,25 @@ void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
 			    struct ceph_mds_session *session)
 {
 	struct ceph_msg *msg;
+	u32             *cap_barrier;
 
 	dout("send_cap_releases mds%d\n", session->s_mds);
 	spin_lock(&session->s_cap_lock);
 	while (!list_empty(&session->s_cap_releases_done)) {
 		msg = list_first_entry(&session->s_cap_releases_done,
 				 struct ceph_msg, list_head);
+
+		BUG_ON(msg->front.iov_len + sizeof(*cap_barrier) > \
+		       PAGE_CACHE_SIZE);
+
+		// Append cap_barrier field
+		cap_barrier = msg->front.iov_base + msg->front.iov_len;
+		*cap_barrier = cpu_to_le32(mdsc->cap_epoch_barrier);
+		msg->front.iov_len += sizeof(*cap_barrier);
+
+		msg->hdr.version = cpu_to_le16(2);
+		msg->hdr.compat_version = cpu_to_le16(1);
+
 		list_del_init(&msg->list_head);
 		spin_unlock(&session->s_cap_lock);
 		msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
fs/ceph/mds_client.h +6 -2
index 7b40568..b9412a8 100644
@@ -92,10 +92,14 @@ struct ceph_mds_reply_info_parsed {
 
 /*
  * cap releases are batched and sent to the MDS en masse.
+ *
+ * Account for per-message overhead of mds_cap_release header
+ * and u32 for osd epoch barrier trailing field.
  */
 #define CEPH_CAPS_PER_RELEASE ((PAGE_CACHE_SIZE -			\
-				sizeof(struct ceph_mds_cap_release)) /	\
-			       sizeof(struct ceph_mds_cap_item))
+				sizeof(struct ceph_mds_cap_release) -   \
+				sizeof(u32)) /	\
+			        sizeof(struct ceph_mds_cap_item))
 
 
 /*
Signature · 1 line
1.9.3
author
#7 lore raw

PATCH 6/7 ceph: handle new osdmap barrier field in CLIENTCAPS

In reply to John Spray

In the latest version of this message, the barrier field is added as an instruction to clients that they may not use the attached capabilities until they have a particular OSD map epoch.

---
 fs/ceph/caps.c       | 110 +++++++++++++++++++++++++++++++++++++++++++++++--
 fs/ceph/mds_client.c | 114 +++++++++++++++++++++++++++++++++++++++++++--------
 fs/ceph/mds_client.h |   9 ++++
 fs/ceph/super.h      |   3 +-
 4 files changed, 214 insertions(+), 22 deletions(-)
fs/ceph/caps.c +106 -4
index eb1bf1f..99e3fdd 100644
@@ -979,6 +979,8 @@ static int send_cap_msg(struct ceph_mds_session *session,
 {
 	struct ceph_mds_caps *fc;
 	struct ceph_msg *msg;
+	int msg_len;
+	__le32 *epoch_barrier;
 
 	dout("send_cap_msg %s %llx %llx caps %s wanted %s dirty %s"
 	     " seq %u/%u mseq %u follows %lld size %llu/%llu"
@@ -988,15 +990,31 @@ static int send_cap_msg(struct ceph_mds_session *session,
 	     seq, issue_seq, mseq, follows, size, max_size,
 	     xattr_version, xattrs_buf ? (int)xattrs_buf->vec.iov_len : 0);
 
-	msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, sizeof(*fc), GFP_NOFS, false);
+	/*
+	 * MSG_CLIENT_CAPS version 5 size calculation:
+		sizeof(ceph_mds_caps) for caps field
+		0 bytes for snapbl field (headerless)
+		4 bytes for flockbl field len=0
+		0 bytes for peer field (op not in import|export)
+		8 bytes for inline_version
+		4 bytes for inline_data len=0
+		4 bytes for epoch barrier
+	*/
+	msg_len = sizeof(*fc) + 4 + 8 + 4 + 4;
+
+	msg = ceph_msg_new(CEPH_MSG_CLIENT_CAPS, msg_len, GFP_NOFS, false);
 	if (!msg)
 		return -ENOMEM;
+	memset(msg->front.iov_base, 0, msg_len);
+
+	epoch_barrier = msg->front.iov_base + sizeof(*fc) + 4 + 8 + 4;
+	*epoch_barrier = cpu_to_le32(session->s_mdsc->cap_epoch_barrier);
 
+	msg->hdr.version = cpu_to_le16(5);
+	msg->hdr.compat_version = cpu_to_le16(1);
 	msg->hdr.tid = cpu_to_le64(flush_tid);
 
 	fc = msg->front.iov_base;
-	memset(fc, 0, sizeof(*fc));
-
 	fc->cap_id = cpu_to_le64(cid);
 	fc->op = cpu_to_le32(op);
 	fc->seq = cpu_to_le32(seq);
@@ -2973,14 +2991,39 @@ retry:
 	*target_cap = cap;
 }
 
+
+
+/**
+ * Delay handling a cap message until a given OSD epoch
+ *
+ * Call with session mutex held
+ * Call with OSD map_sem held for read
+ */
+static void delay_message(struct ceph_mds_session *session, struct ceph_msg *msg, u32 epoch)
+{
+    struct ceph_delayed_message *dm;
+
+    ceph_msg_get(msg);
+
+    dm = kmalloc(sizeof(*dm), GFP_NOFS);
+    memset(dm, 0, sizeof(*dm));
+    dm->dm_epoch = epoch;
+    dm->dm_msg = msg;
+
+    list_add(&dm->dm_item, &session->s_delayed_msgs);
+}
+
 /*
  * Handle a caps message from the MDS.
  *
  * Identify the appropriate session, inode, and call the right handler
  * based on the cap op.
+ *
+ * skip_epoch_check: skip checking epoch_barrier (avoid taking mdsc and osdc locks)
  */
 void ceph_handle_caps(struct ceph_mds_session *session,
-		      struct ceph_msg *msg)
+		      struct ceph_msg *msg,
+		      bool skip_epoch_check)
 {
 	struct ceph_mds_client *mdsc = session->s_mdsc;
 	struct super_block *sb = mdsc->fsc->sb;
@@ -3001,6 +3044,9 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 	void *flock;
 	void *end;
 	u32 flock_len;
+	u64 inline_version;
+	u32 inline_len;
+	u32 epoch_barrier = 0;
 
 	dout("handle_caps from mds%d\n", mds);
 
@@ -3045,6 +3091,62 @@ void ceph_handle_caps(struct ceph_mds_session *session,
 		}
 	}
 
+	if (le16_to_cpu(msg->hdr.version) >= 5) {
+		void *p = flock + flock_len;
+
+		// Skip peer if applicable
+		if (op == CEPH_CAP_OP_IMPORT) {
+			p += sizeof(struct ceph_mds_cap_peer);
+		}
+
+		// We don't use this, but decode it to advance p
+		ceph_decode_64_safe(&p, end, inline_version, bad);
+
+		// Read 4 bytes for length of inline_data
+		ceph_decode_32_safe(&p, end, inline_len, bad);
+
+		// Skip length of inline_data
+		if (inline_len != 0) {
+			p += inline_len;
+		}
+
+		// Read epoch_barrier field
+		ceph_decode_32_safe(&p, end, epoch_barrier, bad);
+	}
+
+	dout("handle_caps v=%d barrier=%d skip=%d\n",
+		le16_to_cpu(msg->hdr.version),
+		epoch_barrier,
+		skip_epoch_check);
+
+	if (epoch_barrier && !skip_epoch_check) {
+		struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc;
+		// We are required to wait until we have this OSD map epoch
+		// before using the capability.
+		mutex_lock(&mdsc->mutex);
+		if (epoch_barrier > mdsc->cap_epoch_barrier) {
+			mdsc->cap_epoch_barrier = epoch_barrier;
+		}
+		mutex_unlock(&mdsc->mutex);
+
+		down_read(&osdc->map_sem);
+		if (osdc->osdmap->epoch < epoch_barrier) {
+			dout("handle_caps delaying message until OSD epoch %d\n", epoch_barrier);
+			mutex_lock(&session->s_mutex);
+			delay_message(session, msg, epoch_barrier);
+			mutex_unlock(&session->s_mutex);
+
+			// Kick OSD client to get the latest map
+			ceph_monc_request_next_osdmap(&osdc->client->monc);
+
+			up_read(&osdc->map_sem);
+			return;
+		} else {
+			dout("handle_caps barrier %d already satisfied (%d)\n", epoch_barrier, osdc->osdmap->epoch);
+			up_read(&osdc->map_sem);
+		}
+	}
+
 	/* lookup ino */
 	inode = ceph_find_inode(sb, vino);
 	ci = ceph_inode(inode);
fs/ceph/mds_client.c +97 -17

148 lines not on this page · raw message

fs/ceph/mds_client.h +9 -0
index b9412a8..e389358 100644
@@ -151,6 +151,15 @@ struct ceph_mds_session {
 	atomic_t          s_ref;
 	struct list_head  s_waiting;  /* waiting requests */
 	struct list_head  s_unsafe;   /* unsafe requests */
+
+    struct list_head  s_delayed_msgs;  /* OSD epoch waiters */
+};
+
+struct ceph_delayed_message
+{
+    struct ceph_msg  *dm_msg;
+    u32               dm_epoch;
+	struct list_head  dm_item;
 };
 
 /*
fs/ceph/super.h +2 -1
index aca2287..c6aab54 100644
@@ -814,7 +814,8 @@ static inline void ceph_forget_all_cached_acls(struct inode *inode)
 /* caps.c */
 extern const char *ceph_cap_string(int c);
 extern void ceph_handle_caps(struct ceph_mds_session *session,
-			     struct ceph_msg *msg);
+			     struct ceph_msg *msg,
+			     bool skip_epoch_check);
 extern struct ceph_cap *ceph_get_cap(struct ceph_mds_client *mdsc,
 				     struct ceph_cap_reservation *ctx);
 extern void ceph_add_cap(struct inode *inode,
Signature · 1 line
1.9.3
author
#8 lore raw

PATCH 7/7 ceph: include osd epoch barrier in debugfs

In reply to John Spray

This is useful in our automated testing, so that
we can verify that the barrier is propagating
correctly between servers and clients.

---
 fs/ceph/debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
fs/ceph/debugfs.c +3 -0
index 5d5a4c8..60db629 100644
@@ -174,6 +174,9 @@ static int mds_sessions_show(struct seq_file *s, void *ptr)
 	/* The -o name mount argument */
 	seq_printf(s, "name \"%s\"\n", opt->name ? opt->name : "");
 
+	/* The latest OSD epoch barrier known to this client */
+	seq_printf(s, "osd_epoch_barrier \"%d\"\n", mdsc->cap_epoch_barrier);
+
 	/* The list of MDS session rank+state */
 	for (mds = 0; mds < mdsc->max_sessions; mds++) {
 		struct ceph_mds_session *session =
Signature · 1 line
1.9.3