> On Jun 16, 2015, at 7:18 PM, Josh Durgin <jdurgin@xxxxxxxxxx> wrote: > > On 06/12/2015 08:56 AM, Douglas Fuller wrote: >> >> @@ -3132,6 +3132,26 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, s32 return_code, >> rbd_warn(rbd_dev, "notify_ack ret %d", ret); >> } >> >> +static void rbd_watch_error_cb(void *arg, u64 cookie, int err) >> +{ >> + struct rbd_device *rbd_dev = (struct rbd_device *)arg; >> + int ret; >> + >> + dout("%s: watch error %d on cookie %llu\n", rbd_dev->header_name, >> + err, cookie); >> + rbd_warn(rbd_dev, "%s: watch error %d on cookie %llu\n", >> + rbd_dev->header_name, err, cookie); >> + >> + /* reset watch */ >> + rbd_dev_refresh(rbd_dev); >> + rbd_dev_header_unwatch_sync(rbd_dev); >> + ret = rbd_dev_header_watch_sync(rbd_dev); >> + BUG_ON(ret); /* XXX: was the image deleted? can we be more graceful? */ >> + rbd_dev_refresh(rbd_dev); > > Why refresh before and after unwatching? Only the second one seems > necessary. The first one isn’t strictly necessary; I can remove it if you want. If we get a watch error, we may very well have a situation in which we need to stop I/O to the device because the underlying image has been deleted or its features have changed. We don’t actually do that yet (we just print a warning message), but the extra refresh was to handle that case early, even before we bothered trying to re-establish the watch.-- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html