ceph: properly handle statfs on multifs setups
PATCH 1/1 ceph: properly handle statfs on multifs setups
ceph_statfs currently stuffs the cluster fsid into the f_fsid field. This was fine when we only had a single filesystem per cluster, but now that we have multiples we need to use something that will vary between them.
Change ceph_statfs to mix the current 64 bit hashed fsid down to 32 bits using a trivial xor hash. Shift that to be the upper 32 bits in the 64 bit field and then fold in the fs_cluster_id from the mon client.
That should give us a value that is guaranteed to be unique between filesystems within a cluster, and should minimize the chance of collisions between mounts of different clusters.
URL: https://tracker.ceph.com/issues/52812
Reported-by Sachin Prabhu <[email protected]>
Signed-off-by Jeff Layton <[email protected]>
--- fs/ceph/super.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/ceph/super.c +6 -0
@@ -104,6 +104,12 @@ static int ceph_statfs(struct dentry *dentry, struct kstatfs *buf)le64_to_cpu (*((__le64 *)&monc->monmap->fsid +1 ));mutex_unlock (&monc->mutex); +/* mix the fsid down to 32 bits */ + fsid = *(u32 *)&fsid ^ *((u32 *)&fsid +1 ); + +/* fold the fs_cluster_id into the upper bits */ + fsid |= ((u64 )monc->fs_cluster_id <<32 ); + buf->f_fsid =u64_to_fsid (fsid);return 0 ;
Signature · 1 line
2.31.1