ceph: fix version check on racing inode updates

We may get updates on the same inode from multiple MDSs; generally we only
pay attention if the update is newer than what we already have. The
exception is when an MDS sense unstable information, in which case we
always update.

The old > check got this wrong when our version was odd (e.g. 3) and the
reply version was even (e.g. 2): the older stale (v2) info would be
applied. Fixed and clarified the comment.

Signed-off-by: Sage Weil <sage@newdream.net>

Sage Weil 8bd59e01 cb4276cc

+9 -4
+9 -4
fs/ceph/inode.c
··· 567 568 /* 569 * provided version will be odd if inode value is projected, 570 - * even if stable. skip the update if we have a newer info 571 - * (e.g., due to inode info racing form multiple MDSs), or if 572 - * we are getting projected (unstable) inode info. 573 */ 574 if (le64_to_cpu(info->version) > 0 && 575 - (ci->i_version & ~1) > le64_to_cpu(info->version)) 576 goto no_change; 577 578 issued = __ceph_caps_issued(ci, &implemented);
··· 567 568 /* 569 * provided version will be odd if inode value is projected, 570 + * even if stable. skip the update if we have newer stable 571 + * info (ours>=theirs, e.g. due to racing mds replies), unless 572 + * we are getting projected (unstable) info (in which case the 573 + * version is odd, and we want ours>theirs). 574 + * us them 575 + * 2 2 skip 576 + * 3 2 skip 577 + * 3 3 update 578 */ 579 if (le64_to_cpu(info->version) > 0 && 580 + (ci->i_version & ~1) >= le64_to_cpu(info->version)) 581 goto no_change; 582 583 issued = __ceph_caps_issued(ci, &implemented);