From 54ea75f800b9158083bd5d7f6316fd814d0deaf9 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Sun, 19 May 2013 23:31:38 -0700 Subject: gfapi: provide stable st_dev in stat structure Samba depends on st_dev being unique and stable for different filesystems (it uses st_dev+st_ino as key to store metadata of a file). Change-Id: Ia022fabadfb5ef3fc9724c1b1ca86f1a20f98af9 BUG: 953694 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/5164 Tested-by: Gluster Build System Reviewed-by: Xavier Hernandez Reviewed-by: Vijay Bellur --- api/src/glfs-fops.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'api/src/glfs-fops.c') diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 0bea82a04cb..dadaf4b4d10 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -52,6 +52,14 @@ glfs_loc_link (loc_t *loc, struct iatt *iatt) } +static void +glfs_iatt_to_stat (struct glfs *fs, struct iatt *iatt, struct stat *stat) +{ + iatt_to_stat (iatt, stat); + stat->st_dev = fs->dev_id; +} + + static int glfs_loc_unlink (loc_t *loc) { @@ -172,7 +180,7 @@ retry: ESTALE_RETRY (ret, errno, reval, &loc, retry); if (ret == 0 && stat) - iatt_to_stat (&iatt, stat); + glfs_iatt_to_stat (fs, &iatt, stat); out: loc_wipe (&loc); @@ -203,7 +211,7 @@ retry: ESTALE_RETRY (ret, errno, reval, &loc, retry); if (ret == 0 && stat) - iatt_to_stat (&iatt, stat); + glfs_iatt_to_stat (fs, &iatt, stat); out: loc_wipe (&loc); @@ -230,7 +238,7 @@ glfs_fstat (struct glfs_fd *glfd, struct stat *stat) ret = syncop_fstat (subvol, glfd->fd, &iatt); if (ret == 0 && stat) - iatt_to_stat (&iatt, stat); + glfs_iatt_to_stat (glfd->fs, &iatt, stat); out: return ret; } @@ -1705,7 +1713,7 @@ glfs_readdirplus_r (struct glfs_fd *glfd, struct stat *stat, struct dirent *buf, if (entry) { gf_dirent_to_dirent (entry, buf); if (stat) - iatt_to_stat (&entry->d_stat, stat); + glfs_iatt_to_stat (glfd->fs, &entry->d_stat, stat); } out: return ret; -- cgit