From 09d981409f1379265ee02db9cd5f62672fba4747 Mon Sep 17 00:00:00 2001 From: Jeff Darcy Date: Wed, 10 Oct 2012 09:12:50 -0400 Subject: nfs: do lookup on getattr after brick-status change By doing a lookup, we get a chance to do all of the self-heal checks that would occur if we were using native protocol, and return proper status if the self-heal fails. Best of all, we don't need to misrepresent times. Change-Id: I76477d1e5fce4d83e4029e02fcdd71e81e23110d BUG: 830134 Signed-off-by: Jeff Darcy Reviewed-on: http://review.gluster.org/4058 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/nfs/server/src/nfs.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'xlators/nfs/server/src/nfs.c') diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 0a5a9d1e3..033d95213 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -759,6 +759,7 @@ nfs_init_state (xlator_t *this) this->private = (void *)nfs; INIT_LIST_HEAD (&nfs->versions); + nfs->generation = 1965; ret = 0; @@ -843,24 +844,26 @@ int notify (xlator_t *this, int32_t event, void *data, ...) { xlator_t *subvol = NULL; + struct nfs_state *priv = NULL; subvol = (xlator_t *)data; gf_log (GF_NFS, GF_LOG_TRACE, "Notification received: %d", event); - switch (event) - { - case GF_EVENT_CHILD_UP: - { - nfs_startup_subvolume (this, subvol); - break; - } - case GF_EVENT_PARENT_UP: - { - default_notify (this, GF_EVENT_PARENT_UP, data); - break; - } + switch (event) { + case GF_EVENT_CHILD_UP: + nfs_startup_subvolume (this, subvol); + break; + + case GF_EVENT_CHILD_MODIFIED: + priv = this->private; + ++(priv->generation); + break; + + case GF_EVENT_PARENT_UP: + default_notify (this, GF_EVENT_PARENT_UP, data); + break; } return 0; @@ -882,14 +885,14 @@ fini (xlator_t *this) int32_t nfs_forget (xlator_t *this, inode_t *inode) { - uint64_t ctx = 0; - struct list_head *head = NULL; + uint64_t ctx = 0; + struct nfs_inode_ctx *ictx = NULL; if (inode_ctx_del (inode, this, &ctx)) return -1; - head = (struct list_head *)ctx; - GF_FREE (head); + ictx = (struct nfs_inode_ctx *)ctx; + GF_FREE (ictx); return 0; } -- cgit