xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: xen-devel@lists.xenproject.org
Cc: Juergen Gross <jgross@suse.com>,
	wei.liu2@citrix.com, ian.jackson@eu.citrix.com
Subject: [PATCH 1/2] xenstore: set correct error code when violating quota
Date: Mon, 20 Mar 2017 09:00:20 +0100	[thread overview]
Message-ID: <20170320080021.12720-2-jgross@suse.com> (raw)
In-Reply-To: <20170320080021.12720-1-jgross@suse.com>

When the number of permitted xenstore entries for a domain is being
exceeded the operation trying to create a new entry is denied.
Unfortunately errno isn't being set in this case so the error code
returned to the client is undefined.

Set errno to ENOSPC in this case.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
This is a backport candidate.
---
 tools/xenstore/xenstored_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 5c659d8..ed80345 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -937,8 +937,10 @@ static struct node *construct_node(struct connection *conn, const void *ctx,
 	if (!parent)
 		return NULL;
 
-	if (domain_entry(conn) >= quota_nb_entry_per_domain)
+	if (domain_entry(conn) >= quota_nb_entry_per_domain) {
+		errno = ENOSPC;
 		return NULL;
+	}
 
 	/* Add child to parent. */
 	base = basename(name);
-- 
2.10.2


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-03-20  8:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20  8:00 [PATCH 0/2] xensore: fixing two bugs Juergen Gross
2017-03-20  8:00 ` Juergen Gross [this message]
2017-03-21 17:14   ` [PATCH 1/2] xenstore: set correct error code when violating quota Wei Liu
2017-03-21 17:16     ` Wei Liu
2017-03-21 17:21       ` Juergen Gross
2017-03-21 17:45         ` Wei Liu
2017-03-20  8:00 ` [PATCH 2/2] xenstore: add missing checks for allocation failure Juergen Gross
2017-03-21 17:17   ` Wei Liu
2017-04-03 13:54 ` [PATCH 0/2] xensore: fixing two bugs Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170320080021.12720-2-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).