From 77a7ae0fbf5bf1a0eaa2d18a31bd0c6ef1913ef8 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Fri, 9 Aug 2013 11:12:29 -0700 Subject: libgfapi : Fix for hardlink creation on SMB mount Previously the inode of the hard link was left uninitialised hence glfs_loc_link() used to fail with invalid parameter.Since inode is same for both the files in hard link creation, updated the inode field of hard link to be same as that of the original file. Change-Id: Ifd6439867d982524a7b48bf3f6add6e844b3c4c1 BUG: 996063 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/5882 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- api/src/glfs-fops.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'api/src/glfs-fops.c') diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index 4e1a7ef530a..dd9ea451aae 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -1609,6 +1609,15 @@ retrynew: goto out; } + /* Filling the inode of the hard link to be same as that of the + original file + */ + if (newloc.inode) { + inode_unref (newloc.inode); + newloc.inode = NULL; + } + newloc.inode = inode_ref (oldloc.inode); + ret = syncop_link (subvol, &oldloc, &newloc); if (ret == -1 && errno == ESTALE) { -- cgit