diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 3376822a624e2bee77d9b3b969bc3925bf1bdfd1..5f7ad3d0df2ea69121acded120e26d05515fd79a 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -857,7 +857,7 @@ static int ceph_writepages_start(struct address_space *mapping, * in that range can be associated with newer snapc. * They are not writeable until we write all dirty pages * associated with 'snapc' get written */ - if (index > 0 || wbc->sync_mode != WB_SYNC_NONE) + if (index > 0) should_loop = true; dout(" non-head snapc, range whole\n"); } @@ -903,6 +903,10 @@ static int ceph_writepages_start(struct address_space *mapping, if (pgsnapc != snapc) { dout("page snapc %p %lld != oldest %p %lld\n", pgsnapc, pgsnapc->seq, snapc, snapc->seq); + if (!should_loop && + !ceph_wbc.head_snapc && + wbc->sync_mode != WB_SYNC_NONE) + should_loop = true; unlock_page(page); continue; }