From de3023c8b5ded9c82414eec153fc660f568b688e Mon Sep 17 00:00:00 2001 From: vmallika Date: Wed, 22 Jul 2015 09:02:39 +0530 Subject: quota: fix parents caching during build ancestry In build ancestry, we get the list of parents for a file, these parents are cached in inode ctx. This caching is not happening because posix is not setting d_stat information in the leaf node entry This patch fixes the issue Inode-ctx is not updated with new parent when rename performed on same directory. This patch fixes the issue There is a possibility of caching stale entries, consider below example: 1) build_ancestry invoked on a file 2) rename is invoked on the same file 3) buils_ancestry prepared entries of old parent 4) rename completed and in cbk old parent is replaced with new parent in inode ctx 5) now build_ancestry cbk adds old parent to inode ctx In this patch we also remove stale entries in writev and fallocate Change-Id: Ib1854a41b47b14eb775326588352015c83d034de BUG: 1240949 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/11574 Tested-by: Gluster Build System Reviewed-by: Raghavendra G --- xlators/storage/posix/src/posix.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'xlators/storage/posix') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 047600e2e21..54ff155452b 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -3524,7 +3524,7 @@ out: int32_t posix_links_in_same_directory (char *dirpath, int count, inode_t *leaf_inode, - inode_t *parent, uint64_t ino, + inode_t *parent, struct stat *stbuf, gf_dirent_t *head, char **path, int type, dict_t *xdata, int32_t *op_errno) { @@ -3560,7 +3560,7 @@ posix_links_in_same_directory (char *dirpath, int count, inode_t *leaf_inode, if ((result == NULL) || *op_errno) break; - if (entry->d_ino != ino) + if (entry->d_ino != stbuf->st_ino) continue; linked_inode = inode_link (leaf_inode, parent, @@ -3584,6 +3584,8 @@ posix_links_in_same_directory (char *dirpath, int count, inode_t *leaf_inode, gf_entry->dict = posix_xattr_fill (this, temppath, &loc, NULL, -1, xdata, NULL); + iatt_from_stat (&(gf_entry->d_stat), stbuf); + list_add_tail (&gf_entry->list, &head->list); loc_wipe (&loc); } @@ -3765,8 +3767,7 @@ posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode, dirpath[strlen (dirpath) - 1] = '\0'; posix_links_in_same_directory (dirpath, nlink_samepgfid, - leaf_inode, - parent, stbuf.st_ino, head, + leaf_inode, parent, &stbuf, head, path, type, xdata, op_errno); if (parent != NULL) { -- cgit