ceph: fix capsnap dirty pages accounting
authorYan, Zheng <zyan@redhat.com>
Sun, 3 Sep 2017 02:09:11 +0000 (10:09 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 6 Sep 2017 17:56:59 +0000 (19:56 +0200)
writepages_finish() calls ceph_put_wrbuffer_cap_refs() once for
all pages, parameter snapc is set to req->r_snapc. So writepages()
shouldn't write dirty pages associated with different snapc in
one OSD request.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/addr.c

index 201e529..1ffdb90 100644 (file)
@@ -930,8 +930,8 @@ get_more_pages:
 
                        /* only if matching snap context */
                        pgsnapc = page_snap_context(page);
 
                        /* only if matching snap context */
                        pgsnapc = page_snap_context(page);
-                       if (pgsnapc->seq > snapc->seq) {
-                               dout("page snapc %p %lld > oldest %p %lld\n",
+                       if (pgsnapc != snapc) {
+                               dout("page snapc %p %lld != oldest %p %lld\n",
                                     pgsnapc, pgsnapc->seq, snapc, snapc->seq);
                                unlock_page(page);
                                continue;
                                     pgsnapc, pgsnapc->seq, snapc, snapc->seq);
                                unlock_page(page);
                                continue;