From 8d2e5d8062361df451be7c6f748a23884f1cf315 Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Wed, 22 Apr 2009 02:21:46 +0530 Subject: afr_lookup_cbk - self-heal getting missed compare for mismatching sizes and attributes before overwriting local->stbuf for read-child subvolume. This causes files with differing sizes on backed not to get self-healed if xattrs were missing. Also add the ESTALE check for compulsorily failing revalidates in case of 2nd unwind and beyond Signed-off-by: Anand V. Avati --- xlators/cluster/afr/src/afr.c | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 270364ff999..1808961adca 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -521,15 +521,36 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie, } } else { - if ((local->op_ret == 0) - && (child_index == local->read_child_index)) { + if (FILETYPE_DIFFERS (buf, lookup_buf)) { + /* mismatching filetypes with same name + -- Govinda !! GOvinda !!! + */ + local->govinda_gOvinda = 1; + } + + if (PERMISSION_DIFFERS (buf, lookup_buf)) { + /* mismatching permissions */ + local->need_metadata_self_heal = 1; + } + + if (OWNERSHIP_DIFFERS (buf, lookup_buf)) { + /* mismatching permissions */ + local->need_metadata_self_heal = 1; + } + + if (SIZE_DIFFERS (buf, lookup_buf) + && S_ISREG (buf->st_mode)) { + local->need_data_self_heal = 1; + } + + if (child_index == local->read_child_index) { /* lookup has succeeded on the read child. So use its inode number */ - - local->op_ret = op_ret; + if (local->op_errno != ESTALE) + local->op_ret = op_ret; if (local->cont.lookup.xattr) dict_unref (local->cont.lookup.xattr); @@ -553,27 +574,6 @@ afr_lookup_cbk (call_frame_t *frame, void *cookie, } } - if (FILETYPE_DIFFERS (buf, lookup_buf)) { - /* mismatching filetypes with same name - -- Govinda !! GOvinda !!! - */ - local->govinda_gOvinda = 1; - } - - if (PERMISSION_DIFFERS (buf, lookup_buf)) { - /* mismatching permissions */ - local->need_metadata_self_heal = 1; - } - - if (OWNERSHIP_DIFFERS (buf, lookup_buf)) { - /* mismatching permissions */ - local->need_metadata_self_heal = 1; - } - - if (SIZE_DIFFERS (buf, lookup_buf) - && S_ISREG (buf->st_mode)) { - local->need_data_self_heal = 1; - } } local->success_count++; -- cgit