From 7c3a824070cbf29b31bc16139f1ce74c70df515f Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Mon, 13 May 2013 14:00:01 +0800 Subject: [PATCH] LU-2904 obdclass: return valid uuid for statfs Lustre uses 64-bits inode number to identify object on client side. When re-export Lustre via NFS, NFS will detect whether support uuid via statfs(). For the non-support case, it will only recognizes and packs low 32-bits inode number in nfs handle. Such handle cannot be to locate the object properly. To avoid patch linux kernel, Lustre client will fetch the uuid from MDT0 statfs(). Signed-off-by: Fan Yong Change-Id: Ie292b26726a1b2aa7a763ef7c0507e3ed089323b --- lustre/obdclass/statfs_pack.c | 2 ++ lustre/osd-zfs/udmu.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/obdclass/statfs_pack.c b/lustre/obdclass/statfs_pack.c index 7284f65..8027065 100644 --- a/lustre/obdclass/statfs_pack.c +++ b/lustre/obdclass/statfs_pack.c @@ -60,6 +60,7 @@ void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs) osfs->os_ffree = sfs->f_ffree; osfs->os_bsize = sfs->f_bsize; osfs->os_namelen = sfs->f_namelen; + memcpy(osfs->os_fsid, &sfs->f_fsid, sizeof(sfs->f_fsid)); } EXPORT_SYMBOL(statfs_pack); @@ -74,5 +75,6 @@ void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs) sfs->f_ffree = osfs->os_ffree; sfs->f_bsize = osfs->os_bsize; sfs->f_namelen = osfs->os_namelen; + memcpy(&sfs->f_fsid, osfs->os_fsid, sizeof(sfs->f_fsid)); } EXPORT_SYMBOL(statfs_unpack); diff --git a/lustre/osd-zfs/udmu.c b/lustre/osd-zfs/udmu.c index 2a5a783..bccfab3 100644 --- a/lustre/osd-zfs/udmu.c +++ b/lustre/osd-zfs/udmu.c @@ -247,6 +247,7 @@ int udmu_objset_statfs(udmu_objset_t *uos, struct obd_statfs *osfs) uint64_t refdbytes, availbytes, usedobjs, availobjs; uint64_t est_availobjs; uint64_t reserved; + uint64_t guid; dmu_objset_space(uos->os, &refdbytes, &availbytes, &usedobjs, &availobjs); @@ -301,8 +302,8 @@ int udmu_objset_statfs(udmu_objset_t *uos, struct obd_statfs *osfs) osfs->os_ffree = min(availobjs, est_availobjs); osfs->os_files = osfs->os_ffree + uos->objects; - /* ZFS XXX: fill in backing dataset FSID/UUID - memcpy(osfs->os_fsid, .... );*/ + guid = dmu_objset_fsid_guid(uos->os); + memcpy(osfs->os_fsid, &guid, sizeof(guid)); /* We're a zfs filesystem. */ osfs->os_type = UBERBLOCK_MAGIC; -- 1.7.1