This ensures that when snap metadata is flushed, we will be auth on both
inodes and be able to do the update properly. This isn't the nicest
solution ever, since it can make migrations laggy, but it's the simplest.
Signed-off-by: Sage Weil <sage@newdream.net>
if (client_need_snapflush.empty()) {
get(CInode::PIN_NEEDSNAPFLUSH);
+
+ // FIXME: this is non-optimal, as we'll block freezes/migrations for potentially
+ // long periods waiting for clients to flush their snaps.
+ auth_pin(this); // pin head inode...
}
set<client_t>& clients = client_need_snapflush[snapid];
+ if (clients.empty())
+ snapin->auth_pin(this); // ...and pin snapped/old inode!
+
clients.insert(client);
}
clients.erase(client);
if (clients.empty()) {
client_need_snapflush.erase(snapid);
+ snapin->auth_unpin(this);
if (client_need_snapflush.empty()) {
put(CInode::PIN_NEEDSNAPFLUSH);
+ auth_unpin(this);
}
}
}