]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
ceph: handle full condition by cancelling ops
authorJohn Spray <john.spray@redhat.com>
Wed, 15 Oct 2014 12:11:34 +0000 (13:11 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 30 Oct 2014 13:47:54 +0000 (13:47 +0000)
Signed-off-by: John Spray <john.spray@redhat.com>
fs/ceph/mds_client.c
fs/ceph/mds_client.h

index 5a47ed760e6d4e6bd78ecdb19bf945edc1935f1d..cb9a2a173d3a9a07adbacbdcba45804659af26d2 100644 (file)
@@ -3267,6 +3267,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)
 
 {
@@ -3313,6 +3330,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;
 }
index 230bda791d4f44df5127a9e878ad501d302acaf1..7b405689964db1f254fb7d160bde191b601378c0 100644 (file)
@@ -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