struct ocfs2_xattr_search *xbs,
                                    struct ocfs2_xattr_set_ctxt *ctxt)
 {
-       int ret = 0, credits;
+       int ret = 0, credits, old_found;
 
        if (!xi->value) {
                /* Remove existing extended attribute */
                        xi->value = NULL;
                        xi->value_len = 0;
 
+                       old_found = xis->not_found;
                        xis->not_found = -ENODATA;
                        ret = ocfs2_calc_xattr_set_need(inode,
                                                        di,
                                                        NULL,
                                                        NULL,
                                                        &credits);
+                       xis->not_found = old_found;
                        if (ret) {
                                mlog_errno(ret);
                                goto out;
                                if (ret)
                                        goto out;
 
+                               old_found = xis->not_found;
                                xis->not_found = -ENODATA;
                                ret = ocfs2_calc_xattr_set_need(inode,
                                                                di,
                                                                NULL,
                                                                NULL,
                                                                &credits);
+                               xis->not_found = old_found;
                                if (ret) {
                                        mlog_errno(ret);
                                        goto out;